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.
NestJS application
| Requirement | Version | Note |
|---|---|---|
| NestJS | ^11.0.0 | @nestjs/common and @nestjs/core must both be present. 12.x is not in range. |
Runtime
| Requirement | Version |
|---|---|
| Node.js | >= 22 |
Node 24.x is the primary target: it is what the database matrix runs on. The
general CI job also runs 22.x.
Peer dependencies
These packages must be present in your project — they are not bundled with
the library. All four ORM/Swagger peers are declared optional, and the root
entrypoint loads none of them: import ... from 'nestjs-rest-query' never
pulls in an ORM.
| Package | Range | Required |
|---|---|---|
@nestjs/common | ^11.0.0 | Yes |
@nestjs/core | ^11.0.0 | Yes |
reflect-metadata | ^0.2.0 | Yes |
typeorm | ^0.3.26 || ^1.0.0 | One of the adapters |
drizzle-orm | >=1.0.0-rc.4 <1.0.0 | One of the adapters |
@prisma/client | ^6.19.0 || ^7.0.0 | One of the adapters |
@nestjs/swagger | ^11.0.0 | Optional |
Drizzle 0.45.x is not supported
The drizzle-orm range is closed on the release candidates the parity matrix
was measured against. A 0.45.x project stays on the 2.x line of this
library; upgrading Drizzle is mandatory, not optional, and it breaks four
things — see the Drizzle adapter page.
@nestjs/swagger is only needed to generate OpenAPI documentation with
@ApiDynamicQuery and to try filters from the Swagger UI. Without it, the
decorator still registers the endpoint rules; it just emits no OpenAPI
parameters. See Swagger.
Databases
Parity is promised over a certified database profile, published in
test/profiles/:
PostgreSQL 18, MySQL 8.4 LTS and SQL Server 2022, with code-point collation on
portable text columns. collectProfileFacts() and checkPortabilityProfile()
are exported so you can verify your own database against it, and
forRoot({ portability: { enforce: true } }) turns a mismatch into a refusal
instead of a surprise.
SQLite is the reference dialect, not a matrix cell: it proves each adapter's
compiler implements the plan's semantics. It is what
01-starter-app
runs on.
Two column families your schema has to grow
Neither is configuration; both are DDL your application fills in.
- Folded columns.
search,ilikeandnotIlikenever emitILIKEor Prisma'smode: 'insensitive'. They compare a pre-normalised column against a term normalised by the same function, which is what makes the same request return the same rows regardless of server collation. A field used bysearchwith nofoldedFieldmakesdefineQueryRulesrefuse to build — the application does not boot. - Portable order columns.
uuidandenumdo not order identically across the three database families, so v3 orders by aportableOrderFieldyou declare instead. Auuidprimary key needs one for every request, because the pagination tie-break is always applied over the primary key.
Both are covered in detail in Endpoint whitelist rules.
Supported adapters
The adapter is not configured globally. It is decided by the source you pass
to execute(), and each source factory lives in its own subpath.
TypeORM
typeormSource(repository) from nestjs-rest-query/typeorm.
- TypeORM configured with at least one database, and entities declared with TypeORM decorators.
- Companion columns follow a convention here, over the entity property
path:
<field>_foldedand<field>_order. The resolver marks any property ending in_foldedor_orderas internal automatically. - The model name is derived, not chosen:
metadata.name.replace(/Entity$/, '').toLowerCase(). buildSchemaRegistry(repository)can derive the whole logical registry from entity metadata — but only where a liveRepositoryexists.
Drizzle
drizzleSource({ db, dialect, table, relations }) plus
drizzleDatabase({ client, dialect }), both from nestjs-rest-query/drizzle.
- Drizzle
1.0.0-rc.4or later within the range, on a supported driver. - The adapter does not read your
pgTable. You declare a logical descriptor withcreateDrizzleTable({ name, model, columns })and relations by dotted path. - The dialect is a required argument, because which execution method to call
(
all()vsexecute()) comes from the declared dialect, never from inspecting the object.
Prisma
prismaSource({ client, model, manifest }) from nestjs-rest-query/prisma.
- A generated Prisma Client, passed directly — no cast, no facade of your own.
- A hand-written manifest built with
createPrismaManifest, mapping each model to its client delegate and declaring theprovider. - On
sqliteandsqlserver, five operators (like,notLike,ilike,notIlike,search) are refused; see the Prisma adapter page.