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:

Nx Adoption Guide: Overview, Examples, And Alternatives

Nx adoption guide: Overview, examples, and alternatives

Let’s explore Nx features, use cases, alternatives, and more to help you assess whether it’s the right tool for your needs.

Andrew Evans
Mar 28, 2024 â‹… 9 min read
Understanding Security In React Native Applications

Understanding security in React Native applications

Explore the various security threats facing React Native mobile applications and how to mitigate them.

Wisdom Ekpotu
Mar 27, 2024 â‹… 10 min read
Warp Adoption Guide: Overview, Examples, And Alternatives

warp adoption guide: Overview, examples, and alternatives

The warp web framework for Rust offers many enticing features. Let’s see when and why you should consider using warp in your projects.

Ukeje Goodness
Mar 26, 2024 â‹… 8 min read
Integrating Next Js And Signalr For Enhanced Real Time Web App Capabilities

Integrating Next.js and SignalR to build real-time web apps

In this tutorial, you’ll learn how to integrate Next.js and SignalR to build an enhanced real-time web application.

Clara Ekekenta
Mar 25, 2024 â‹… 8 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