I'm creating rest api backed by PostgreSQL. I like Strongloop Loopback framework, it streamlines api development. But how its built-in orm compared to sequelize? What advanced features has sequelize as dedicated sql orm, which are missing in loopback? Maybe it's better to stay with sequelize, and use some other rest api helpers than monolitic loopback framework?
The most popular option, Sequelize is an open-source Node. js ORM with millions of weekly downloads. Sequelize provides support for Postgres, MySQL, MariaDB, SQLite, SQL Server, and more. Featuring solid transaction support, relations, eager- and lazy-loading, and read replication, Sequelize is a powerful tool.
Working with LoopBack's Object-Relational Mapping (ORM) System. When we talk about LoopBack, we're usually talking about rapid API generation. But behind the REST APIs is a full object-relational mapping (ORM) system that enables you to do all the standard create, read, update, and delete (CRUD) operations in your Node ...
TypeORM is a TypeScript ORM for Node. js. It supports many databases and can be used an as alternative to LoopBack's Juggler ORM.
Sequelize is a modern TypeScript and Node.js ORM for Oracle, Postgres, MySQL, MariaDB, SQLite and SQL Server, and more.
Kind of an opinion question, don't know if it really belongs here. I don't see much of a difference in the ORM implementation myself, as far as the RDMBS piece goes anyway (nosql is another story). I also really can't speak for the Postgres implementation specifically as I unfortunately need to use it with MSSQL. Does squelize let you work with Hstore or json though? Think those things you will find missing in loopback as it generalized the API across all connectors. Its a trade-off. You query your RDMBS the same way as you would Mongo, lets say. That said, strongloop appears to have made a product here geared for the enterprise so I would wager that the support should be pretty good.
On a side note, I don't really know if calling loopback a monolithic framework is accurate. To me, at least, a monolithic frame work would be something like Rails that paints you in a corner as to the architecture and is really geared more for server rendered content (vs Fat-client SPAs). Loopback automatically generates a swagger compliant Rest API for you, though its up to you to configure which routes/verbs are accessible and the ACL controls. While certain implementation of the pieces are "baked in" its hardly monolithic. You are going to end up creating all these routes in any other framework if you are going with a Restful architecture. You can still create custom end points in loopback as you see fit. One really nice thing with Loopback is that you can reverse-engineer model definitions from existing/legacy sets in RDBMS. There is also a definition sync option (i haven't actually explored yet). Check out this talk, it does well show the logic to why loopback is.
It's kinda late answer but for future references: Loopback is more than ORM, it's an ORM + Express, in fact. You can use Loopback's ORM lib (loopback-datasource-juggler) separately also but api of it is not as intuitive as Sequelize. On the other hand, for me, one of the main differentiator was, Loopback is able to update the existing database tables, without destroying the data in it, if you change your model later on. With Sequelize, you need to handle it manually, it only creates the table first time when you run it. To update the existing table, you need to drop it and then re-create it. And hopefully you remember to get backup of the data in table. Or change structure of the table manually.
The reason that Loopback handles it easily is, unlike Sequelize, it's not enforcing the data integrity on the database level, as @gurg-hackpof mentioned above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With