Adonis Lucid Filter (v5.2.0) is a Lucid ORM addon for AdonisJS v6 that simplifies query filtering by automatically mapping HTTP query parameters to model filter methods. It reduces boilerplate code, supports CamelCase-to-snake_case conversion, ignores empty strings and unmatched inputs, and provides a `setup()` method for global query modifications. The package is actively maintained, with ~monthly releases, and ships TypeScript types. It requires @adonisjs/core ^6.2.3, @adonisjs/lucid ^21.1.0, and lodash. Compared to manual filtering, it offers a declarative, convention-driven approach inspired by EloquentFilter.
npm install adonis-lucid-filterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Complete setup flow: install, configure, generate filter, define filter methods, and apply in controller.
Update AdonisJS to v6.2.3+ and Lucid to v21.1.0+
For v5, do not use @filterable(); extend BaseModelFilter instead
Stay on v4 for AdonisJS v5; no migration needed unless moving to v6
Name methods like: param 'company_id' => method companyId() (without '_id')
If you need to handle empty strings, check this.$input[key] manually in setup()
Ensure adonisrc.ts imports 'adonis-lucid-filter/provider' and not 'adonis-lucid-filter/providers'
In your model: import { filter } from 'adonis-lucid-filter' and apply @filter() decorator or use static mixinAdd () => import('adonis-lucid-filter/commands') to commands array in adonisrc.tsAdd !: (non-null assertion) to $query declaration in filter class, or use 'as any'