ADR 002: Why Drizzle ORM over Prisma
Status: ✅ Accepted
Date: 2026-05-04
Context
We need an ORM for PostgreSQL that works well with Bun and Cloudflare Workers.
Decision
✅ Chosen: Drizzle ORM
Rationale
1. Cloudflare Workers Compatibility
Prisma relies on a binary query engine that cannot run in Cloudflare Workers (edge runtime). Drizzle is pure JavaScript/TypeScript and runs anywhere.
2. Bun Compatibility
Drizzle works natively with Bun. Prisma has historically had friction with non-Node runtimes.
3. Performance
Drizzle is closer to raw SQL with type safety — it generates efficient queries without the N+1 problems Prisma can introduce with include chains.
4. Type Safety
Both provide TypeScript types, but Drizzle's types are derived from the schema definition itself — no separate type generation step required.
// Drizzle: Schema IS the type source
const result = await db.select().from(projects).where(eq(projects.id, id))
// result is typed as: { id: string; name: string; ... }[]5. Bundle Size
Drizzle is significantly lighter than Prisma — important for edge deployments with bundle size limits.
Trade-offs
| Drizzle | Prisma | |
|---|---|---|
| Cloudflare Workers | ✅ | ❌ |
| Bun support | ✅ | ⚠️ |
| SQL-like syntax | ✅ Explicit | ❌ Abstracted |
| Learning curve | Medium | Lower |
| Ecosystem maturity | Growing | Mature |
| Studio/GUI | ✅ drizzle-kit studio | ✅ Prisma Studio |
Conclusion
Drizzle is the only viable option given our Cloudflare Workers deployment target. No further evaluation needed.