
Stop Using ORMs. Here's What I Use Instead (After 3 Years and 100M+ Rows)
I've been building a SaaS product for three years. The database has over 100 million rows across hash-partitioned PostgreSQL tables. And I don't use an ORM. Every few months someone on Twitter declares ORMs dead. Then someone else defends them. The takes are always abstract. Here's mine, from actually living with the alternative. Why I skipped the ORM When I started building my app, I evaluated Prisma seriously. Typed queries, clean migrations, great DX. But I was building something that would need hash partitioning, complex analytical queries, and tight control over the SQL being generated. Prisma's schema language doesn't support partitioning at all, and I knew I'd be reaching for raw SQL constantly. Prisma's $queryRaw loses all type safety (yes, Prisma has TypedSQL in preview now, but it didn't exist when I started, and it still requires a generation step for each query). So I went with Kysely from day one. It's a TypeScript query builder, not an ORM. It doesn't pretend to abstract
Continue reading on Dev.to Webdev
Opens in a new tab

