Drizzle ORM is a TypeScript ORM that lets you write type-safe database queries that look like SQL. No magic — just SQL with types.
What You Get for Free
- SQL-like syntax — if you know SQL, you know Drizzle
- Full type safety — every query is fully typed
- Zero dependencies — lightweight
- Drizzle Kit — migrations and schema management
- All major databases — PostgreSQL, MySQL, SQLite
- Serverless-ready — works with Neon, Turso, PlanetScale
- Drizzle Studio — visual database browser
Define Schema
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
export const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
email: text('email').unique(),
createdAt: timestamp('created_at').defaultNow(),
});
Query
import { db } from './db';
import { users } from './schema';
import { eq } from 'drizzle-orm';
const allUsers = await db.select().from(users);
const user = await db.select().from(users).where(eq(users.id, 1));
await db.insert(users).values({ name: 'Alice', email: 'alice@example.com' });
Drizzle vs Prisma
| Feature | Drizzle | Prisma |
|---|---|---|
| Syntax | SQL-like | Custom DSL |
| Bundle | Tiny | Large |
| Serverless | Native | Needs engine |
| Migrations | SQL files | Prisma migrate |
Need database ORM setup? Check my work on GitHub or email spinov001@gmail.com for consulting.
Top comments (0)