drizzle-orm

Installation
SKILL.md

Drizzle ORM

Overview

Drizzle ORM is a lightweight, type-safe TypeScript ORM that maps directly to SQL for PostgreSQL, MySQL, and SQLite. It provides both a SQL-like query builder and a relational queries API, with zero dependencies and full serverless compatibility. Use Drizzle when you need compile-time type safety with SQL-level control; avoid it when you need a full active-record ORM with automatic migrations (use Prisma) or when working with MongoDB/NoSQL databases.

Quick Reference

Pattern API Key Points
Schema definition pgTable('name', { columns }, (t) => [indexes]) Third arg returns array of indexes/constraints
Column types text(), integer(), boolean(), timestamp() Import from drizzle-orm/pg-core
Type inference typeof table.$inferSelect, $inferInsert Derive TS types directly from schema
Relational queries db.query.table.findMany({ with, where }) Requires schema passed to drizzle() client
SQL-like queries db.select().from(table).where() Chainable, returns array of rows
Insert db.insert(table).values({}).returning() .returning() for getting inserted rows
Update db.update(table).set({}).where().returning() Always include .where() to avoid full-table updates
Delete db.delete(table).where() Always include .where() to avoid full-table deletes
Upsert .onConflictDoUpdate({ target, set }) Chain after .insert().values()
Related skills
Installs
66
GitHub Stars
11
First Seen
Feb 20, 2026