2022-06-13
2806
#nestjs
Yan Sun
115485
Jun 13, 2022 â‹… 10 min read

Comparing 4 popular NestJS ORMs

Yan Sun I am a full-stack developer. Love coding, learning, and writing.

Recent posts:

Solid Principles For Javascript

SOLID principles for JavaScript

SOLID principles help us keep code flexible. In this article, we’ll examine all of those principles and their implementation using JavaScript.

Frank Joseph
Dec 5, 2024 â‹… 10 min read
Master JavaScript Date And Time: From Moment.js To Temporal

Master JavaScript date and time: From Moment.js to Temporal

JavaScript’s Date API has many limitations. Explore alternative libraries like Moment.js, date-fns, and the new Temporal API.

Yan Sun
Dec 4, 2024 â‹… 9 min read
Npm Vs. Npx: What’s The Difference?

npm vs. npx: What’s the difference?

Explore use cases for using npm vs. npx such as long-term dependency management or temporary tasks and running packages on the fly.

Fimber Elemuwa
Dec 3, 2024 â‹… 5 min read
How To Audit And Validate AI-Generated Code Output

How to audit and validate AI-generated code output

Validating and auditing AI-generated code reduces code errors and ensures that code is compliant.

Boemo Mmopelwa
Dec 2, 2024 â‹… 5 min read
View all posts

6 Replies to "Comparing 4 popular NestJS ORMs"

    1. I am glad that you found the article useful.
      I used Prisma/NestJS for a recent personal App, and it works very well. It is just person preference (mainly because I like the full type safe queries). There are of course much more factors to be considered if the decision is for an Enterprise App.

  1. After using Prisma for quite some time now, I feel like overall the DSL and querying is not bad, although it has limitations that can be overcome but lead to worse performance. (https://github.com/prisma/prisma/discussions/4185)
    In comparison with knex, having a schema where we can see how the DB is supposed to look like is definitely nice. That said, the way we migrate the DB is not awesome. Generating migrations directly modifying the schema, falls in my mind into the “demo wowww” effect, but it has strong limitations. For example, when renaming a column, prisma cannot tell what you want to do. It will end up deleting the old column and create a new one. There are some work-arounds (https://www.basedash.com/blog/how-to-rename-a-table-or-column-using-prisma-migrations) but it shows the limitations of this abstraction: I think an imperative approach to migrate the DB (with a DSL) is superior than a declarative one.
    Also the fact, that we cannot use JS inside migrations means that this tool can only be used to change data structure but not so much migrate / move the existing data. When you want to do this (we had to and we will have to), the response (https://github.com/prisma/prisma/discussions/10854#discussioncomment-1865526) is to launch a Node Script against the DB. Problem with this is that you need to develop your own tooling like recording that a script was run not to run it multiple times (something prisma SQL migrations already cater for).
    All in all, I am still happy we went with prisma as opposed to knex. But I think some of the abstractions that were used fundamentally prevents this tool from being on par with other tools like Rails’ ActiveRecord for example

Leave a Reply