6 ms·
As someone who has been writing core APIs in Node.js for a few years now, one thing I really miss is a good ORM. The best one is probably Bookshelf.js but it's
by olalonde 10y ago
As someone who has been writing core APIs in Node.js for a few years now, one thing I really miss is a good ORM. The best one is probably Bookshelf.js but it's poorly maintained and lags behind more mature ORMs like Active Record in terms of features and stability.
- ruddct 10y agoNot to go too off-topic, but Sequelize is worth a look if you haven't played with it already.
- deleted 10y ago[deleted]
- olalonde 10y agoI used Sequelize for a while before Bookshelf was released and haven't used it since so I'm not sure how it compares these days. One thing I like about Bookshelf is that the query builder (Knex.js) is fairly decoupled and it's not that scary to drop down to the SQL layer. I still feel it's not quite as good as it could be.
- gaastonsr 10y agoThis might not be objective because I hate sequelize but sequelize sucks! I never understood its API. Is so clunky compared to Bookshelf.js. Bookshelf is less opinionated on the way you integrate it with your web app with makes it good to work with if you have strong opinions on how it should integrate with your codebase.
- casenjo 10y agoI recently started playing around with Node for a friend's side project. I helped him set up the database and Sequelize was absolutely horrible to get up and running. The documentation was really lacking and we spent hours trying to track down little details needed to get things running. It does the job once you have it set up, but I found getting to that point was way more difficult that it should have been.
- ht85 10y agoI used bookshelves a couple years ago and while it was very good on paper, I quickly ran into a lot of quirks and bugs for advanced usage. There was an obvious lack of resources to develop it, and after contributing to it a bit I switched. Reliability is the #1 feature in an ORM in my opinion, and I didn't get that confidence from using bookshelves. I later moved to sequelize, and it worked flawlessly from the get go, give it a try. You can compare the Github activity, you'll see it's thriving, and everything is much cleaner. The performance is also way ahead, as last time I used it bookshelves relied on Backbone-esque models underneath, making it way slower for big nested queries.
- olalonde 10y agoThanks. I actually started out with Sequelize before switching to Bookshelf.js but you convinced me to give it another go.
- gaastonsr 10y agoNoo, give it a go Bookshelf.js you will be more happy. Yes, maintenance lacks behind sometimes but the core is strong. And if you do anything particularly hard you always can tap into knex and get all its powerful API and if that is not enough you run raw queries until the feature is officially supported.
- overcast 10y agoIf you're using RethinkDB, https://thinky.io https://thinky.io works well. I use it for all my current projects.
- Keepo 10y agoYou might want to check this https://github.com/Vincit/objection.js https://github.com/Vincit/objection.js it is the only node ORM I don't hate yes even compared to sequelize I tried them all.
- z3t4 10y agoWriting asynchronous SQL queries is tedious indeed. SQL is very powerful though, and has it's use cases. But for real time applications, like multi-player servers, it doesn't really fit, so for those use-cases, I've made an ORM (1) that use proxies so data can be treated just like any JavaScript object, with synchronous in memory read/write and asynchronous HDD persistence via an SQL server. 1) https://github.com/Z3TA/dbo https://github.com/Z3TA/dbo