Local development

Run the full Carbon stack locally with the crbn CLI — isolated per-worktree environments.

Carbon is a pnpm + Turborepo monorepo — the ERP and MES apps plus their shared packages. Local development runs on the crbn CLI (in packages/dev), a per-worktree environment manager: every git worktree gets its own compose stack — Postgres, Kong, Supabase, Inngest, and Inbucket (mail) — with its own ports, Redis database, and JWT credentials. So you can work several branches at once without their stacks colliding.

Setup

Add crbn to your PATH (it installs a small shell wrapper):

source ./setup.sh

Bring up the stack

From any worktree:

crbn up

This boots the compose stack and the ERP and MES dev servers, and generates a .env.local with per-worktree ports, local Supabase keys, REDIS_URL, Inngest dev settings, and DEV_BYPASS_EMAIL so you can sign in without a magic link. Reach the apps at their portless .dev URLs or at localhost:<port>.

HEADS UP

DEV_BYPASS_EMAIL is local-only — it signs you in as that email with no magic link. Never set it in a deployed environment.

Stack commands

CommandWhat it does
crbn upBoot the compose stack and apps.
crbn up --no-portlessLocalhost mode — fixed ports (API 54321, ERP 3000, MES 3001).
crbn up --no-appsServices only — Postgres, Kong, Supabase, Inngest, mail.
crbn up --no-migrateSkip database migrations on boot.
crbn up --no-regenSkip type and Swagger regeneration.
crbn up --borrowReuse another worktree's already-running containers.
crbn up --pullForce docker compose pull even if images exist locally.
crbn downStop the stack (volumes preserved).
crbn resetWipe volumes and flush the Redis db, then boot again.
crbn migrateApply database migrations against the running stack.
crbn statusShow port assignments and container health.
NOTE

pnpm dev is shorthand for crbn up --no-portless — localhost mode on fixed ports.

Worktrees

Each branch gets an isolated worktree and stack, so several can run side by side.

CommandWhat it does
crbn checkout <branch>Switch into a branch's worktree, creating it if missing (auto-fetches from origin).
crbn checkout -b <branch>Create a new branch and worktree from --base (default HEAD).
crbn checkout <pr-number>Fetch a PR's head into a pr-<num> branch and worktree.
crbn checkout mainReturn to the main checkout (never a separate worktree).
crbn new [branch]Create a worktree interactively.
crbn listList all worktrees with their stack status.
crbn removeMulti-select worktrees to tear down; add --prune to delete the branch too.

Portless vs localhost

By default crbn up uses portless to serve a TLS .dev URL per app (for example erp.<branch>.dev), giving each worktree stable, shareable hostnames. Pass --no-portless — or set CARBON_PORTLESS=0 — for localhost mode on fixed ports:

ServicePort
Supabase API (Kong)54321
ERP3000
MES3001

Sync files from main

A fresh worktree doesn't carry your gitignored local files. Pull them across from the main checkout:

CommandWhat it does
crbn copy <file…>Copy specific file(s) from the main checkout into this worktree.
crbn env syncCopy the files listed in package.json under crbn.copy.

Configuration

Your local settings live in the generated .env.local. See Environment variables for the full configuration surface, and Deployment to self-host on AWS.