# Ruby web framework libraries

Ruby web frameworks receive HTTP requests, route them to Ruby code, and return HTML or JSON responses. A microframework handles routing and responses and leaves database and template layers to separate libraries. These libraries let teams build web apps and APIs in Ruby.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [Rails](#rails) | 819394975 | 59.1K | Nov 2026 | MIT |
| [Sinatra](#sinatra) | 364942330 | 12.5K | Nov 2026 | MIT |
| [Grape](#grape) | 87867545 | 10.0K | Oct 2026 | MIT |
| [Roda](#roda) | 22731529 | 2.2K | Nov 2026 | MIT |
| [Padrino](#padrino) | 1744337 | 3.4K | Nov 2026 | MIT |
| [Hanami](#hanami) | 1287349 | 6.4K | Aug 2026 | MIT |
| [Cuba](#cuba) | 543682 | 1.4K | Jan 2024 | MIT |

Downloads: RubyGems, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[Rails](#rails) has the most monthly downloads in this comparison, at 819394975.

## Capabilities

| Library | HTML view templates | Live response helper |
| --- | --- | --- |
| [Rails](#rails) | Yes | Yes |
| [Sinatra](#sinatra) | Yes | Yes |
| [Grape](#grape) | No | Yes |
| [Roda](#roda) | Via plugin | Via plugin |
| [Padrino](#padrino) | Yes | Yes |
| [Hanami](#hanami) | Via plugin | No |
| [Cuba](#cuba) | Via plugin | No |

## Libraries

### Rails

[GitHub](https://github.com/rails/rails) · [RubyGems](https://rubygems.org/gems/rails) · [Docs](https://raw.githubusercontent.com/rails/rails/3f290b759c8e2ffe7c257951b1255740751355e4/README.md)

Provides an integrated model, view, and controller framework for database-backed web applications.

- Downloads / mo: 819394975
- Stars: 59.1K
- Last release: 8.1.4.1
- License: MIT
- Capabilities: [From the Rails docs](https://raw.githubusercontent.com/rails/rails/3f290b759c8e2ffe7c257951b1255740751355e4/README.md)

**Strengths**

- **Integrates models, views, and controllers.** Build database-backed applications within one coordinated framework.
- **Serves HTML and JSON responses.** Return templates or structured data from a controller.

**Watch out for**

- **Redirects do not halt execution.** Return explicitly when later action code should not run.
- **Streaming uses a separate thread.** Keep shared request state thread-safe.

```sh
gem install rails
```

**huginn/huginn** (50.6K stars)

[huginn/huginn](https://github.com/huginn/huginn) 

```ruby
def show
    @agent = current_user.agents.find(params[:id])

    respond_to do |format|
      format.html
      format.json { render json: @agent }
    end
  end
```

[app/controllers/agents_controller.rb](https://github.com/huginn/huginn/blob/639c050b2bf4e14ef9983012af99dfc1dc68b334/app/controllers/agents_controller.rb#L149-L156) · [More projects using Rails →](https://dashboard.exa.ai/playground/search?q=Ruby%20applications%20using%20rails%20for%20controller%20HTML%20JSON%20responses%2C%20dashboard%20rendering%2C%20request%20lifecycle%20and%20explicit%20response%20termination&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```ruby
rails new myapp
cd myapp
bin/rails server

```

From [README.md](https://raw.githubusercontent.com/rails/rails/3f290b759c8e2ffe7c257951b1255740751355e4/README.md)

### Sinatra

[GitHub](https://github.com/sinatra/sinatra) · [RubyGems](https://rubygems.org/gems/sinatra) · [Docs](https://raw.githubusercontent.com/sinatra/sinatra/ebcaff20b358ad44948dfb23f7419087e592f0ba/README.md)

Defines web application routes using Ruby blocks and Rack-compatible application classes.

- Downloads / mo: 364942330
- Stars: 12.5K
- Last release: 4.2.2
- License: MIT
- Capabilities: [From the Sinatra docs](https://raw.githubusercontent.com/sinatra/sinatra/ebcaff20b358ad44948dfb23f7419087e592f0ba/README.md)

**Strengths**

- **Declares routes beside handler code.** Pair an HTTP method and path with a Ruby block.
- **Hosts several modular apps together.** Subclass Sinatra::Base for multiple apps in one Ruby process.

**Watch out for**

- **Earlier matching routes win.** Put specific routes before broader patterns.
- **Changes require reload or restart.** Restart the process or add a code reloader.

```sh
gem install sinatra rackup puma
```

**resque/resque** (9.5K stars)

[resque/resque](https://github.com/resque/resque) 

```ruby
def show(page, layout = true)
      response["Cache-Control"] = "max-age=0, private, must-revalidate"
      begin
        erb page.to_sym, {:layout => layout}, :resque => Resque
      rescue Errno::ECONNREFUSED
        erb :error, {:layout => false}, :error => "Can't connect to Redis! (#{Resque.redis_id})"
      end
    end
```

[lib/resque/server.rb](https://github.com/resque/resque/blob/249378589ff04452139a4bd9423df587f837c377/lib/resque/server.rb#L45-L52) · [More projects using Sinatra →](https://dashboard.exa.ai/playground/search?q=Ruby%20applications%20using%20sinatra%20for%20controller%20HTML%20JSON%20responses%2C%20dashboard%20rendering%2C%20request%20lifecycle%20and%20explicit%20response%20termination&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```ruby
require 'sinatra'
get '/' do
  'Hello world!'
end

```

From [README.md](https://raw.githubusercontent.com/sinatra/sinatra/ebcaff20b358ad44948dfb23f7419087e592f0ba/README.md)

### Grape

[GitHub](https://github.com/ruby-grape/grape) · [RubyGems](https://rubygems.org/gems/grape) · [Docs](https://raw.githubusercontent.com/ruby-grape/grape/1e2a840056895db547e9c73d1e93d88f947c045c/README.md)

Provides a Ruby framework for API development.

- Downloads / mo: 87867545
- Stars: 10.0K
- Last release: 4.1.0
- License: MIT
- Capabilities: [From the Grape docs](https://raw.githubusercontent.com/ruby-grape/grape/1e2a840056895db547e9c73d1e93d88f947c045c/README.md)

```sh
gem install grape
```

**Quickstart**

```ruby
require 'grape'
class App < Grape::API
  format :json
  get :hello do
    { hello: 'world' }
  end
end
run App

```

From [README.md](https://raw.githubusercontent.com/ruby-grape/grape/1e2a840056895db547e9c73d1e93d88f947c045c/README.md) · [Find projects using Grape →](https://dashboard.exa.ai/playground/search?q=grape%20GitHub%20projects)

### Roda

[GitHub](https://github.com/jeremyevans/roda) · [RubyGems](https://rubygems.org/gems/roda) · [Docs](https://raw.githubusercontent.com/jeremyevans/roda/f33be04bb2ca981f31b369af23dc215942536052/README.rdoc)

Matches requests through a Ruby routing tree with optional feature plugins.

- Downloads / mo: 22731529
- Stars: 2.2K
- Last release: 3.110.0
- License: MIT
- Capabilities: [From the Roda docs](https://raw.githubusercontent.com/jeremyevans/roda/f33be04bb2ca981f31b369af23dc215942536052/README.rdoc)

**Strengths**

- **Shares work across routing branches.** Set common state once before handling nested paths.
- **Adds layouts through render plugin.** Use view to apply layouts around rendered templates.

**Watch out for**

- **Empty responses default to 404.** Set an explicit status for successful responses with empty bodies.
- **Route introspection needs another plugin.** Add roda-route_list and annotate routes to inspect them.

```sh
gem install roda
```

**jeremyevans/rodauth** (1.9K stars)

[jeremyevans/rodauth](https://github.com/jeremyevans/rodauth) 

```ruby
def return_response(body=nil)
      response.write(body) if body
      request.halt
    end
```

[lib/rodauth/features/base.rb](https://github.com/jeremyevans/rodauth/blob/3db76b45ddd619301fa094038d3010329d44f784/lib/rodauth/features/base.rb#L733-L736) · [More projects using Roda →](https://dashboard.exa.ai/playground/search?q=Ruby%20applications%20using%20roda%20for%20controller%20HTML%20JSON%20responses%2C%20dashboard%20rendering%2C%20request%20lifecycle%20and%20explicit%20response%20termination&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```ruby
require "roda"
class App < Roda
  route do |r|
    r.root { "Hello world!" }
  end
end
run App

```

From [README.rdoc](https://raw.githubusercontent.com/jeremyevans/roda/f33be04bb2ca981f31b369af23dc215942536052/README.rdoc)

### Padrino

[GitHub](https://github.com/padrino/padrino-framework) · [RubyGems](https://rubygems.org/gems/padrino) · [Docs](https://raw.githubusercontent.com/padrino/padrino-framework/7ee496fb3459df7c5348cecaa4ced685aa439f11/README.rdoc)

Provides a full-stack framework on top of Sinatra.

- Downloads / mo: 1744337
- Stars: 3.4K
- Last release: 0.18.5
- License: MIT
- Capabilities: [From the Padrino docs](https://raw.githubusercontent.com/padrino/padrino-framework/7ee496fb3459df7c5348cecaa4ced685aa439f11/README.rdoc)

```sh
gem install padrino
```

**Quickstart**

```ruby
require 'padrino-core'
class App < Padrino::Application
  get('/') { 'Hello world!' }
end
run App

```

From [README.rdoc](https://raw.githubusercontent.com/padrino/padrino-framework/7ee496fb3459df7c5348cecaa4ced685aa439f11/README.rdoc) · [Find projects using Padrino →](https://dashboard.exa.ai/playground/search?q=padrino%20GitHub%20projects)

### Hanami

[GitHub](https://github.com/hanami/hanami) · [RubyGems](https://rubygems.org/gems/hanami) · [Docs](https://raw.githubusercontent.com/hanami/hanami/928b25a79adf1b60677c16cf9fa3d303eb1fb247/README.md)

Combines separate routing, action, view, database, and asset libraries into a full-stack framework.

- Downloads / mo: 1287349
- Stars: 6.4K
- Last release: 3.0.2
- License: MIT
- Capabilities: [From the Hanami docs](https://raw.githubusercontent.com/hanami/hanami/928b25a79adf1b60677c16cf9fa3d303eb1fb247/README.md)

**Strengths**

- **Keeps actions in separate classes.** Give each endpoint its own request-handling object.
- **Escapes rendered template strings automatically.** Ordinary strings are escaped; HTML-safe strings bypass escaping.

**Watch out for**

- **Invalid parameters need explicit handling.** Check request.params.valid? and halt before using invalid input.

```sh
gem install hanami
```

**usetrmnl/terminus** (794 stars)

[usetrmnl/terminus](https://github.com/usetrmnl/terminus) 

```ruby
def git_latest_link
        settings = Hanami.app[:settings]

        link_to "Latest (ahead of #{settings.git_tag})",
                "https://github.com/usetrmnl/terminus/commit/#{settings.git_latest_sha}",
                class: :link
      end
```

[app/views/helpers.rb](https://github.com/usetrmnl/terminus/blob/b61d950031ffe4e3b580ed0f5f8eff7daff270de/app/views/helpers.rb#L58-L64) · [More projects using Hanami →](https://dashboard.exa.ai/playground/search?q=Ruby%20applications%20using%20hanami%20for%20controller%20HTML%20JSON%20responses%2C%20dashboard%20rendering%2C%20request%20lifecycle%20and%20explicit%20response%20termination&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```ruby
hanami new bookshelf
cd bookshelf && bundle
bundle exec hanami dev

```

From [README.md](https://raw.githubusercontent.com/hanami/hanami/928b25a79adf1b60677c16cf9fa3d303eb1fb247/README.md)

### Cuba

[GitHub](https://github.com/soveran/cuba) · [RubyGems](https://rubygems.org/gems/cuba) · [Docs](https://raw.githubusercontent.com/soveran/cuba/6b2b1e78ef16101d6b3726a87f44eaa8276e2ab7/README.md)

Cuba is a microframework for web applications.

- Downloads / mo: 543682
- Stars: 1.4K
- Last release: 4.0.3
- License: MIT
- Capabilities: [From the Cuba docs](https://raw.githubusercontent.com/soveran/cuba/6b2b1e78ef16101d6b3726a87f44eaa8276e2ab7/README.md)

```sh
gem install cuba
```

**Quickstart**

```ruby
require "cuba"
Cuba.define do
  on root do
    res.write "Hello world!"
  end
end
run Cuba

```

From [README.md](https://raw.githubusercontent.com/soveran/cuba/6b2b1e78ef16101d6b3726a87f44eaa8276e2ab7/README.md) · [Find projects using Cuba →](https://dashboard.exa.ai/playground/search?q=cuba%20GitHub%20projects)

## FAQ

### Which Ruby web framework should I use?

[Rails](#rails) suits database-backed applications built in one integrated framework. [Sinatra](#sinatra) suits small apps that pair routes with Ruby blocks. [Roda](#roda) suits apps that share work across nested routing branches.

### What is Ruby on Rails?

[Rails](#rails) provides an integrated model, view, and controller framework for database-backed web applications. Its controllers return HTML templates or JSON.

### What is Sinatra?

[Sinatra](#sinatra) defines web application routes with Ruby blocks. Subclasses of Sinatra::Base run several modular apps in one Ruby process.

### What is Hanami?

[Hanami](#hanami) combines separate routing, action, view, database, and asset libraries into a full-stack framework. Each endpoint gets its own action class.

### Rails vs Sinatra: which should I use?

[Rails](#rails) suits applications that want models, views, and controllers in one framework. [Sinatra](#sinatra) suits apps that declare routes beside handler code.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Ruby web frameworks Rails Sinatra Roda Hanami code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
