10 Small Web Frameworks for Ruby Developers

Ruby is one of those programming languages that have been around for many years, twenty in this case. It has managed to stay on top of things, and as far as I know – it has one of the nicest and enthusiastic communities that a programming language has ever had. I’m not even cheesing.

It’s also on the list of recommended web programming languages to learn this year. I had put together a list not so long ago, worth sharing with your friends / colleges who’re still looking to join the programming scene.

I have been putting together these small / minimal web framework posts for a while now, and there are a lot of things I have learned along the way. Like for example, people love to say I forgot to add something – when it clearly hadn’t crossed my path, hard to forget something you never even knew existed.

I’ve also learned that generally people enjoy these posts, and some of my top ones (like the Node.js one) have got well over 15,000 views. Haha, so much for complaining about the simplicity of them.

However, I’m not here to brag, but to point out the obvious.

I’m going to assume you’re new to Ruby, and so here is a great introductory video to the fundamentals of Ruby, what is Ruby and how you can begin building code for it. Its been published by Peter Cooper, who’s not only a good friend of mine, he’s also recognized as one of the top Ruby geniuses in the world.

He will show you basic syntax, setup requirements, some history, books to read and also a few other things, like how to install a Ruby gem. Those who know what ASMR is, you might get a tingling feeling from Peters voice, lol.

Okay, so, you’re totally welcome to add more links to this list by leaving a comment, I’m quite busy as it is, but whenever I’ll get the time to do an update – I will. I’d also recommend subscribing to my RSS feed, as I’m slowly nearing the end for ‘minimal framework’ schedule, and will begin focusing on bigger frameworks – suited for intermediate users. Keep an eye out for them.

Sinatra

Sinatra
Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort. Now, I know that Sinatra is library, and not an actual framework, but there are those who will argue or consider it as a framework, and because of the immense popularity – I’ve included Sinatra in the list.

Sinatra Ruby Framework

Sinatra allows you to structure your application to fit the problem you’re trying to solve instead of the other way around. It will only perform a set of functions that its meant to perform, each class does what it has to do, and gives the control back to you. Damn, that rhymed good.

You’ll eventually learn that many of the frameworks I’m about to mention have been ‘inspired’ and ‘built on top’ of Sinatra.

Ramaze

Ramaze • The Web Framework for Rubyists
Ramaze is a very simple and straight-forward web-framework. The philosophy of it could be expressed in a mix of KISS and POLS, trying to make simple things simple and complex things possible. It’s built to follow the MVC pattern, though it’s possible to ‘deploy’ everything from within a single script.

It’s also one of those web frameworks that has managed to stick around for a long time, and in turn has built a good sized community behind it, always there to help and support. It supports all major templating systems, and its heavily focused on modular design.

Padrino

The Elegant Ruby Web Framework - Padrino Ruby Web Framework
Padrino is a full-stack ruby framework built upon the Sinatra web library. Here we see the inception of Sinatra, and how it can be used to build actual web frameworks.

Padrino Features

The ultimate goal of Padrino is to extend the functionality of Sinatra, so that those developers who’re beginning to miss bigger frameworks can get back some of that essence, and build more complex applications at the same time.

NYNY

NYNY - a (ridiculously) small and powerful web framework
NYNY is unassuming, it has all the core stuff to get running, but nothing else. Your app is the framework. However, it’s trivial to extend NYNY via its extension interface. Each NYNY app is a Rack middleware, so it can be used inside of Sinatra, Rails, or any other Rack-based app.

It uses the same interface for extensions as Sinatra does, but it is not guaranteed that all of the Sinatra extensions are going to be working with New York, New York. (NYNY) But, any extensions built specifically for NYNY, will never have issues with working on Sinatra.

Nancy

Nancy by guilleiguaran
This is also the perfect chance to see how humbling the Ruby community is, “Sinatra’s little daughter”. Nancy is incredibly fast, being based Cuba and Sinatra. It has got the same route functionality that Sinatra has. You can ‘use’ to include Middleware. Enables mounting rack applications with ‘map’.

Grape

Grape I REST-like API micro-framework
It’s a REST-like API micro-framework built to complement existing web application frameworks by providing a simple DSL to easily provide APIs. It was built to replace the API functionality of bigger frameworks like Rails, and Sinatra – because they just end up getting caught up in between their own infrastructure.

Also known as Generalized Rapid API Erector. It was built to ease the development of API’s, and it simply works. Its Grape.

require 'grape'

class MyAPI < Grape::API
  get 'hello' do
    { :hello => 'world' }
  end
end

//

GET /hello
{“hello”:”world”}

Cuba

Cuba
Cuba is a microframework for web development originally inspired by Rum, a tiny but powerful mapper for Rack applications. It’s quite elegant, and has support for clean code that can be used to run tests. The philosophy of Cuba is to build web applications with as small amount of files as possible, while keeping everything global.

Its a great little framework for building real-time applications, landing pages and even eCommerce apps. You can watch a little slideshow here.

Camping

Camping, a Microframework
Camping is a MVC web framework which is only 4kb in size, and its built so it stays around the same range. Its so small, it begs to question what it can do, right? The idea here is to store a complete fledgling web application in a single file like many small CGIs. But to organize it as a Model-View-Controller application like Rails does. You can then easily move it to Rails once you’ve got it going.

It hasn’t been updated in the last few months, mostly because it went from being developed and maintainted by one person, everyone can commit an update or a patch, and the author will consider it for approval. I recommend reading this article on Camping (and also Cuba), and how it works.

Honorable Mentions

I’ve not been able to find a lot of information and/or resources for the below frameworks, but they appeared in my research frequently enough to be mentioned here. I’d love to have you comment on these, so that I can update them with a picture and your original comment.
Crepe – The thin API stack.
Hobbit – A minimalistic microframework built on top of Rack.
Kenji – A lightweight Ruby web framework.
Brooklyn – Small web tool on top of Rack.

12 Microframeworks for Ruby

Gotta love how many of these little frameworks have been built with Sinatra and Rails in mind. I hope the links become useful either now, or at some point in the future – which is also the ultimate goal of creating these posts.

I can understand your concern for not seeing a lot of example code, but do take into account that 95% of these frameworks have very detailed documentations built for them, explaining everything in baby-steps.

photo by curious