🗄️
Database500K+/wkApache-2.0

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
npm install drizzle-orm
yarn
yarn add drizzle-orm
pnpm
pnpm add drizzle-orm

Import

ESM
import { drizzle } from 'drizzle-orm/node-postgres';

Quick Example

usage
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

Packagedrizzle-orm
CategoryDatabase
Weekly Downloads500K+
LicenseApache-2.0
Installnpm install drizzle-orm

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.