Carrier
Quickstart

Install the compiler. Write .carrier. Ship a service.

The compiler is a Cargo workspace. Every command below is present in the carrierc CLI today.

Step 1

Clone and build the compiler

# clone the repo
$ git clone https://github.com/walknorth/carrier.git
$ cd carrier
$
# build & test the compiler workspace
$ cargo test
$ cargo run -p carrierc -- --help
Requirements
Rust toolchain (edition 2024). Postgres 14+ for services that use models, CRUD, policy RLS, jobs, schedules, events, or idempotency.
Optional
Redis — used by cache.* and redis.* when REDIS_URL is configured. Without it the cache falls back to in-memory.
Step 2

Scaffold a project, check, and build

Project layout
my-service/
carrier.toml
src/
main.carrier
carrier.toml
[package]
name = "my-service"
version = "0.1.0"
$ carrier new my-service
$ cd my-service
$
# validate types, CRUD, auth, policies, and more
$ carrier check
$
# generate rust + cargo + native binary
$ carrier build
$
# run the service (or ./.carrier/build/<binary>)
$ carrier run
Step 3

Write your first service

Copy the hello-carrier example into src/main.carrier. It uses only Tier 1 constructs and demonstrates service, auth jwt, type, and route.

src/main.carrier
Tier 1
service App {
openapi { title: "Hello Carrier API" version: "0.1.0" }
server { host: env("HOST", "0.0.0.0") port: env_int("PORT", 3000) }
}
auth jwt Auth {
issuer: env("JWT_ISSUER", "carrier")
audience: env("JWT_AUDIENCE", "carrier-users")
secret: env("JWT_SECRET", "local-dev-secret")
}
type RegisterRequest {
email: String @email
name: String @length(min: 2, max: 100)
password: String @length(min: 8)
}
type AuthTokens { access_token: String refresh_token: String }
route POST "/auth/register" public -> AuthTokens {
input: RegisterRequest
handler {
let user = auth.register(
email: input.email, name: input.name, password: input.password
)
return auth.issue_tokens(user.id)
}
}
route GET "/me" protect Auth -> MeResponse {
handler { return auth.current_user() }
}
Iteratezsh
$ carrier dev # watch + rebuild
$
$ carrier openapi > openapi.json
$ carrier fmt
$ carrier migrate generate
$ carrier migrate up
$ carrier clean
Step 4

Where to read next

Every item links back to the real repo content. Pick the tier that matches the shape of your service.

CLI

All commands, one reference

Implemented today. Every one of these runs against every example in the repo.

  • carrier newscaffold a new project
  • carrier checkvalidate types, CRUD, auth, policy, built-ins
  • carrier buildgenerate rust + cargo-build native binary
  • carrier runrun the compiled binary
  • carrier devwatch & rebuild on changes
  • carrier fmtformat .carrier source
  • carrier openapiemit OpenAPI JSON
  • carrier cleanremove .carrier/ artifacts
  • carrier migrate generateproduce SQL migrations & schema snapshots
  • carrier migrate upapply generated migrations