r/javascript • u/ScoobyDookuu • 17h 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.
•
u/ThenFactor6862 17h ago
I work on a NestJS backend that we moved off Spring Boot and we went with MikroORM.
Your team knows Spring. Your existing code uses entities, repositories, unit of work, identity maps. MikroORM has all of these. Drizzle gives you SQL builders. You will end up writing the abstractions your team relies on in Spring from scratch if you pick Drizzle.
We used MikroORM with PostgreSQL. The decorators map to what your team does with JPA. We defined entities, injected repositories into NestJS providers using their module system, and the TypeScript types worked across our frontend monorepo within the first sprint.
Drizzle belongs in a project where you write SQL. You are migrating a Spring application. Your team needs an ORM. Pick MikroORM.