An Elixir library that integrates Arc file uploads with Ecto schemas for seamless attachment handling.
Arc.Ecto is an Elixir library that integrates Arc, a file upload solution, with Ecto, Elixir's database wrapper. It simplifies storing and managing file attachments like avatars or documents directly within Ecto schemas by providing custom types and changeset support. This bridges the gap between file upload handling and database interactions in Elixir applications.
Elixir developers building applications with Ecto that require file upload functionality, such as user avatars, document storage, or media attachments. It is particularly useful for those already using or considering Arc for file uploads and seeking seamless database integration.
Developers choose Arc.Ecto because it offers a clean, declarative way to handle file attachments that feels native to the Ecto ecosystem, reducing boilerplate code. Its unique selling point is the tight integration with Ecto changesets and schemas, enabling cache-busting URLs and compatibility with Arc's storage backends without modification.
An integration with Arc and Ecto.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides custom Ecto types and cast_attachments/3 function, allowing file uploads to be processed within changesets just like other fields, reducing boilerplate as shown in the schema examples.
Generates URLs with timestamps for uploaded files, preventing browser caching issues for updates, demonstrated in the retrieval examples with query parameters like v=63601457477.
Uses Arc.Ecto.Schema and Arc.Ecto.Definition macros to attach files directly to schemas with declarative code, simplifying setup without manual URL handling or storage logic.
Works with all Arc storage backends and rendition systems without modification, enabling flexible file management like S3 uploads and thumbnail generation as per Arc's features.
Tightly dependent on Arc for core file upload functionality, making it difficult to switch to other libraries like Waffle or Mogrify without significant refactoring of schemas and changesets.
Requires adding specific string columns to database tables and using macros in schemas, which can be cumbersome for legacy systems or projects with complex data models not designed for file attachments.
File uploads are processed through Ecto changesets, which may not suit batch uploads, direct file handling outside transactions, or non-ORM contexts, potentially adding latency for high-throughput scenarios.