Installation
Requirements
- Crystal
>= 1.22.0, < 2.0.0— see the official install guide. - Shards, Crystal's dependency manager (ships with Crystal).
- For a database: sqlc
1.31.1, and a PostgreSQL or MySQL server you run. SQLite needs no server.
Check your setup:
crystal --version
shards --versionCreate a project
crystal init app blogshards installbin/cobo initbin/cobo devCreate a Crystal project:
crystal init app blog
cd blogAdd Runcobo to shard.yml:
dependencies:
runcobo:
github: runcobo/runcobo
version: ~> 3.1Install it. This also builds the cobo CLI into bin/cobo:
shards installSet the project up as a Runcobo application, choosing its database:
bin/cobo init # PostgreSQL
bin/cobo init --database sqlite # or mysql, or nonecobo init writes the standard layout — src/app.cr and src/main.cr, a base action, a home endpoint with its template and spec, runcobo.yml and, with a database, sqlc.yaml and db/ — adds the database driver to shard.yml, installs it and generates the query code. It replaces the placeholder files crystal init wrote, and refuses to overwrite anything else.
Start it:
bin/cobo dev
curl localhost:3000/ # {"name":"blog","database":"ok"}The home endpoint runs one query, SELECT 1, to show the database is reachable. With PostgreSQL or MySQL, cobo connects to the server on 127.0.0.1 as postgres or root; set database_user and database_port in runcobo.yml if yours differs.
The cobo CLI
cobo is Runcobo's command-line toolchain. It runs the development server, lists routes, creates local databases, runs migrations and generates typed SQL queries. It's used during development and deployment; your compiled application doesn't load it.
Shards compiles it when Runcobo is installed or upgraded, which adds a few seconds to that shards install. Later installs with no changes reuse the existing binary. bin/ is in the .gitignore that crystal init generates, so the binary isn't committed.
To use cobo from anywhere instead, install it system-wide from a checkout of the framework:
git clone https://github.com/runcobo/runcobo.git
cd runcobo
make install INSTALL_DIR="$HOME/.local/bin" # installs cobo and runcobo-dbmateSee the CLI overview for what each command does.
What runs at install time
Installing Runcobo runs one script: it compiles cobo from the installed source. Skip it with shards install --skip-postinstall --skip-executables (both flags: with only the first, Shards fails because bin/cobo was never built). Database tooling (dbmate) and the SQL code generator are fetched only when you first run a command that needs them.