drizzle-orm
Drizzle ORM is a TypeScript ORM that provides a SQL-like query builder with full type safety, zero overhead, and a philosophy of staying as close to SQL as poss…
Installation
npm install drizzle-orm
yarn add drizzle-orm
pnpm add drizzle-orm
Import
import { drizzle } from 'drizzle-orm/node-postgres';Quick Example
import { pgTable, serial, text } from 'drizzle-orm/pg-core';
import { drizzle } from 'drizzle-orm/node-postgres';
import { eq } from 'drizzle-orm';
const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
});
const db = drizzle(pool);
const result = await db.select().from(users).where(eq(users.name, 'Alice'));About drizzle-orm
Drizzle ORM is a TypeScript ORM that provides a SQL-like query builder with full type safety, zero overhead, and a philosophy of staying as close to SQL as possible while providing excellent TypeScript DX. Unlike Prisma's schema-first approach, Drizzle uses TypeScript table definitions as the source of truth, generating types directly from your schema code without code generation steps. The query builder's syntax mirrors SQL closely — select().from(users).where(eq(users.name, 'Alice')).leftJoin(posts, eq(posts.userId, users.id)) — making it intuitive for developers who know SQL. Drizzle supports PostgreSQL, MySQL, SQLite, and Turso with dialect-specific APIs that expose database-specific features rather than hiding them behind an abstraction. The Relational Query API provides a higher-level interface for nested data fetching similar to Prisma's include. Drizzle Kit handles schema migrations, introspection from existing databases, and studio-like database browsing. The ORM has zero runtime dependencies for the core package and produces minimal overhead compared to raw SQL. Drizzle's serverless-first design makes it particularly well-suited for edge and serverless environments where cold start time and bundle size matter.
Quick Facts
| Package | drizzle-orm |
| Category | Database |
| Weekly Downloads | 500K+ |
| License | Apache-2.0 |
| Install | npm install drizzle-orm |
Related Packages
Prisma is a next-generation Node.js and TypeScript ORM that provides a declarative data modeling lan…
Kysely is a type-safe TypeScript SQL query builder that provides autocompletion, type checking, and …
Knex.js is a batteries-included SQL query builder for Node.js that supports PostgreSQL, MySQL, Maria…
pg (node-postgres) is the standard PostgreSQL client for Node.js, providing low-level access to Post…
TypeORM is a full-featured ORM for TypeScript and JavaScript that supports both Active Record and Da…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.