Rails Startup Stack
Building web applications with Ruby on Rails is one thing—crafting and scaling a fast-paced startup is a whole different ballgame.
Startups are expected to deliver:
– Disruptive user experience (because who wants to be just another app?)
– Remarkable growth rates (we’re talking growth that makes your head spin)
– Insane productivity (because time is money, and startups burn through both)
Fortunately, Rails is the perfect tool for the job—especially when paired with the right ecosystem resources from the Rails community, including us, the ever-enthusiastic Evil Martians.
So, without further ado, here’s our curated selection of services, gems, guides, and resources designed to turbocharge your startup’s success!
Irina Nazarova CEO at Evil Martians
Our selection currently includes these topics:
UI / UX
Hotwire/Turbo, the great new paradigm for full-stack Rails
Practically every application will have a use case for Hotwire: simpler views that can be built very efficiently in Ruby.
Start with the official documentation at Hotwired.dev continue exploring the community-driven resources at Hotwire.io, which include UI libraries, LSP, and more.
ViewComponent is a great tool to build reusable, testable, and encapsulated components. Our 3-part guide ViewComponent in the Wild is here to take you from beginner to advanced in ViewComponent.
And the newest kid on the block is Turbo Morph Drive, an approach to propagating updates to the entire page smoothly. Master it by reading our 2-part guide, The future of full-stack Rails.
Don’t miss Tailwind, which works neatly with Rails. And Vite Ruby, the best build tool for Rails, will relieve you of any asset pipeline and WebPacker pains (some PTSD may remain, consult with your doctor): here’s how we Vite-lize Rails for hot reloads and live replacements.
Finally, our Frontendless Rails frontend talk is already classics.
Adding React/Vue/Svelte components or views
But what if you want to drop one or two pretty React (or Vue, Svelte) components into your otherwise Hotwired view? We got you–please welcome Turbo Mount, the new tool we built so you don’t have to. Check out how to use it, with some tasteful examples: The art of Turbo Mount.
What if you are ready to go all-in with React (or Vue, or Svelte) for a particular view? There is a faster and efficient way of doing that without building the API. Enter Inertia.js in Rails: a new era of effortless integration. We contributed to the documentation, built pretty generators and now we are ready to make your TypeScript developers happy (as happy as they can be): welcome Typelizer, a Ruby gem that generates TS types from Ruby serializers.
Can you see what we are doing here? Yes, we are giving you all tools to go from Hotwire to dual-stack gradually, on as-needed basis, and not “all at once”.
Dual stack, or API mode
Speaking of the dual stack, i.e., the separation between a Rails backend and a Next.js or another frontend—we’ve got you covered here as well!
GraphQL Ruby remains the most comprehensive suite for dual stack, and our 3-part series GraphQL on Rails is here to guide you from first query to real-time updates and error handling. In case you run into performance issues, read How to GraphQL or watch Building High Performance GraphQL APIs before bed for renewed optimism in a happy and performant tomorrow!
If, on the contrary, you feel quite RESTful, use the moment to adopt the best practice for productive OpenAPI testing with Scooma, a Ruby library for validating API implementations and RSwag.
Scaling
Going big with Rails is has been proven by many successful products—like Shopify and GitHub! Here’s what to think about when scaling Rails applications:
- Optimizing for performance.
- Bringing observability.
- Designing code for maintainability.
Performance
The superpower of Rails is in its “adapterization” design pattern that allows us to replace the most performance-critical parts of the application with “power-ups” when we need it, and remain productive.
A notable case for such replacement is AnyCable, the open source product that we originally built as a performant replacement for Rails ActionCable. Built in Go, AnyCable provides not only perfomance and scalability for realtime updates, but also delivery guarantees, higher-level abstractions and more–when used with its client library. AnyCable also has a managed version (in beta).
imgproxy, a Go server we built (and open sourced) for on-the-fly image processsing, that is necessary for fast page load for any application with user-generated content, is another such power-up. imgproxy became widely popular thanks to its speed and simplicity. With imgproxy-rails gem, no changes in application code are needed to switch ActiveStorage::Variant API to the fast and performant solution. imgproxy Pro is a startup built on top of the open-source, and a spin-off of Evil Martians.
Other power-ups include Karafka, an efficient Kafka processing framework for Rails.
Finally, performance of a Rails application is tighly coupled with the performance of the database. We’ll just mention three things: partitioning, partitioning and …soft-deletion. And a great book: “High Performance PostgreSQL for Rails”.
Observability
With great power comes great observability, or so it should be! Luckily, Yabeda, a family of gems–sidekiq, Puma, Prometheus, GraphQL, are many more gathered at the table, and only you are missing–is here to make Ruby and Rails application monitoring as easy as possible. Read our guide on Meeting Yabeda and don’t be late to dinner!
Save yourself some sleepless nights with Logidze, a Ruby library for tracking Active Record changes.
If you don’t think observability is cool, you will–when something unexplainable starts happening to your app under peak load. Be smarter–bring the unexplainable home, by running a load test in advance. K6 is the modern load testing framework allowing you to spin up a cute mob of robots that will behave just like your real users. Don’t limit yourself with HTTP, because why should you? Test your WebSocket load with AnyCable, k6 and Yabeda.
Maintainability
Your application has to survive not only this particular spike or peak load. It has to survive something much worse: the passing of time. The hopes, dreams and fears that multiple engineers bring into the codebase that has very little means of protecting itself from this treatment. We’ve seen a lot! And after all those years, our Head of Backend, Vladimir Dementyev, wrote a book that will give a superpower: you will be able to extend Rails, to introduce new layers of abstractions to the framework while remaining in the ethos of Rails, and preserving and extending its magical productivity, the developer happiness. And we know: happy codebases live long! Go ahead and read it: “Layered Design for Ruby on Rails Applications”.
While waiting for the book delivery, you can watch this talk on a related topic: Between Monoliths and Microservices.
Deployment
Rails applications could be deployed anywhere—from good old bare metal machines to Kubernetes clusters. And, of course, there are plenty of PaaS options.
Choose whatever better matches your team!
- Martian Kubernetes Kit: A smooth sailing toolkit from our SRE team
Martian Kubernetes Kit: A smooth sailing toolkit from our SRE team
- Kamal: hot deployment tool to watch—or a total game changer?
Kamal: hot deployment tool to watch—or a total game changer?
DX & testing
Ruby and Rails heavily focus on developer productivity—and so should you. Imagine having a reproducible, easy-to-set-up development environment, fast and reliable tests, and the ability to delegate repetitive routine tasks to robots! This is what we brought to you in this section!
Ruby on Whales–our Docker image for Rails–probably inspired the official Dockerfile, that was introduced in Rails 7.1. But take a look! It it not only good for you, but also for the new teammates joining you in the future!
Speaking about tests, we hope you write them! And not only unit tests, but also end-to-end test (here’ how!). But when you do, they may start slowing you down on the CI, and at some point, you might want to lock yourself up somewhere cozy with our test profiling toolkit, TestProf, to find smart ways to speed things up! And now you can start with the RailsConf 2024 workshop on speeding up tests with Testprof. If instead of cozy, it sounds tedious, stay tuned–TestProf Autopilot is coming!
Speaking about tedious, refactoring legacy code (that’s how we call the code written by your company co-founder) is hardly a happy task. But check our our classic Terraforming Rails presentation, and you may change your mind! With the right tools and process, it can be fun.
Now that you are all set, let’s add something nice and sweet, like our open source Git hook manager, Lefthook! Check it out and thank us later.