FAQ
Requests
Does a GET request accept a JSON body?
Yes. validate reads the body of every request, GET and HEAD included, with the same rules as POST:
curl -X GET localhost:3000/search -H 'Content-Type: application/json' -d '{"q":"crystal","tags":["web"]}'HTTP doesn't forbid a GET body, but it gives it no defined meaning, so some proxies, caches and client libraries drop it (browsers' fetch refuses to send one). Use it for clients you control, such as service-to-service calls. For public APIs and anything cached, prefer the query string — arrays as repeated keys (?tag=a&tag=b) — or a POST endpoint such as POST /posts/search.
Where do path, query and body values go when they share a name?
A path parameter always wins, a JSON body value replaces a query value, and a form value sent alongside a query value fails with multiple_values. See Reading input.
How do I tell "not sent" from null in a PATCH?
Each contract field has a <name>_present? method. See Missing vs null and the partial update recipe.
How big can a request body be?
1 MiB by default; larger bodies get a 413. Change it per action — see Body size limit.
Projects
What is the "You're on Runcobo!" page?
A new application shows it at / until it declares its first route, so bin/cobo dev has something to open right after cobo init. Add any action and it's gone; an application with routes never shows it.
Can I use Runcobo without a database?
Yes. Run bin/cobo init --database none, or skip cobo init entirely and write a single file that calls Runcobo.start, as in the Quick Start.
Which databases are supported?
PostgreSQL, MySQL and SQLite, through crsql. sqlc.yaml declares the engine, and every cobo db command follows it.
Is there an ORM with models and associations?
No. You write SQL, and bin/cobo generate turns each named query into a typed Crystal method. Nothing is loaded lazily, so there are no hidden queries — see Database Access and Avoiding N+1 Queries.
Do I need sqlc or the cobo CLI in production?
No. sqlc and crsql run only when you generate code, and the generated file is committed. The compiled server is a single binary. cobo is a development and deployment tool: your deploy job uses it to apply migrations — see Deployment.
Where does each file go?
Each endpoint is an action, a contract and a template side by side in a business-area folder. See Project Structure, or the blog tutorial for a complete application.
Features
Does Runcobo support WebSockets?
Yes, and server-sent events too. Declare a route with ws "/path" and accept the connection with websocket do |socket| ... end, or stream events from a get route with stream do |events| ... end. Filters and validate run first, and open connections are closed on shutdown — see Real-time.
Are there sessions or cookie authentication?
There's no built-in session store. Read and write cookies through context.response.cookies (Responses) and authenticate in a before filter. If you use cookies for HTML forms, add CSRF protection — see Security.
Background jobs?
Runcobo doesn't include a job queue. Run recurring work as a project task from your scheduler, or use a queue library in a separate process that shares your store.
Can I render HTML, not only JSON?
Yes. Water templates render HTML with layouts and partials, and escape text for you. Jbuilder renders JSON. Both are compiled into the binary.
Development
Why does cobo dev take a few seconds after each save?
Crystal compiles the whole program before running it. cobo dev rebuilds in development mode, which is much faster than --release, and keeps the previous version running until the new one compiles. See cobo dev.
How do I see all routes?
bin/cobo routesWhere are the API docs?
The generated API reference for every class and method is at API Reference.
Coming from another framework
See the guides for Rails, Kemal and Lucky. Each maps the concepts you know to Runcobo's.
Something else?
Open an issue on GitHub.