Drizzle ORM

A lightweight, zero-dependency TypeScript ORM with full SQL-like query flexibility

Library
npm
v0.45.2
35,512stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
74/100Good
Development Activity68
Maintenance68
Community64
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture90
Code Quality82
Innovation85
Learning Curve68

Drizzle ORM is a TypeScript-first ORM and SQL query builder built around the idea that you should never have to leave SQL-like syntax to get type safety. It ships as a headless, ~7.4kb library with zero runtime dependencies, and supports PostgreSQL, MySQL, SQLite, and SingleStore across every major JavaScript runtime, including Node.js, Bun, Deno, Cloudflare Workers, and edge functions.

Rather than hiding the database behind a heavyweight abstraction, Drizzle lets you declare schemas in TypeScript and then either write relational queries (similar to an ORM) or SQL-like queries (similar to a query builder), both fully typed end to end. Its companion CLI, Drizzle Kit, handles migrations, and Drizzle Studio provides a GUI for browsing and editing data, giving teams a complete, serverless-ready toolkit without generated clients or Rust binaries.

What You Get

  • A ~7.4kb, zero-runtime-dependency core library that stays tree-shakeable and works in serverless/edge runtimes
  • Type-safe schema declarations that double as the source of truth for both migrations and query type inference
  • Two query APIs in one library: a chained SQL-style builder and a relational-query API (db.query.table.findMany())
  • Drizzle Kit, a companion CLI for generating and applying SQL migrations from your TypeScript schema
  • Drizzle Studio, a GUI for browsing and editing data across any supported database
  • First-class drivers for PostgreSQL, MySQL, SQLite, and SingleStore, plus serverless-specific adapters for Neon, Turso, PlanetScale, Cloudflare D1, and Vercel Postgres

Common Use Cases

  • Adding a typed data layer to a Next.js, Remix, or SvelteKit app without a code-generation build step
  • Running database access from edge/serverless functions (Cloudflare Workers, Vercel Edge) where lightweight, dependency-free clients matter
  • Migrating off a heavier ORM (Prisma, TypeORM) when teams want SQL-like control with full TypeScript inference
  • Building internal tools or admin panels quickly using Drizzle Studio alongside the schema already defined for the app

Under The Hood

Architecturedrizzle-orm/src/index.ts re-exports the dialect-agnostic core: column/table builders (column-builder.ts, column.ts, table.ts), the branded-type system (entity.ts), and the SQL AST builder (sql/sql.ts, 722 lines). Each dialect (pg-core/, mysql-core/, sqlite-core/, singlestore-core/, gel-core/) implements its own column types and query builders on top of that shared AST — for example pg-core/query-builders/select.ts (1,346 lines) builds a Query object that is rendered through a BuildQueryConfig interface (escapeName/escapeParam/escapeString), which is how one query-builder API targets many SQL dialects. Driver adapters (node-postgres/, postgres-js/, neon-http/, libsql/, better-sqlite3/, bun-sqlite/, d1/, planetscale-serverless/, mysql2/, and more) each wrap one database client and adapt it to a common Session/QueryPromise interface (session.ts, query-promise.ts). Because the library is split across dozens of separately-published driver packages, instanceof checks are unreliable across module boundaries, so the codebase uses a symbol-based entityKind brand and an is() helper (entity.ts) pervasively instead.

Tech Stack — Pure TypeScript, published as dual ESM/CJS via a custom scripts/build.ts. The core drizzle-orm package declares zero runtime dependencies in package.json — all 29 database drivers and clients (pg, mysql2, better-sqlite3, @neondatabase/serverless, @libsql/client, and others) are optional peerDependencies, so consumers only install what they actually use. The repository is a pnpm + Turborepo monorepo (pnpm-workspace.yaml, turbo.json) housing sibling packages drizzle-kit (migrations CLI), drizzle-zod/drizzle-valibot/drizzle-arktype/drizzle-typebox (schema-validation bridges), and drizzle-seed. It targets every major JavaScript runtime — Node.js, Bun, Deno, Cloudflare Workers/D1, Vercel Edge, and React Native via op-sqlite/expo-sqlite adapters.

Code Quality — There are no unit test files co-located in drizzle-orm/src/, but the root-level integration-tests/ workspace contains 68 test files (run via Vitest against real database connections per dialect) plus a separate type-tests/ directory that performs compile-time type assertions to catch inferred query-type regressions — a pattern suited to a library whose main product is precise type inference. Error handling is centralized through a DrizzleError/DrizzleQueryError hierarchy (errors.ts) that preserves the original driver error on .cause. Naming and file layout are strikingly consistent across dialect implementations — pg-core/, mysql-core/, and sqlite-core/ mirror each other’s structure almost exactly, which keeps the cost of adding a new dialect low and the codebase easy to navigate once one dialect is understood.

API Design — A single call, drizzle(client, { schema }), returns a fully-typed db object usable immediately for both SQL-style chained queries (db.select().from(table).where(...)) and relational-style queries (db.query.table.findMany()), with no separate code-generation step — the TypeScript schema declaration is itself the source of type inference. A minimal schema.ts using pgTable(...)/sqliteTable(...) is enough to get full autocomplete on selects, inserts, joins, and relations. The trade-off is setup complexity: the 29-entry peerDependencies list means a new user has to correctly match a driver package to their database and runtime before anything works, and the per-driver README files scattered through src/ (postgres-js/README.md, kysely/README.md, etc.) reflect how much dialect/driver-specific knowledge the API surface still requires.

Used by 55 apps in this directory

TypeScript
100%
Apache 2.0

agentic-inbox

AI Agents · Productivity

6,880

A self-hosted email client with an AI agent that reads your inbox, drafts replies automatically, and exposes full email operations over MCP — running entirely on Cloudflare Workers.

View details
32
Repo Health
74
Technical
77
Dependency
Built with
TypeScript100%
Updated 3 months ago
TypeScript
84%
MIT

Amical

Note Taking · AI Assistants

1,495

Local-first AI dictation that understands your active app — private, offline, and built for speed.

View details
79
Repo Health
82
Technical
67
Dependency
Built with
TypeScript84%
Updated 3 weeks ago
TypeScript
51%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,087

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
69
Dependency
Built with
TypeScript51%
Rust38%
Updated today
TypeScript
49%
AGPL 3.0

BrowserOS

Browser · AI Assistants

13,248

The open-source agentic Chromium browser with native AI agents, MCP server, and visual workflow automation — your data never leaves your machine.

View details
87
Repo Health
82
Technical
69
Dependency
Built with
TypeScript49%
Rust22%
Python16%
Updated today
TypeScript
99%
Apache 2.0

Bubble Lab

Automation · AI Development

1,095

Open-core workflow engine for building AI-powered automations in TypeScript that run natively inside Slack — no context switching required.

View details
35
Repo Health
78
Technical
72
Dependency
Built with
TypeScript99%
Updated 3 months ago
Rust
67%
MIT

Bun

Developer Tools

95,452

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
66
Dependency
Built with
Rust67%
C++19%
Updated today
TypeScript
55%
Other

Cap

Team Chat · Video Conferencing

20,986

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
TypeScript55%
Rust40%
Updated yesterday
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

50,753

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
88
Repo Health
84
Technical
71
Dependency
Built with
TypeScript99%
Updated today
Swift
64%
GPL 3.0

cmux

Developer Tools · AI Development

26,221

A native, Ghostty-based macOS terminal with vertical tabs, agent-aware notifications, and a scriptable browser built for running many parallel AI coding agent sessions instead of juggling tmux panes.

View details
84
Repo Health
81
Technical
72
Dependency
Built with
Swift64%
Rust14%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search