Drizzle ORM
TypeScript ORM for SQL databases with type safety and zero-runtime overhead.
3. Used by agents' projects
Dependency in 253 public GitHub projects set up for AI coding agents that we scanned (4.0%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
orm.drizzle.team/llms.txtFrom the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What Drizzle ORM does
Drizzle puts two query styles in one zero-dependency TypeScript package: a builder that mirrors SQL, and a relational Queries API that the docs say always compiles to exactly one SQL query.
Drizzle ORM popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Drizzle ORM is used
- Drizzle ORM is a dependency in 253 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (5.2% of the 4,867 JavaScript/TypeScript ones), #2 of 120 in databases, orms and clients.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 831; those are left out of every share on this page.
- The most used alternative in our scan is Prisma (247 projects).
- Projects that use it most often also use Drizzle Kit (94.5%), Zod (75.5%), tsx (52.6%).
- It is more common in projects set up for OpenCode (7.9%) than for Gemini CLI (3.6%).
By coding agent
Often used with
Drizzle ORM in practice
Strengths
The docs argue that other ORMs force a "double learning curve" of SQL plus the framework's API. Drizzle's core builder is meant to map closely onto SQL, so joins and filters look like the SQL they produce.
For relational data there is a separate Queries API that returns nested results without hand-written joins. The docs say it "always outputs exactly 1 SQL query". They pitch this as a fit for serverless databases where round trips cost money.
The README lists Node.js, Bun, Deno, Cloudflare Workers, Supabase functions, edge runtimes and browsers. It names serverless databases such as Turso, Neon, PlanetScale and Cloudflare D1 as supported.
The maintainers call Drizzle "headless". It is a library plus opt-in tools, and it is meant to fit an existing project layout rather than impose one. It talks to databases through their standard drivers.
Watch out for
The latest release is 0.45.4. The site's changelog flags breaking changes in minor versions. For example, ORM v0.33.0 changed how <code>jsonb</code> is inserted with <code>postgres-js</code>.
The docs navigation includes an upgrade guide from v0 to v1. A separate section covers moving the relational queries API from v1 to v2. Expect code changes when you upgrade.
The "Migrations for teams" page has no content yet. It says it is waiting on a new migrations folder structure and points to a GitHub discussion.
Declare a schema, then query it two ways
// manage your schema
export const countries = pgTable ( 'countries' , {
id : serial () .primaryKey () ,
name : varchar ({ length : 256 }) ,
});
export const cities = pgTable ( 'cities' , {
id : serial () .primaryKey () ,
name : varchar ({ length : 256 }) ,
countryId : integer ( 'country_id' ) .references (() => countries .id) ,
});
// Access your data
await db
.select ()
.from (countries)
.leftJoin (cities , eq ( cities .countryId , countries .id))
.where ( eq ( countries .id , 10 ))
const result = await db . query . users .findMany ({
with : { posts : true } ,
});More about Drizzle ORM
Funding
- GitHub Sponsors: https://github.com/drizzle-team
- 68 GitHub sponsors
Head to head
- Prisma vs Drizzle ORM used together in 4 projects
Packages around it
- drizzle-kit: Drizzle migrations CLI
- zod: Schema validation
- tsx: TypeScript runner
- class-variance-authority: Component class variants
- clsx: Class name builder
- tailwind-merge: Tailwind class merging
More in Databases, ORMs and clients
Alternatives
Drizzle ORM This page
Modern ORM with intuitive schema, migrations, and type-safe database queries.
Get started
Install it.
npm install drizzle-ormRules for your agent
## Drizzle ORM
- Define and manage the database schema in TypeScript with the dialect's table helper, for example `pgTable` from `drizzle-orm/pg-core`.
- For flat reads, joins and filters, use the SQL-like builder (`db.select().from(...).leftJoin(...).where(...)`).
- For nested relational data, use `db.query.<table>.findMany({ with: { ... } })` instead of hand-built joins. The docs say it outputs exactly one SQL query.
- Run schema changes through Drizzle Kit, which either generates SQL migration files or applies changes directly to the database.
- For Expo SQLite, OP SQLite and React Native migrations, follow the Get Started guide. The dedicated web and mobile page is not written yet.
- Check the installed version first. The project is on 0.x, minor releases have shipped breaking changes, and the docs have separate v0 to v1 and Relational Queries v1 to v2 guides.
- For runtime validation, use the integrations listed under Validations in the docs (zod, valibot, typebox, arktype, effect-schema).