WildCat's Blog

I'm back, Ruby on Rails

featured image

Last year, I wrote a blog post called Goodbye, Ruby on Rails. One year later, after creating my own business, I decided to be back to Ruby on Rails. I’m withdrawing my previous statements on DHH and Rails. Though I still have some concerns about the directions of Ruby on Rails, especially the rejection of TypeScript, I still believe that Ruby on Rails is a great framework for web development, especially for quick iteraction. And it won’t take more than one minute to set up TypeScript in Rails because it is super flexible.

In Chinese, there’s a quote, “天下武功,唯快不破” (The best martial art is the one that is fast and unbreakable). I think this quote can also be applied to web development. Ruby on Rails is still the best choice for fast iteration.

Why? Let me explain one by one.

Less decision fatigue

Ruby on Rails is a full-stack framework. It has a lot of built-in features, such as ActiveRecord, ActionMailer, ActionCable, and SolidQueue. You don’t need to make a lot of decisions when you start a new project. You can just follow the conventions and get things done.

In 2024, I don’t think any tech stack have the most advanced features. The most important thing is to build AND deliver actual products. Ruby on Rails is still the best choice for this. As programmers or tech workers, we usually have tons of ideas. We need to validate them as soon as possible. Because our time and money are both limited. Ruby on Rails can help you to do this as quickly as possible.

It would be a waste of time if you spend a lot of energy on making decisions like using which Python or node.js packages for a certain domain, like Object-Relational Mapping (ORM) or websockets. Ruby on Rails has already made these decisions for you. And these “decisions” have been tested by hundreds of thousands of developers, used by billions of users in productions, by companies like GitHub, Shopify, and Basecamp.

Compared with other frameworks, like Next.js, FastAPI, or Django, Ruby on Rails has a lot of built-in features. You don’t need to make a lot of decisions. You can just follow the conventions and get things done. This is the most important thing for a startup or a side project.

Boring (stable) is good

Instead of breaking changes every year, the APIs of Ruby on Rails has been really stable. This means you can easily get true answers from Large Language Models or search engines, whatever you want to do.

This is not the case for other frameworks, like Next.js. They have breaking changes every year. This means you need to spend a lot of time on upgrading your codebase. This is a waste of time. As an Apple developer for over 10 years, I know how painful it is to upgrade your codebase every year (without creating much values for the end users). This is not the case for Ruby on Rails. You can just focus on your business logic.

Great community

I’ve been using node.js / Python a lot. But these two communities are not as friendly as the Ruby community. For example, there’s a Python quote, “There should be one– and preferably only one –obvious way to do it.” This is from the Zen of Python. But in reality, there are tons of ways to do the same thing in Python.

Ironically, the Python / node.js community always have a lot of debates on which way is the best. This is not the case in the Ruby community. Though you may argue it is not inclusive, I think it’s better to have one way to do it. This can save a lot of time for beginners. When you have more resources and time, you can explore more ways to do it by rewriting your big Rails monolith into other languages.

I’ve spent too many hours researching best practices of doing X/Y/Z in Python/Node.js. I can save a lot of time by just following the conventions in Ruby on Rails or using other great Ruby Gems. For example, when it comes to OAuth, the work needed if we use Doorkeeper and Rails is much less than using Next-auth in Next.js. This is usually true for many other things, like internationalization (interesting because Vercel has not monetized this one), sending emails, handling background jobs, etc.

No overpriced components

As @DHH mentioned in the keynote of Rails Wolrd 2023 (the section of Solid Queue), commercial components should never be required for Ruby on Rails.

In contrast to Rails, Vercel upsells things like Vercel Image Optimization within the ESLint rules for Next.js (which I respect).

Because Next.js has a steeper learning curve and much much less functionalities. As a result, many so-called all-in-one development frameworks, like ShipFast, can be sold for hundreds of dollars. However, this makes no sense, as these frameworks are not designed to solve problems, but to make money. This is the principle discussed in Skin in the Game. Thinking inversely, if these all-in-one Next.js frameworks could easily lead people to success, why would the author sell their code instead of directly profiting from it themselves?

Ruby on Rails is designed for simplicity. You don’t need to pay for any commercial components. You can just use the built-in features and get things done.

We’ve seen many cases of developers complaining about the pricing of Vercel. This is not the case for Ruby on Rails. You can just use the built-in features on your own server and get things done. You may argue that many Fortune 500 companies and even OpenAI are using Next.js. Well, we’re not amoing these categories. We’re just a small team. We don’t need to pay for the commercial components at least for the startup period.

You may find that your competitors are using Next.js and/or Vercel. Don’t panic. That’s a good thing. As Jeff Bezos said, “Your margin is my opportunity.” You definately have much more opportunities to make your products better and afforable than your competitors. Because your competitors have to pay for the commercial components. You don’t need to do this. You can self-host literally everything.

Simplicity for everything

Recently, Basecamp also created Kamal (https://kamal-deploy.org) for deployment, where you can deploy your Ruby on Rails app with just one command. This is a great example of simplicity. You don’t need to spend a lot of time on configuring your deployment pipeline or hacking within the Dockerfile. You can just use the built-in features and get things done. Everything is ready from zero to at least one million users.

If you build your products with Next.js, where Vercel commercializes the deployment process. It would be a waste of time if you spend a lot of time on configuring your deployment stack. For example, for the first prototype of our accounting product, SuperBoox, we spent two weeks on configuring the deployment stack but eventually gave up. Because it is nearly impssoible to find a good solution to make every dependency in node_modules happy in the Docker environment, espesially when using immature ORM like Drizzle, you don’t even have an easy way to run migraitons, which has been built in Ruby on Rails for years.

Conclusion

As DHH said (in this podcast),

This is exactly why I literally thought I wasn’t going to be a programmer because I just didn’t have an interest in math problems. I don’t have any interest in algorithms beyond their utility. What I do have a deep, deep affection for is sort of the main modeling in the Eric Evans sense of the word domain-driven design.

I love noodling with a business domain. I love finding just the right words. I love breaking the main model apart and all that stuff, which is all sort of logical, sort of semantical, approaches to it. It is not algorithmic, it is not scientific, it’s not math.

I think by becoming a full-time business owner, you have to be crystal clear about your own priorities. For example, is it the top priority to iterate fast, then push products to the market? Or just leaning in the latest tech trends and frameworks? I think the former is more important. Ruby on Rails is still the best choice for this.

I had been in Microsoft for years. I know how painful it is to upgrade your codebase every year (especially in terms of the code of Outlook iOS). This is not the case for Ruby on Rails. You can just focus on your business logic. This is the most important thing for a startup or a side gig.

“Perfection is the enemy of progress”, spoken by Winston Churchill, is what I’m thinking about. Rails is not 100% perfect for everything. But I believe it is great for your startup, especially you’re on your own.

Updated on 2024-08-12:

This blog posted was shared by DHH. If you’d like to join the conversation on X (Twitter):

#Development #Server-Tech