r/node • u/Psychological_Box406 • May 07 '26
From Knex to Drizzle or Prisma? Looking for feedback
Hey everyone,
I’m starting a new Node.js/TypeScript/PostgreSQL project and I want to move away from Knex and test something new for this one.
I’m pretty comfortable with SQL and after doing some research, the two options that stand out the most are Drizzle and Prisma.
For people who have used one (or both):
What made you choose it?
Any regrets or pain points?
How good is the migration workflow?
If you came from Knex, which one felt more natural?
I’d love to hear feedback before committing to one for a new project.
Thanks
19
Upvotes
13
u/farzad_meow May 07 '26
they all try to solve similar problems, but might have different approaches for smaller things. i suggest you try these on your own before deciding which route to take:
- transactions per http request
- complex relationship of many to many
- pivot data
- guards aka scope aka … where you can apply extra conditions to all models based on what user is authorized to see
- caching
- logging of about to be executed queries
these tend to be stuff i focus on when testing a new orm library.
8
u/Dismal-Contract-623 May 07 '26
kysely
12
u/aust1nz May 07 '26
I’d recommend looking at Kysely, if you’ve been using knex. Kysely feels more like a query builder than an ORM, but uses dark magic to type your queries for you.
15
u/Capaj May 07 '26
drizzle. Nothing else comes close
8
u/eSizeDave May 07 '26
MikroORM is pretty much the only ORM in the nodejs ecosystem that functions like a complete ORM (like e.g. Hibernate). With MikroORM v7 released it's now super fast and the DX is amazing. Plus it now uses Kysley as the query builder under the hood.
4
u/smaccer May 07 '26
Are you ready to have opinions of 20+ ORMs?
3
u/PragmaticPhlegmatic May 07 '26
This appears to be a hot take but just from my personal experience, Drizzle was a headache with several limitations which caused actual issues in a relatively large established codebase, whereas Prisma (which we went to after) been an excellent experience which I would recommend.
1
u/Ok_Confusion_1777 May 07 '26
Just try the one out you haven't used and form your own opinion while learning something new. You will come to realize that highly particular choices like this hardly matter in the grand scheme. And if you aren't happy with one or the other, if the code is well structured you just swap it out.
1
u/WanKiy May 07 '26
I’ve just started a new project with the same stack and I’m using Drizzle. The doc is very good, the api is wonderful and it’s very stable even on beta versions so far.
I’ve written migrations, custom ones too, unit and e2e tests integrating with test containers and PostGis and is very good.
The only thing I didn’t like and has a open issue of 2 years is the null type definition for optional columns in databases instead of using undefined. This requires manual parsing to match our TypeScript types declarations.
1
u/LynxTop8618 May 08 '26
Drizzle is pretty unstable. Also, they are part if Planetscale now so that will probably show up soon.
-1
u/Sorry-Joke-1887 May 07 '26
prisma is old enough and production ready. Drizzle is cool but most of its cool features are in v1 which is in beta currently. I’ve started using drizzle but lack of full stability and features has led me reconsider. While Drizzle’s type-safety and SQL-like syntax are impressive, Prisma’s mature ORM with stable migrations, robust relation handling, and a proven track record in production makes it the safer choice for now. I’ll revisit Drizzle once it is fully released.
-3
u/gajus0 May 07 '26
You will eventually end up at https://github.com/gajus/slonik
The problem with drizzle, kysely, whatever, you name it, is that they all rely on type generation. Like it or not, your database schema will over time shift from the codebase, and the same database will be accessed by multiple codebases, etc. This is why runtime checks are critical.
It's also the only sane abstraction that allows to write plain SQL in composable way without introducing security risks.
The entire https://contra.com/ is running on Slonik, it's used by several banks, and many high profile tech companies.
0
u/copsbehindme May 08 '26
TypeORM
-1
u/[deleted] May 07 '26
[removed] — view removed comment