DEV Community

Discussion on: Express.js vs. Rails

Collapse
 
leastbad profile image
leastbad

Hey Rachel!

It really depends on what you want to build, right?

Express isn't a 1:1 comparison with Rails, which comes with an opinionated set of frameworks. If you are looking for the Ruby equivalent to Express, you should check out Sinatra. That example on the homepage isn't a fragment; it's a complete application and it should be quite familiar because Express is based on it.

Rails is an abstraction from the Basecamp project management system, so out of the box it comes with all of the building blocks you'd end up wanting if you were building a typical SaaS product; it also supports an "API mode" and supporting React (if you must) is as simple as a command-line flag. It's distinctly possible that Rails is the fastest way to get a server-backed React app running and deployable.

However, very few people want all of the frameworks that come with Rails, and there are several paths people take to pare it down. Experts are likely comfortable enough manually skipping or removing frameworks they don't need. There's rapid progress being made on a Rails interactive installer as I type this. Today, you have two really excellent starting points: railsnew.io/ lets you quickly build your own custom rails new command. And the RailsBytes project allows you to pick and choose modular functionality and merge it into your project.

The thing is that if you're playing around with new tools, chances are Sinatra (or express) are a great way to stand up a project really quickly. However, if you're building something more significant, you're going to end up adding in a huge amount of what makes Rails feel bloated if all you need is server-side template rendering.

In the end, it really should come down to which tools make you happy and productive. There are some people who love writing JS, but did you know that Ruby was designed to optimize for developer happiness as a primary design goal? It's not some feel-good, throwaway motivational idea for our community; we defend it vigorously.

On the Rails side, all of the decisions that have gone into the framework are informed by The Rails Doctrine. Give it a read. Does it resonate with you?

In the end, I hope that I can keep your mind open to the possibility that working in Rails is kind of amazing. The community isn't toxic and the libraries are mature. There isn't the constant churn of new build systems and throwing everything out every few months. All of that "excitement" comes at a real cost to productivity and, over time, contributes to depression and burnout just trying to stay on top of this week's new thing.