Jorge Manrubia

December 12, 2024

A vanilla Rails stack is plenty

If you have the luxury of starting a new Rails app today, here’s our recommendation: go vanilla.

  • Fight hard before adding Ruby dependencies. Keep that Gemile that Rails generates as close to the original one as possible.
  • Fight even harder before adding Javascript dependencies. You don’t need React or any other front-end frameworks, nor a JSON API to feed those.
  • Hotwire is a fantastic, pragmatic, and ridiculously productive technology for the front end. Use it.
  • The same goes for mobile apps: use Hotwire Native. With a hybrid approach you can combine the very same web app you have built with a wonderful native experience right where you want it. The productivity compared to a purely native approach is night and day.
  • Embrace and celebrate rendering things on the server. It has become cool again.
  • ERB templates and view helpers will take you as long as you need, and they are a fantastic common ground for designers to collaborate hands-on with the code.
  • #nobuild is the simplest way to go; don’t close this door with your choices. Instead of bundling Javacript, use import maps. Don’t bundle CSS, just use modern standard CSS goodies and serve them all with Propshaft. If you have 100 Javascript files and 100 stylesheets, serve 200 standalone requests multiplexed over HTTP2. You will be delighted.
  • Don’t add Redis to the mix. Use solid_cache for caching, solid_queue for jobs, and solid_cable for Action Cable. They will all work on your beloved relational database and are battle-tested.
  • Test your apps with Minitest. Use fixtures and build a realistic set of those as you cook your app.
  • Make your app a PWA, which is fully supported by Rails 8. This may be more than enough before caring about mobile apps at all.
  • Deploy your app with Kamal.

If you want heuristics, your importmap.rb should import Turbo, Stimulus, your app controllers, and little else. Your Gemfile should be almost identical to the one that Rails generates. I know it sounds radical, but going vanilla is a radical stance in this convoluted world of endless choices.

This is the Rails 8 stack we have chosen for our new apps at 37signals. We are a tiny crew, so we care a lot about productivity. And we sell products, not stacks, so we care a lot about delighting our users. This is our Omakase stack because it offers the optimal balance for achieving both.

Vanilla means your app stays nimble. Fewer dependencies mean fewer future headaches. You get a tight integration out of the box, so you can focus on building things. It also maximizes the odds of having smoother future upgrades. Vanilla requires determination, though, because new dependencies always look shiny and shinier. It’s always clear what you get when you add them, but never what you lose in the long term.

It is certainly up to you. Rails is a wonderful big tent. These are our opinions.
If it resonates, choose vanilla!

About Jorge Manrubia

A programmer who writes about software development and many other topics. I work at 37signals.

jorgemanrubia.com