Serrano is a minimal Rack-based Ruby microframework with an explicit HTTP contract and no hidden behavior.
Serrano provides only the HTTP runtime:
- route registration and matching (
GET,POST,PUT,DELETE) - controller dispatching
- request and response wrappers
- strict error-to-response mapping
Serrano is intentionally small. It does not include:
- an ORM
- middleware stacks
- dependency injection containers
- architecture conventions beyond thin controller/service/repository layering
If you want database or CRUD tooling, use the optional CLI and example scaffolding layer.
- Supported methods:
GET,POST,PUT,DELETE - Route DSL:
get(path, controller, action)post(path, controller, action)put(path, controller, action)delete(path, controller, action)
- Controller return values:
Hash=> JSON response, status200String=>text/plain, status200Serrano::Response=> use as-is- other values =>
500with JSON error
- Missing route =>
404 Not Found - Missing method for existing path =>
405 Method Not Allowedwith lowercaseallowheader and supported methods - Controller exceptions =>
500JSON error response. Example:{"error":"RuntimeError: boom"}
See EXAMPLES.md for full request/response demos.
-
Ruby
>= 3.2 -
Published gem:
serrano-vkon RubyGems (~> 0.1.2)
-
Add to your app Gemfile:
# Gemfile
source "https://rubygems.org"
gem 'serrano-vk', '~> 0.1.2'Run:
bundle installconfig.ru:
# frozen_string_literal: true
require 'serrano'
class UsersController
def index(_request)
{ users: [] }
end
end
app = Serrano::Application.new
app.get('/users', UsersController, :index)
run appRun:
bundle exec rackupQuick check:
curl -i http://localhost:9292/usersIf you used serrano new, routes are not present until you generate resources or define them yourself.
Without matching routes, responses are 404 (path-aware payload).
The CLI is optional and depends on the core runtime.
serrano new APP_NAME [--minimal] [--db=sqlite|postgres|mysql]
serrano generate resource Article title:string content:text
serrano generate controller Name
serrano generate service Namespace::Name
serrano generate repository Namenewcreates project files (minimal mode and DB options are orthogonal)generate resourcecreates controller, services (index,show,create,update,destroy), repository, entity, migrationgenerate resourceupdatesconfig.ruwith requiredrequire_relativeand route lines when possible.
Using controller params:
curl -i "http://localhost:9292/users/12?foo=abc"
curl -i -X POST "http://localhost:9292/articles" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data "title=First&content=Hello"For full command usage with sample outputs and full flows, read EXAMPLES.md.
Core runtime:
lib/serrano/
application.rb
cli/
dispatcher.rb
request.rb
response.rb
router.rb
Example app (optional):
app/
controllers/
services/
repositories/
entities/
config/
db.rb
config.ru
Core tests are isolated under:
test/core/*
Run all tests:
bundle exec rake testCurrent version: 0.1.2 (gem: serrano-vk)
Ruby requirement: >= 3.2