Skip to content

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:

sh
crystal --version
shards --version

Create a project ​

Create
crystal init app blog
Add Runcobo
shards install
Also builds bin/cobo.
Set up
bin/cobo init
Turns it into a Runcobo app.
Run
bin/cobo dev

Create a Crystal project:

sh
crystal init app blog
cd blog

Add Runcobo to shard.yml:

shard.yml
yaml
dependencies:
  runcobo:
    github: runcobo/runcobo
    version: ~> 3.1

Install it. This also builds the cobo CLI into bin/cobo:

sh
shards install

Set the project up as a Runcobo application, choosing its database:

sh
bin/cobo init                       # PostgreSQL
bin/cobo init --database sqlite     # or mysql, or none

cobo 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:

sh
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:

sh
git clone https://github.com/runcobo/runcobo.git
cd runcobo
make install INSTALL_DIR="$HOME/.local/bin"   # installs cobo and runcobo-dbmate

See 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.

Released under the MIT License.