drizzle-team/drizzle-orm architecture diagram
How drizzle-team/drizzle-orm is built, drawn from its code at eab8bed on 2026-11-08 by Plotix's agent.
Packages
The monorepo packages, what each one does, and what depends on what.
Open the picture for full size (SVG).
Parts
- Application developer
- App schema
pgTable / mysqlTable / sqliteTable · relations() definitions - drizzle-orm
Query builders and relational API · Dialects for PG, MySQL, SQLite · Drivers and sessions - drizzle-kit
generate: diff schema to SQL · migrate, push, pull, studio - drizzle-seed
Fills tables with generated data - Validator adapters
drizzle-zod · drizzle-typebox · drizzle-valibot · drizzle-arktype - eslint-plugin-drizzle
- Integration tests
Run against real databases - Database drivers
- Databases
PostgreSQL · MySQL · SQLite - Migration files
SQL files · snapshot JSON
How they connect
- Application developer → App schema
- Application developer → drizzle-orm queries
- Application developer → drizzle-kit generate / migrate / push
- App schema → drizzle-orm
- drizzle-seed → drizzle-orm
- Validator adapters → drizzle-orm
- Integration tests → drizzle-orm
- drizzle-kit → App schema
- drizzle-kit → Migration files
- drizzle-kit → Databases push / migrate
- drizzle-orm → Database drivers SQL + params
- Database drivers → Databases wire protocol
Query flow
How one query travels from app code through the ORM, dialect, session and driver to the database and back.
Open the picture for full size (SVG).
Parts
- App code
- Query builder
- SQL dialect
- Session
- Database driver
- Database
How they connect
- App code → Query builder select().from(users)
- Query builder → SQL dialect build SQL
- SQL dialect → Session prepare(sql, params)
- Session → Database driver execute
- Database driver → Database send query
- Database → Database driver rows
- Database driver → Session rows
- Session → Query builder mapResult()
- Query builder → App code typed rows
Migrations pipeline
How drizzle-kit turns TypeScript schema into snapshots, diffs and SQL migration files.
Open the picture for full size (SVG).
Parts
- TypeScript schema
- Serialize to snapshot
- Previous snapshot
- Diff snapshots
- Generate SQL
- Migration files
- Database
How they connect
- TypeScript schema → Serialize to snapshot
- Serialize to snapshot → Diff snapshots
- Previous snapshot → Diff snapshots
- Diff snapshots → Generate SQL
- Generate SQL → Migration files
- Migration files → Database
Core classes
The main ORM classes behind a query and how they relate.
Open the picture for full size (SVG).
Parts
- Table
- Column
- SQL
- PgDatabase
- PgDialect
- PgSession
- NodePgSession
- PreparedQuery
- NodePgPreparedQuery
How they connect
- Table → Column
- SQL → Column
- PgDatabase → PgDialect
- PgDatabase → PgSession
- NodePgSession → PgSession
- NodePgPreparedQuery → PreparedQuery
- PgSession → PreparedQuery
Draw your own repo
Plotix's agent reads your code and draws its architecture, and the diagram warns you when the code moves on.
Try Plotix