Lots of developers who start their web development journey chooses Ruby on Rails for their first projects. That’s a good choice in my opinion - you can get you app up and running quickly and quite easy. It’s really fun and lots of people enjoy this fast way of development. Problems start to occur when one do not have enough knowledge about what’s going on behind the Rails scenes - the app is growing and the control is getting more and more limited. Everything ends up with a big mess which is hard to clean up. If you’re a beginner and have some Rails projects done, I think it’s a good time for you to take a next step and try something else. You can learn a lot about how does Ruby and its frameworks work (and understand Rails better), by digging into lower layers, down to middleware or even more. As my grandpa said: you can do more and choose better if you know the alternatives. So let’s take a quick look on Sinatra, Cuba, Padrino, Lotus, Roda, Traiblazer and Volt!*
Let’s start from the beginning - Rails is a very good and mature framework used widely around the world. Obviously it’s not the best solution for all your projects, even if you know how it works from scratch. Personally, I like the magic of Rails happening in the background - it helps a lot to deliver the working code faster. In spite of that I’m pretty sure that there’s much more options in the world of Ruby frameworks, that can also bring you a lot of fun and help you understand some things better. Let’s start the quick brief of this stuff.
“Cuba is a Ruby microframework for web development.”
You can find this sentence in the project’s homepage (here) and it’s the essence of this framework. Cuba has less than 200 LOC and it provides really minimalistic set of “features” that you need. It’s (of course!) built on top of Rack and actually does one thing - handles the HTTP requests. Thanks to that it’s really fast, stable and gives you great flexibility and control over you app. The cost of that is obvious - you need to write more code to get things done. It’s definetely worth trying if you’re not a very beginner in the web.
Roda is a fork from Cuba by Jeremy Evans. The framework itself has a small core and it’s desired to use plugins instead of tons of internally implemented features. Thanks to that you can easily avoid developing a messy monolith while writing an app. Actually I have just started to use Roda in one of my recent projects so I can’t write down too much of what I’ve experienced in person. For me, one of the most interesting features in Roda is routing - you’re not using a standard routing list with Roda, but a simple and readable routing tree. That’s actually the main difference between Roda and Sinatra. Another interesting thing in Roda is the way it works in production - it’s freezing the most of the app’s structures and thus is immutable. Roda is really quite interesting player on the market.
To be honest - you should already have heard about Sinatra as I think it’s the second (guess who’s first! ;-)) most popular Ruby web frameworks. Actually I would rather call it a DSL. It is a lightweight project and much more simple than Rails or Lotus. That allows you to create web apps with great flexibility and minimal effort. There is no ORM there (what does not mean you can’t use ActiveRecord for example), no controllers or models layers - it’s all up to you how you design and implement your your app structure and features. Compared to Cuba it gives you some more basic features ready out of the box, but it’s still far away from tons of helper methods (etc.) delivered to you by Rails. It’s not a ‘two click’ framework which allows you to get a quite complex app running in one evening, but I like Sinatra and I’ve learned a lot from it. I really recommend you to play a little bit with this framework if you haven’t tried that yet.
I think we can assume that Padrino is simply a Sinatra-based framework with lots of Rails-like features. It’s functionality covers lots of topics similar to RoR: routing, generators, views, caching, mailers, tag/form helpers etc. Padrino has not so many and complex features that Rails offers, but is should be enough to launch a medium-sized app quite fast. In my opinion Padrino is worth considering to use only when Sinatra is too lightweight for your requirements and Rails seems to be too heavy weapon for your project.
Lotus is a relatively fresh, “full-stack ready” project started in 2013 as an alternative to Rails. The main goal of Lotus is to use POROs (Plain Old Ruby Objects) rather than to learn another DSL to deliver your web app. Lotus contains the following micro-frameworks, that smoothly work together: Model, Router, Utils, View, Controller, Validations and Helpers. You can use all of them or choose which one to include in your project, that gives you some basic flexibility when planning your app. If you like “The Rails Way” and are satisfied working with RoR, you probably wouldn’t like Lotus. If you’re tired of “The Rails Way” and want to try something else, Lotus is a good choice for you.
When you click on the link above you can find the following info: Trailblazer is a thin layer on top of Rails. It gently enforces encapsulation, an intuitive code structure and gives you an object-oriented architecture..
In my opinion Trailblazer is a very specific project. I like it’s approach that helps you keep your (Rails) app more clearly structured and object-oriented, with no Rails-specific issues like fat models etc., but to be honest you can achieve this, and much more, without Rails. Personally I think that putting an additional layer on top of Rails is too much. Imagine that you’re adding even more layers on top of it - you’ll probably become overwhelmed of everything what happens in your app.
This post is not a guideline through all of the frameworks listed above and how to use them. It’s only a quick brief that shows you there is much more than Rails in Ruby web frameworks world. As a professional or hobbyist Rails developer I believe you should taste something else and you can find some interesting positions for you right above.
* Please let me know if I missed anything!