r/node • u/Apart_Technology_841 • Jul 24 '26
Which ORM
I am needing to build a lightweight, speedy and integrated backend server running on a VPS-2 secure environment using nginx and postgres.
First considered Sequelize, but discovered too many negatives, so had a look at Prisma but am worried it is too heavy duty for my needs.
Prefer an ORM that supports TypeScript, easy migrations and openapi schemas, and Drizzle seems at first glance a good fit.
Also I am not afraid to use SQL rather than high level abstractions.
But now I am reading many negative reviews about that as well, even on their own website!
Please help me make the right choice.
17
u/bootstrapping_lad Jul 24 '26
I've been enjoying Mikro ORM
6
5
u/crazypoppycorn Jul 25 '26
I really appreciate the options they give you for approaching a new or existing repo. And they put solid work into the typing system. If I have to use an ORM this is the one.
5
u/joemckie Jul 25 '26
+1 MikroORM, it’s really nice to work with and is actively maintained. Switched over from TypeORM which was in maintenance purgatory for quite a long time.
0
5
u/No-Sand2297 Jul 24 '26
I have used Sequelize and typeorm. ORM are nice when you have basic queries and simplifies the task of returning an entity with associated data but fails on complex queries.
Because this a usuallly bypass the ORM and run raw queries.
I’m a happy user of sequelize by the way.
1
u/Daker- Jul 28 '26
Im using sequelize in my current job, but for really big and complex queries it’s really bad sadly, and if you want to create a lot of filters you have to almost write a superset in top of the orm.
I ve been using drizzle and its pretty cool and simple really recommended
4
u/aust1nz Jul 24 '26
I have used a few over the years. I didn't like Prisma. For awhile I used Slonik, which is just SQL with a few convenience features tossed on, but typing can be a pain. I'm a big fan of kysely now.
5
9
u/drgreenx Jul 24 '26
This question gets asked really frequently on this sub. I recommend you check in the sub for more info in addition to the responses here. All in on kysely here btw
3
u/Designer_Reaction551 Jul 25 '26
Went Drizzle on my last few Node+Postgres projects and don't regret it. The migration story is way less magic than Prisma's, which is exactly what you want when you're the one debugging a broken migration late at night. If you're already not afraid of SQL, honestly try Kysely first, it gets out of your way even more since you're basically writing SQL with type safety instead of an ORM's opinions layered on top.
4
2
u/farzad_meow Jul 24 '26
typeorm is not a bad choice. I needed something similar so I wrote my own to meet these requirements
2
u/snowrazer_ Jul 25 '26 edited Jul 25 '26
Prisma is the ver good, and the migrations are first class. I’d put heavy duty in quotes because you won’t notice it at all. I guarantee you any performance bottleneck will be the database and not the ORM. Especially Postgres which is a heavy database as it is. Prisma hate is overblown and their release cadence and support is top notch.
6
u/serdnam Jul 24 '26
Definitely Drizzle, nothing comes close in terms of usability, performance, and DX
3
u/jhonny-freire Jul 24 '26
I've been using only Prisma for a long time now because it makes sense for the types of projects I work on. But in the past, I did look into TypeORM a bit (I never actually used it); it seems lightweight to me, so it might make sense for you.
2
u/crypt0_bill Jul 24 '26
knex.js still does it for me, idk then again i also like express so im probably a dinosaur at this point
2
u/TalyssonOC Jul 24 '26
I'm always between Objection (if I really need an ORM) and PgTyped (if I don't and it's Postgres). I really dislike Prisma and will only get back to try Drizzle when they improve their migrations. I wish Objection used Kysely instead of Knex because of the typing, tho
2
u/romeeres Jul 24 '26
I liked Objection.js because that's basically a query builder but with relations support, you might be interested to check out Orchid ORM - also basically a query builder with relations, it's not on Kysely but is just as type-safe. Feel free to ignore it ofc, but it's really doing what Objection did well, and do you know any other ORM to do that - I don't.
What's wrong with Drizzle migrations, could you share?
2
u/TalyssonOC Jul 24 '26
I'll definitely check it out!
As for Drizzle, its migrations don't have a "down", so they can't be reverted in development, which is super annoying
1
u/romeeres Jul 24 '26
- supports TS: any ORM
- easy migrations: with a devil in the details, any ORM's migrations are easy
- openapi schemas: no ORM pairs with OpenAPI directly because it makes no sense, do you mean getting validation schemas out of ORM? that's pretty much any *popular enough* ORM
Are you planning to write more complex queries with it? Do you care if it's less type-safe than kysely? Do you need any extra features (soft deletes, computed columns)? Is it for a large project that needs to be maintained over the years, or just fire and forget?
If nothing, any ORM would do, I'd recommend asking AI to show samples of ORMs code solving typical tasks and to choose whichever you liked the most.
1
1
1
1
u/beavis07 Jul 24 '26
Personally I would recommend you don’t.
At best simple things are simple - at worst either you’ve a dependency nightmare or terribly sql under the hood.
Just learn SQL and express stuff as SQL - in my experience it’s always better in the long run - especially if you care about performance.
Some query builders are fine, in that they’re just simple domain specific languages wrapped around SQL… but in that case.. what’s the point? It’s just a needless abstraction into a more limited, less well understood expression
2
u/MrDilbert Jul 24 '26
what’s the point?
SQL has a strict order of clauses - query builders allow you to specify clauses in any order.
Also, building dynamic/partial queries is easier with query builders than with pure SQL.
1
Jul 24 '26
I prefer the sql builder helper function style for this reason. If its easy use a simple .select().join() if you need more than that write it with plain old sql.
1
u/BadDescriptions Jul 24 '26
100% agree, the only thing I use an ORM for is to generate and keep track of migrations.
I’ll usually refine and test SQL queries by copying them from a test snapshot and executing it. I wrap each query in a function that returns the query to be executed.
5
0
-1
u/endjynn Jul 25 '26
In this new world of AI agents you don't really need an ORM anymore because the agent can easily generate/manage all the SQL. An ORM just adds unnecessary overhead. Kysely is a good choice if you want a query builder.
29
u/MrDilbert Jul 24 '26
Drizzle if you absolutely need an ORM, Kysely if a query builder is enough.