An Elixir library for building and validating complex database query filters from client parameters, with Ecto integration.
Filtrex is an Elixir library that simplifies building and validating complex database query filters from client parameters, such as URL query strings or stored JSON configurations. It integrates with Ecto to securely translate filter criteria into SQL queries, solving problems like parameter standardization, validation, and reusable smart filters.
Elixir developers building web applications (e.g., with Phoenix) that require robust, secure filtering of database results based on user-provided criteria.
Developers choose Filtrex for its clean DSL, Ecto-native integration, and focus on security—it validates filters to prevent unintended data exposure while reducing boilerplate code for parameter handling.
A library for performing and validating complex filters from a client (e.g. smart filters)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Directly builds Ecto queries from validated filters, reducing boilerplate and ensuring type safety with Elixir's Ecto, as shown in the query building examples.
Validates all incoming filter parameters against a configuration DSL to prevent unauthorized data exposure, addressing security concerns in web applications.
Serializes filters into JSON-friendly maps for storage and later reuse, enabling smart filter features like saved searches, detailed in the storing filters section.
Supports complex filter unions (any, all, none) and nesting for intricate scenarios, making it suitable for admin dashboards and advanced search interfaces.
The README admits it has only been tested with PostgreSQL, so using it with other databases like MySQL or SQLite may require additional work and could lead to unexpected issues.
Requires explicit DSL configuration for each filter type, which can become cumbersome in applications with many filterable fields or dynamic schemas, adding setup complexity.
Tightly coupled with Ecto, making it unsuitable for projects using raw SQL or alternative query builders, and adding overhead if Ecto is not already a core dependency.