We are planning on building a Node.js service. Here's our evaluation of the current ORM landscape:
Last updated: May 2 2016
- Objection.js
- http://vincit.github.io/objection.js/#introduction
- Bad: API is Promise based and bulky. This means people can forget to have an error handler due to not being error first
- Good: Uses JSON schema for validation; this means content should be relatively reusable between server/browser
- Good: Has nice syntax for relationships
- Good: Built on knex.js which seems to be canonical SQL driver
- Neutral: Recommends using Knex.js' migration tool for migrations
- Good: Well maintained
- http://isitmaintained.com/project/Vincit/objection.js
- Resolution time: 1 day, Open issues: 13%
- http://isitmaintained.com/project/Vincit/objection.js
- Sails
- https://github.com/balderdashy/sails
- Not looking for an opinionated MVC, skipping for now
- Waterline, ORM from Sails
- https://github.com/balderdashy/waterline
- Bad: Response time takes a while
- But might be well supported since Sails?
- http://isitmaintained.com/project/balderdashy/waterline
- Resolution time: 10 days, Open issues: 2%
- sequelize
- https://github.com/sequelize/sequelize
- Good: Syntax is clean and straightforward
- Good: Seems to have everything we need (e.g. relationships, validation)
- TODO: There might be callback support via
nodeify
- Good: Well maintained
- http://isitmaintained.com/project/sequelize/sequelize
- Resolution time: 1 day, Open issues: 12%
- http://isitmaintained.com/project/sequelize/sequelize
- Bookshelf.js
- http://bookshelfjs.org/
- Good: Feels very Backbone.js-esque (e.g.
get
/set
, virtual properties (similar tobackbone-relationship
)) - Good: Supports callbacks
- Good: Authored by knex.js author
- Bad: Maintenance isn't great
- http://isitmaintained.com/project/tgriesser/bookshelf
- Resolution time: 6 days, Open issues: 28%
- http://isitmaintained.com/project/tgriesser/bookshelf
- orm2
- https://github.com/dresende/node-orm2
- Used it previously, had a terrible experience
Our likely choice is sequelize
(possibly with callback bindings via bluebird-nodeify
)
Objection is much better architected than Sequelize. Objection is based off of Laravel's Eloquent, which is based off of Rails' ActiveRecord. Both pieces of software are very good. Objection is easily extensible due to its class-based architecture.
Many other users who've had experience in both Sequelize and Objection.js (as I have) are in the same boat: Vincit/objection.js#1069