Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How difficult is it to choose an ORM for Node.js? Or Node.js lacks a mature ORM

I have a production project to develop. It's an e-commerce site. My current stack:

  1. Node.js
  2. TypeScript
  3. PostgreSQL

Now I have to choose an ORM for this project. I think I have two options:

  1. TypeORM. I've used this ORM before. It's good and stable software, but TypeORM has had maintenance issues for a while. I'm not sure about the future of this ORM.
  2. MikroORM. TypeORM lacks some useful features like @Filters (scopes) and bulk subscribers, while MikroORM on the other hand has these features or alternatives (see filters and alternative to bulk subscribers). But MikroORM is less popular and relatively new. And many of MikroORM's features are still in alpha

Summary

ORM with lack of maintenance and features but stable or ORM with great maintenance, new features, but not battle-tested. Which option is better? Or maybe there are some alternatives?

like image 639
Mike Avatar asked Aug 04 '20 12:08

Mike


1 Answers

You can check Sequelize - https://sequelize.org, it has a TypeScript support, but the syntax is kind of ugly in my opinion. Among the three, Sequelize is the most mature ORM.

TypeORM is very nice, but has some major bugs like this - https://github.com/typeorm/typeorm/issues/3095. I came across to same or maybe similar problem related with saving one to many relations which i think is one of the most important features of every ORM and it must works properly.

I used MikroORM for a while - Again there are some minor problems which fortunately will be fixed in version 4. Overall, most of the features works properly and almost all of the problems that i had was resolved very quickly after reporting them on github.

like image 194
Nikolay Avatar answered Oct 08 '22 23:10

Nikolay