Ruby on Rails vs. Express.js. A Ruby Dev Shop Owner Perspective
Recently a web development community is being bombarded by JS libraries. The growth in the JS world is backed by large companies such as Google, Facebook or Microsoft. Market share noticeably increases. Especially React and React Native are becoming front-end standards. The early adopters’ wave is already behind us. Every reasonable software house owner should ask himself:
Should we try those whole new JS things?
I’m sharing my point of view as a technical owner of a Ruby on Rails dev shop.
Coverage of Ruby on Rails features in Express.js
The main advantage of Ruby on Rails development is a large set of libs (gems) helping to significantly shorten time to delivery. My question was how mature is Node comparing to RoR. I identified popular gems used in our projects and tried to find an equivalent solution in Node. Here is what I got:
ActiveRecord — communication with a database — Basic Rails ORM gem for abstracting manipulation of all popular databases. Crucial for Ruby on Rails coding efficiency.
Equivalent: Sequelize — it seems like this lib pretty ordinary mimic ActiveRecord using JS syntax. It handles migrations (with external lib), provides a query interface and allows to build associations between models.
Devise — authentication solution — one of the most essentials gems responsible for sign up, log in using a database or one of 800 external providers, password recovery and more.
Equivalent: Passport — provides over 300 authentication strategies including basic database authentication.
carrierwave — file upload, management, and image manipulation.
Equivalent: the most prominent lib I found is multer, a part of Express.js — it provides very basic functionality — just file uploading to the given directory. Comparing to carrierwave it doesn’t provide any file manipulation abstractions.
Searchkick — excellent interface for communication with elasticsearch.JS providing abstraction all basic full-text search needs as well as some advanced features like facets building, autocomplete and suggestions.
Equivalent: the only library that I found suitable for comparison is elasticsearch-js but it covers only basic functionality and doesn’t integrate with any ORM as an opposite to Searchkick.
Pundit — provides a simple, flexible yet powerful solution for resource authorization.
Equivalent: node_acl — integrated with Express.js and even more advanced than Pundit, however operating on NoSQL databases.
The above list is limited to the essential backend libs. I omitted a less crucial but also important gems like AASM, Awesome Nested Set, Acts As Taggable On, Draper. I also assume that the whole frontend work would be done with React or Vue and we don’t use frontend gems like Simple Form and Kaminari.
Both Node and Rails well-established software proved to work smoothly within really big applications, handling high volume traffic of millions of users a month. However, as pointed in https://thebittheories.com/rails-vs-nodejs-the-comparison-feba9081251f
Rails works better with CPU intensive operations while NodeJS is for IO intensive operations.
According to StackOverflow Survey 2017 more than a half of the respondents pointed JS as a most popular technology and almost half Node as a most popular platform. Ruby is chosen by 9% of respondents. JS is also by far the most occupied language among web developers. In general, I encourage to read the whole survey as an interesting source of information about state of the art of IT market. In conclusion — Node devs are much more common in the market than RoR specialists. That’s important according to the future labour market especially for someone who predicts high paced growth of his company.
Ruby on Rails has never been the most popular web framework, but it pretended and still pretends to be the most productive. It outperforms Express and other Node solutions if it comes to a speed of development. The Node libs covers a reasonable share of Rails gems, however, those solution doesn’t create an unified ecosystem as Ruby on Rails. On the other hand, the JS world is growing very dynamically and provides a decent platform for a web developer. If you decide about your technology stack, I’d recommend you trying Node and Express.js in the near future. It can be a new standard. But also remember that Ruby on Rails has never been a standard!