API Reference

Drizzle ORM

Lightweight, performant TypeScript SQL ORM with zero dependencies, edge-compatible, and SQL-like query builder.

Official Documentation ↗
CompatibilityThis documentation covers version v0.31. Check the official docs for the latest API surface.

Installation

npmnpm install drizzle-orm pg
pnpmpnpm add drizzle-orm pg

Methods

Drizzle ORM is a lightweight TypeScript SQL ORM with zero runtime dependencies. It provides a SQL-like query builder with full type safety, edge compatibility, and excellent performance. It is ideal for serverless and edge deployments where bundle size matters.

Key Features

  • Zero dependencies: No runtime deps, tiny bundle size
  • Edge-compatible: Works on Cloudflare Workers, Vercel Edge, Deno, Bun
  • SQL-like syntax: Familiar SQL patterns with TypeScript type inference
  • Multi-dialect: PostgreSQL, MySQL, SQLite, and D1 (Cloudflare)
  • Migrations: drizzle-kit for schema-to-SQL migration generation
  • Raw SQL escape hatch: Full SQL access when needed via sql template tag

Errors

The following points are quoted verbatim from the official documentation. 来源:https://orm.drizzle.team/docs · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:49:19.380Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

FAQ

How does Drizzle compare to Prisma?
Drizzle uses SQL-like syntax with no code generation step, resulting in smaller bundles and edge compatibility. Prisma generates a client from a declarative schema, providing better DX but larger bundles. Drizzle is better for edge/serverless; Prisma for traditional servers.
Is Drizzle compatible with Cloudflare Workers?
Yes. Drizzle is edge-compatible with zero dependencies and small bundle size. It works with Cloudflare D1, Neon, Supabase, and PlanetScale via their HTTP drivers. No WebSocket or TCP connection needed.
How do migrations work in Drizzle?
Use drizzle-kit to generate SQL migrations from schema changes: npx drizzle-kit generate. Apply with drizzle-kit migrate or your existing migration tool. Drizzle also supports push for development.