nestjs-rest-querynestjs-rest-query
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:

  1. Validates the query string against RulesConfig (the security whitelist)
  2. Normalizes the parameters: filters, sorts, fields, includes
  3. 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

ORMWhen to useStatus
TypeORMYou already use TypeORM and @nestjs/typeorm. It is the default - no extra setup required.βœ… Stable
DrizzleYou prefer strict typing, type-safe schema generation, or want a more modern ORM. Requires a relations map configuration.βœ… Stable
PrismaYou already have a Prisma schema. The adapter returns Prisma's native nested graph and @prisma/client is an optional peer dep.βœ… Stable
CustomYou want to support Kysely, raw SQL, or any other ORM. Implement the RestQueryAdapter interface.πŸ“– Learn more

Get started

Choose your ORM:

Edit this page on GitHub

On this page