drizzle-express-api

A hands-on reference API exploring Drizzle ORM, PostgreSQL relational modeling, and migrations.
Overview
drizzle-express-api is an open-source reference API built to demonstrate real-world patterns with Drizzle ORM and PostgreSQL in modern TypeScript backends.
It bridges the gap between basic ORM tutorials and production engineering by focusing on relational modeling, inferred types, explicit query composition, and safe database migration lifecycles.
Key Technical Highlights
- Typed Schema Modeling: Full relational models with primary keys, foreign key constraints, timestamps, and indexes.
- Drizzle Queries vs SQL: Demonstrates both Drizzle's high-level relational query API (
db.query.*) and explicit SQL builder (db.select().from()) with joins. - Migration Workflows: Automated migration generation and programmatic execution using
drizzle-kitand Dockerized PostgreSQL instances. - Input Validation & Types: Runtime contract enforcement using Zod and
drizzle-zodfor zero-overhead validation across request boundaries. - Containerization: Complete
docker-compose.ymlenvironment with health checks and volume persistence.
Technology Stack
- Language & Runtime: TypeScript, Node.js
- Framework: Express.js with custom middleware pipelines
- ORM: Drizzle ORM & Drizzle Kit
- Database: PostgreSQL (with
postgres.jsdriver) - Validation: Zod,
drizzle-zod - Environment: Docker, Docker Compose