Drizzle ORM

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

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

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
73/100Good
Development Activity64
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 115 apps in this directory

TypeScript
100%
Apache 2.0

agentic-inbox

AI Agents · Productivity

7,214

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
31
Repo Health
74
Technical
77
Dependency
Built with
TypeScript100%
Updated 4 months ago
TypeScript
88%
MIT

Amical

Note Taking · AI Assistants

1,522

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

View details
81
Repo Health
82
Technical
67
Dependency
Built with
TypeScript88%
Updated 2 days ago
TypeScript
88%
MIT

Amical

Note Taking · AI Assistants

1,522

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

View details
81
Repo Health
82
Technical
67
Dependency
Built with
TypeScript88%
Updated 2 days ago
TypeScript
53%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,252

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
68
Dependency
Built with
TypeScript53%
Rust35%
Updated today
TypeScript
53%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,252

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
68
Dependency
Built with
TypeScript53%
Rust35%
Updated today
TypeScript
46%
AGPL 3.0

BrowserOS

Browser · AI Assistants

13,577

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
68
Dependency
Built with
TypeScript46%
Rust22%
Python18%
Updated yesterday
TypeScript
46%
AGPL 3.0

BrowserOS

Browser · AI Assistants

13,577

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
68
Dependency
Built with
TypeScript46%
Rust22%
Python18%
Updated yesterday
TypeScript
99%
Apache 2.0

Bubble Lab

Automation · AI Development

1,094

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

View details
36
Repo Health
78
Technical
71
Dependency
Built with
TypeScript99%
Updated 4 months ago
TypeScript
99%
Apache 2.0

Bubble Lab

Automation · AI Development

1,094

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

View details
36
Repo Health
78
Technical
71
Dependency
Built with
TypeScript99%
Updated 4 months ago

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