Skip to main content

What is Drizzle ORM?

Drizzle ORM is a lightweight, headless TypeScript ORM designed for developers who want the full power of SQL with complete type safety. At only ~7.4kb minified+gzipped with zero dependencies, Drizzle is optimized for modern JavaScript runtimes and serverless environments.
Drizzle is not just another ORM - it’s a thin, typed layer on top of SQL that preserves SQL’s expressiveness while adding TypeScript’s type safety.

Core philosophy

Drizzle is built on three fundamental principles:

SQL-like

Write queries that look and feel like SQL, not an abstraction layer

Type-safe

Full TypeScript inference with compile-time validation

Lightweight

Zero dependencies, tree-shakeable, optimized bundle size

Why choose Drizzle?

Serverless-ready by design

Drizzle works seamlessly in every major JavaScript runtime:
  • Node.js
  • Bun
  • Deno
  • Cloudflare Workers
  • Supabase Edge Functions
  • Vercel Edge Runtime
  • AWS Lambda
  • Browser environments
No special adapters, no Rust binaries, no data proxies - just pure JavaScript that works everywhere.

Universal database support

Drizzle supports all major SQL databases with native drivers:
  • PostgreSQL (pg, postgres.js, node-postgres)
  • Neon Serverless
  • Vercel Postgres
  • Supabase
  • AWS Data API
  • PGlite
  • Electric SQL

Performance first

Drizzle is designed for speed:
  • Minimal overhead: Direct SQL execution with minimal abstraction
  • Prepared statements: Reusable queries for optimal performance
  • Query batching: Execute multiple queries efficiently
  • Tree-shakeable: Only bundle what you use
Check out our benchmarks to see how Drizzle compares to other ORMs.

Type safety in action

Drizzle provides end-to-end type safety from schema definition to query results:
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
import { drizzle } from 'drizzle-orm/node-postgres';
import { eq } from 'drizzle-orm';

// Define schema with full type inference
const users = pgTable('users', {
  id: serial('id').primaryKey(),
  email: text('email').notNull().unique(),
  name: text('name').notNull(),
  createdAt: timestamp('created_at').defaultNow(),
});

const db = drizzle(process.env.DATABASE_URL!);

// Type-safe queries with autocomplete
const result = await db.select().from(users).where(eq(users.id, 1));
//    ^? { id: number; email: string; name: string; createdAt: Date | null }[]
Your IDE will provide:
  • Autocomplete for all columns and methods
  • Type errors for invalid queries at compile time
  • IntelliSense for available operations
  • Refactoring support when schema changes

Key features

SQL schema declaration

Define your database schema in TypeScript with a declarative, type-safe API:
import { pgTable, serial, text, integer, timestamp, index } from 'drizzle-orm/pg-core';

export const posts = pgTable('posts', {
  id: serial('id').primaryKey(),
  title: text('title').notNull(),
  content: text('content').notNull(),
  authorId: integer('author_id').notNull().references(() => users.id),
  publishedAt: timestamp('published_at'),
  createdAt: timestamp('created_at').defaultNow().notNull(),
}, (table) => [
  index('author_idx').on(table.authorId),
]);

Relational and SQL-like queries

Write queries in two styles based on your preference:
// Fetch users with their posts in one query
const usersWithPosts = await db.query.users.findMany({
  with: {
    posts: true,
  },
});

Automatic migrations

Drizzle Kit generates SQL migrations automatically from your schema changes:
# Generate migration from schema changes
npx drizzle-kit generate

# Apply migrations to database
npx drizzle-kit migrate

# Push schema changes directly (development)
npx drizzle-kit push

Ecosystem

Drizzle comes with powerful companion tools:

Drizzle Kit

CLI for migrations, schema introspection, and database management

Drizzle Studio

Visual database browser to explore and edit data

Drizzle Seed

Generate realistic test data for development

Schema Validation

Integrate with Zod, Valibot, TypeBox, and ArkType

Real-world usage

Drizzle is trusted by thousands of developers and companies building production applications:
  • Serverless applications on Cloudflare Workers, Vercel Edge, AWS Lambda
  • Full-stack applications with Next.js, Remix, SvelteKit, Astro
  • Mobile apps with React Native and Expo
  • Desktop apps with Electron and Tauri
  • CLI tools and scripts

Next steps

Installation

Install Drizzle ORM and set up your project

Quickstart

Build your first Drizzle application in minutes

Schema Declaration

Learn how to define your database schema

Queries

Write type-safe queries with Drizzle
New to SQL? Drizzle’s type-safe API makes SQL approachable while teaching you proper database concepts. You’ll learn SQL naturally as you use Drizzle.

Build docs developers (and LLMs) love