nestjs-rest-querynestjs-rest-query
Getting StartedNestJS Prerequisite

NestJS Prerequisite

Requirements for using nestjs-rest-query in a NestJS application with TypeORM, Drizzle, or Prisma.

Before installing the library, confirm that your NestJS project already meets the requirements below.

This library was designed for NestJS applications that use TypeORM, Drizzle, or Prisma and have decorators enabled. If that is your scenario, the setup is usually simple.

NestJS application

RequirementMinimum versionNote
NestJS^11.0.0The library was designed for NestJS projects with @nestjs/common and @nestjs/core present.

Runtime

RequirementMinimum version
Node.js>= 20

Peer dependencies

These packages must be present in your project — they are not included in the library.

PackageMinimum versionRequired
@nestjs/common^11.0.0Yes
@nestjs/core^11.0.0Yes
reflect-metadata^0.2.0Yes
typeorm^0.3.26One of the adapters
drizzle-orm^0.45.0One of the adapters
@prisma/client^5 || ^6 || ^7One of the adapters
@nestjs/swagger^11.0.0Optional

If your project is not using NestJS yet, start by creating the application with nest new. The library depends on the framework ecosystem for decorators, metadata, and dependency injection.

@nestjs/swagger is only required if you want to generate OpenAPI documentation with @ApiDynamicQuery and test filters through the Swagger UI. See the Swagger section for details.

Supported adapters

TypeORM

TypeORM support is stable and uses a SelectQueryBuilder generated from your Repository. All filter, sort, field, include, and pagination logic is applied on top of that builder.

This means:

  • You need TypeORM configured with at least one database (PostgreSQL, MySQL, SQLite, etc.).
  • Your entities must use TypeORM decorators (@Entity, @Column, @ManyToOne, etc.).
  • The TypeORM adapter operates on TypeORM repositories — there is no support for raw query or other abstraction layers.

Drizzle

Drizzle support is stable and is opted in via DrizzleAdapter. The adapter uses your Drizzle database instance plus an explicit relations map when relations are needed.

This means:

  • You need Drizzle configured with a supported driver (PostgreSQL, MySQL, SQLite, etc.).
  • Your schema must be declared with Drizzle (pgTable, mysqlTable, etc.).
  • When using includes, you must declare the relations map so the adapter can resolve them safely.

Prisma

Prisma support is stable and is opted in via PrismaAdapter. The adapter works with Prisma Client and any database Prisma supports.

This means:

  • You need Prisma configured with a supported database (PostgreSQL, MySQL, SQLite, etc.).
  • Your schema must be declared in schema.prisma and a Prisma Client generated.
  • Pass a PrismaSource describing the client and model name to queryBuilderService.execute().
Edit this page on GitHub

On this page