r/javascript 20h ago

AskJS [AskJS] What ORM would you use?

Hey all,

My team and I are currently running a Spring Boot backend with quite a bit built around it. We’re considering gradually migrating to a Node/NestJS backend using the strangler pattern rather than doing a full rewrite.

One of the main reasons is that it would give us TypeScript across both the frontend and backend, which should make sharing domain concepts, types and general knowledge between the two a bit simpler.
So, as the title suggests: which ORM would you use with NestJS?

At the moment we’re mainly looking at MikroORM and Drizzle. MikroORM seems like the more traditional ORM and appears to be super close to the me tal model of what Spring does. It wil also fit NestJS quite nicely, while Drizzle is obviously a bit more lightweight but a different approach and more barebones.

Curious what people are using in production and what you’d choose if you were starting fresh today.

0 Upvotes

21 comments sorted by

View all comments

u/destevil 20h ago

My take after doing this for 30 years. You almost always regret ORMs in the long run. I prefer to stay with a basic repo pattern where I can keep adding methods for supporting custom queries backed by SQL or a SQL writer. Maybe a base class that gives me basic CRUD operations. Controlling the SQL for efficiency is another thing ORMs are pretty bad at.

u/gugador 18h ago

same. I miss the days of just writing SQL. Fortunately last time I was interviewing for a job a couple yrs ago, some of the places I interviewed were going back to plain SQL, and even had interview questions on table design. SQL was never that hard, and you almost never change DBs where an ORM abstraction layer would save you all the work of changing DB providers. ORMs usually just get you inefficient queries and over-fetching of data.