What is Runcobo?
Runcobo is a batteries-included web framework for Crystal. It ships everything you need to go from a first route to a production deploy — typed input validation, JSON and HTML views, uploads, static files, logging and error handling, plus a toolchain for databases, migrations and SQL code generation.
It's built around one idea: everything about an endpoint lives together — its route, the input it accepts, its logic and its response, side by side in one folder.
class Posts::CreatePost < Blog::BaseAction
post "/posts" # where it lives
call do
input = validate(CreatePostContract) # what it accepts
post = store.create_post(author_id: input.author_id, title: input.title)
render status_code: 201 # what it returns
end
endThe route, the accepted input and the logic sit in one class. Its contract and its response template sit right beside it, in the same folder:
CreatePostContract(increate_post_contract.cr) declares the fields the endpoint accepts and their types — Request Contracts.rendersendscreate_post.jbuilder, which lists the response fields — Views.store.create_postis a typed method generated from a SQL query — Database Access.Blog::BaseActionis your application's base class for every action — Project Structure.
Core ideas
One endpoint, one folder
An action, its contract and its template sit side by side. Run cobo routes to find the code behind any URL.
Typed input at the boundary
The first line of call validates the request. After it, input.title is a String; bad requests get a 422.
Checked by the compiler
Routes, contracts, templates and layouts compile into your binary. A missing template is a build error, not an incident.
A SQL-first ORM
crsql turns the SQL you write into typed methods for PostgreSQL, MySQL or SQLite.
One way to do each thing
One way to read input, one way to render, one way to pass dependencies — so every Runcobo app reads the same.
Explicit wiring
Middleware is a plain array you can read and reorder. Dependencies reach actions through the request context, not globals.
What's in the box
| Area | What you get |
|---|---|
| Routing | Routes declared on actions, typed path parameters, custom HTTP methods, route listing |
| Input | Request contracts for path, query, form and JSON input — types, constraints, nested objects, cross-field rules |
| Uploads | Multipart uploads with size, file and field limits, atomic saving and automatic cleanup |
| Output | JSON, text, files, redirects, empty responses |
| Views | Compile-time Jbuilder (JSON) and Water (HTML) templates, with layouts and partials |
| Server | Request IDs, structured logging, error handling, static files, graceful shutdown, TLS, trusted proxies |
| Database tooling | Local databases for PostgreSQL, MySQL and SQLite, SQL migrations with verified rollbacks, staging/production migration commands |
| ORM | crsql: typed query methods generated from SQL for PostgreSQL, MySQL and SQLite, with a CI check |
| Tooling | One CLI, cobo: dev server, console, script runner, project tasks, test runner |