Skip to content

RuncoboThe batteries-included web framework for Crystal

One class per endpoint. Typed input, compiled templates and a SQL-first ORM — all checked by the compiler.

Runcobo

One endpoint, one folder ​

The route, the input it accepts, the logic and the response sit side by side — open one folder and the whole endpoint is in front of you.

src/actions/posts
create_post.cr
create_post_contract.cr
create_post.jbuilder
show_post.cr
show_post_contract.cr
show_post.jbuilder
crystal
class Posts::CreatePost < Blog::BaseAction
  post "/posts"

  call do
    input = validate(CreatePostContract)
    post = store.create_post(author_id: input.author_id, title: input.title)
    render status_code: 201
  end
end
crystal
class Posts::CreatePostContract < RequestValidation::Contract
  schema do
    required :author_id, Int64
    required :title, String, filled: true, max_size: 200
  end
end
crystal
json.id post.id
json.title post.title

How a request flows ​

Every action reads the same way, top to bottom.

Match the route
post "/posts"
Validate input
validate(CreatePostContract)
Invalid? A 422 goes back and call stops.
Run your logic
store.create_post(...)
A typed method generated from SQL.
Render
create_post.jbuilder
Compiled into the binary.

Start in a minute ​

shard.yml
yaml
dependencies:
  runcobo:
    github: runcobo/runcobo
    version: ~> 3.1
sh
shards install       # also builds bin/cobo

Build your first API →

Released under the MIT License.