What's the go-to sql ORM for Next.js nowadays?
Unanswered
Peterbald posted this in #help-forum
PeterbaldOP
I know this isn't a Next.js question, but I am just curious about what the current community has to say about which ORM to use with Next.js route. handlers. In other languages I usually do my own migrations and use a SQL query builder and/or type validator (e.g. sqlx in Rust) but TypeScript doesn't offer the same kind of type validation as the compiled languages so I would like to use an ORM instead. I am currently using Postgresql (if that helps). I've heard of Prisma, Drizzle, and TypeORM. Used Prisma 2 years ago and didn't like it that much as they generated a lot of excess queries to do one operation. Seems that they had 2 major version upgrades though, maybe they're better now?
My priorities:
optimization (cannot send 3 queries for something I can replace with a CTE) > good documentation > development speed > learning curve
My priorities:
optimization (cannot send 3 queries for something I can replace with a CTE) > good documentation > development speed > learning curve
5 Replies
Drizzle is my favorite
Its very thin, but totally type-safe
Champagne D’Argent
if you're looking to use mysql, don't use drizzle https://github.com/drizzle-team/drizzle-orm/issues/2134 . since you're using postgres, it's probably functional, but I'd say that given its current broken support for mysql, it reflects poorly on the state of the project as a whole. I don't care much for prisma myself but that one at least worked as described. knex and bookshelf, which are kind of old are ok too.
@linesofcode Its very thin, but totally type-safe
PeterbaldOP
i see, i'll give drizzle a try!
Chum salmon
Only been using Prisma so far and I love it.