Installation
Install nestjs-drizzle-crud and the required peer dependencies for your database.
Package
npm i nestjs-drizzle-crudLatest version: 3.1.0. The package is published under
nestjs-drizzle-crud on npm.
A CHANGELOG.md is shipped in the npm tarball
and mirrored at Changelog.
Peer dependencies
The package is unopinionated about which database driver you use. Install only what you need.
Always required
npm i @nestjs/common @nestjs/core drizzle-orm reflect-metadataPostgreSQL — required only if you use connectionString
When you pass connectionString to forRoot({ dialect: 'postgresql' }), the module builds the Drizzle connection itself using the postgres driver.
npm i postgrespnpm enforces peer dependencies strictly. If you let the module build the
connection from a connectionString, make sure postgres is installed in
your app, otherwise the build will fail with a missing-peer error.
MySQL — required (always, for MySQL)
MySQL has no RETURNING support, so the package can't build a connection for you from a connection string. You must install mysql2 and pass a pre-built db to forRoot. See Configure once — forRoot for the full pattern.
npm i mysql2If you pre-build the Drizzle instance (any dialect)
If you build the Drizzle instance yourself and pass it to forRoot as db, you can skip the module's internal driver setup entirely — which means you don't need postgres even on PostgreSQL.
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
DrizzleCrudModule.forRoot({
dialect: 'postgresql',
db: drizzle(postgres(process.env.DATABASE_URL!), { schema }),
});This is also the recommended pattern for MySQL.
TypeScript configuration
The package relies on Reflect.getMetadata to read per-service configuration. Make sure your tsconfig.json enables decorators:
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}Versioning policy
nestjs-drizzle-crud follows semver:
- Patch (3.0.x → 3.0.y) — bug fixes, no API changes.
- Minor (3.x.0 → 3.y.0) — new methods or new options, fully backwards-compatible.
- Major (3.y.0 → 4.0.0) — breaking changes to the public API.
This site currently documents v3.1.0. The peer dependency drizzle-orm is pinned to >=0.28.0 <1.0.0.
See the Changelog for release-by-release behavior changes.
Next
You have the package installed. The next page walks through a complete 5-step setup — schema → forRoot → service → forFeature → controller — in under five minutes.