June 2, 2026
2 min read
Drizzle overtook Prisma in npm downloads in early 2026. How to define a schema, wire it into NestJS as a provider, and migrate off TypeORM service by service.
TypeORM has been the default ORM for NestJS since the beginning, but Drizzle has overtaken it in new projects — it passed Prisma in weekly npm downloads in early 2026. Drizzle is a SQL-first query builder with full TypeScript inference and no decorators or metadata reflection.
reflect-metadataimport { pgTable, uuid, varchar, text, boolean, timestamp } from 'drizzle-orm/pg-core';
export const posts = pgTable('posts', {
id: uuid('id').defaultRandom().primaryKey(),
title: varchar('title').notNull(),
slug: varchar('slug').notNull().unique(),
content: text('content').notNull(),
published: boolean('published').default(false).notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
Expose the Drizzle instance as an injectable provider:
import { drizzle } from 'drizzle-orm/node-postgres';
import { Pool } from 'pg';
export const DrizzleProvider = {
provide: 'DB',
useFactory: () => {
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
return drizzle(pool, { schema });
},
};
@Injectable()
export class BlogService {
constructor(@Inject('DB') private db: NodePgDatabase<typeof schema>) {}
findPublished() {
return this.db.query.posts.findMany({
where: eq(posts.published, true),
orderBy: desc(posts.createdAt),
});
}
}
There is no automatic converter. The practical path:
1. Recreate entities as Drizzle schema files
2. Run drizzle-kit introspect against the existing database and diff it against your hand-written schema
3. Replace repository calls service by service — both ORMs can share the same connection pool during the transition
Drizzle trades TypeORM's Active Record convenience for explicit SQL and stronger inference. For a new NestJS service, or one where the query layer has become hard to reason about, it is the current default.