Choosing a Backend, Express or Rails?

With the advent of our final projects approaching, I’m starting to do some research in some of the tools, frameworks, and libraries I’d like to use. At Flatiron School, most of our projects rely on a Ruby on Rails backend, but at several science fairs, where the graduating students demo their final projects, I have heard several of them mention that they used Node.js or Express. With most of my experience coming from Rails, I decided to look at the differences between the two frameworks.

Express

Express.js, generally just called Express, is the standard backend/server framework for Node.js. Node is the engine that interprets and executes JavaScript usually in a browser.

Some interesting Facts about Express.js:

  • Originally created by TJ Holowaychuk
  • Inspired by Sinatra
  • Backend part of the MEAN stack (MongoDB, Express, AngularJS, Node)

Comparisons

I am going to bullet some differences between the two, and point out which one I like better, these comparisons are my personal opinion based on my style and experience.

Development Time:

  • Rails has more “magic” out of the box, including its ability to create migrations
  • Express has less features out of the box, but is easily and highly customizable with the right packages.

Advantage: Rails

Structure:

  • Rails is highly structured, or highly “opinionated”, which means if you don’t do something that follow conventions it will break. It is also easy to pass projects from developer to developer because the conventions are rigid and easier to follow.
  • Express on the other hand has no naming conventions and is more free form, which seems interesting at first, but with less conventions to guide you can quickly become unorganized, however that tends to mean Express directories are generally smaller than Rails directories.

Advantage: Rails

Language:

  • In today’s modern web it is necessary to build your frontend in something responsive such as JavaScript. Which means you need to know both Ruby and JavaScript.
  • Written in JavaScript! You only need to know one language

Advantage: Express

Performance:

  • Express is faster than Rails probably because of its ability to process asynchronous I/O calls
  • However, tasks that entail more cpu intensive requirements generally perform better with Rails

Advantage: Express

Stability:

  • Rails(2004) is way older than Node(2010), which means more gems have been developed for it, and the conventions and best practices are more fully flushed out.
  • Express while newer and fresher, develops packages faster which can lead to instability as there are tend to be multiple packages for similar requirements.

Advantage: Rails

Conclusion:

Both Rails and Express have their advantages. Rails is more structured, but slower, and “less sexy.” While Express is the new kid on the block, faster, but also more freeform. Based on my experience with Rails and my research in Express, I think I would prefer Rails over Express, simply because as an inexperienced developer the conventions and rigidity of Rails seems safer and more comfortable. However, if I do appreciate the creativity and efficiency provided by Express.

Sources: