⚙️ Engineering 📊 Data Awaiting Security Review

Drizzle ORM

Build type-safe database queries with Drizzle ORM. Generates schema definitions, relational queries, migrations, and SQL-like query builders for PostgreSQL, MySQL, and SQLite with zero overhead.

This skill helps you work with Drizzle ORM, the lightweight TypeScript ORM that stays close to SQL. It generates schema definitions with relations, writes type-safe queries using the SQL-like query builder, creates push/migration workflows, and implements patterns like soft deletes and audit logging.

drizzle orm database typescript sql

When to use

Use when you want a lightweight ORM that feels like SQL, building serverless apps where bundle size matters, migrating from Prisma for better query control, or working with edge runtimes.

Examples

Schema with relations

Define a relational database schema

Create a Drizzle schema for a blog with users, posts, comments, and tags — with proper relations and indexes for PostgreSQL

Complex query builder

Write advanced queries with joins and aggregations

Write a Drizzle query that joins users with their order history, calculates total spend, and filters for users who spent over $100 this month