AdaptersAdapters
Adapters
Choose the ORM that fits your project - nestjs-rest-query works with TypeORM, Drizzle, and custom adapters.
nestjs-rest-query separates query parameter parsing logic from the ORM-specific implementation. This is done through adapters - each adapter translates normalized queries into native ORM calls.
The Adapter pattern
When you decorate an endpoint with @ApiDynamicQuery or @DynamicQuery, the library:
- Validates the query string against
RulesConfig(the security whitelist) - Normalizes the parameters: filters, sorts, fields, includes
- Delegates to the adapter - which turns that normalized input into native SQL/query
The adapter is registered once via DynamicQueryBuilderModule.forRoot({ adapter }). From that point on, the same RulesConfig works identically in any supported ORM.
When to use each adapter
| ORM | When to use | Status |
|---|---|---|
| TypeORM | You already use TypeORM and @nestjs/typeorm. It is the default - no extra setup required. | β Stable |
| Drizzle | You prefer strict typing, type-safe schema generation, or want a more modern ORM. Requires a relations map configuration. | β Stable |
| Prisma | You already have a Prisma schema. The adapter returns Prisma's native nested graph and @prisma/client is an optional peer dep. | β Stable |
| Custom | You want to support Kysely, raw SQL, or any other ORM. Implement the RestQueryAdapter interface. | π Learn more |
Get started
Choose your ORM: