AI summary by TwinMind
I Have A New Favorite Database Tool
Theo - t3․gg
5m 46s
Prisma vs Drizzle Background
- Speaker has "trying relationship" with Prisma
- Prisma pros: best developer experience for TypeScript devs with databases
- Prisma cons: expensive performance, TypeScript/node module generation issues, breaks in monorepos
- Alternatives explored: Kysely (past), Drizzle (current focus at Ping)
Drizzle Overview & Philosophy
- Alternative ORM focused on simple, minimal abstractions over SQL databases
- Syntax resembles writing SQL
- Benefits: easier integration, changeable connection layer
- Can bypass native database connections → use PlanetScale HTTP endpoint → run on edge
- Previous issues: lack of docs, complex query syntax for relations
Drizzle ORM 0.26 Release Highlights
- Current GitHub stars: 5K (speaker wants audience to double to 10K)
- Two major improvements address previous pain points
Relational Queries Feature
- New syntax:
db.query.users.findMany()with attached relations - Similar to Prisma's approach
- Returns user objects with posts attached
- Supports both new relational syntax and old model
- Custom relations possible with relations helper (not limited to foreign keys)
- Performance advantage: Always generates exactly one SQL query vs Prisma's unknown back-and-forth queries
Documentation Launch
- Docs were #1 requested feature since day one
- New marketing site with real tweets/comments as testimonials
- Installation guide with integration buttons for different platforms
- Links to MySQL course from PlanetScale
Schema Management & TypeScript Integration
- Schema entirely written in TypeScript
- Tables defined as values using table helper function
- Drizzle CLI reads TypeScript files → updates database accordingly
- No separate schema files outside TypeScript
- Dual purpose: defines database schema + provides type inference
- No weird compiler steps required
- Model inference available for type access in other places
- Correct type inference from functions without explicit return types
Current Usage & Future Outlook
- Speaker's team using Drizzle extensively at Ping
- Will continue using Drizzle for foreseeable future projects
- Praise for: development speed, team quality, community involvement
- Prisma "not dead" but Drizzle provides "real reason to reconsider"
