Local development

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

Carbon is a pnpm and Turborepo monorepo containing the ERP and MES applications and shared packages. The crbn CLI in packages/dev manages local environments. Each Git worktree receives an isolated Compose stack, ports, Redis database, and JWT credentials, so multiple branches can run concurrently.

Setup

Add crbn to your PATH

Source the setup script to install the shell wrapper:

bash
source ./setup.sh

Bring up the stack

From a worktree, start the Compose services and the ERP and MES development servers:

bash
crbn up

This generates .env.local with worktree-specific ports, local Supabase keys, REDIS_URL, Inngest development settings, and DEV_BYPASS_EMAIL.

Reach the apps

Open the applications at their portless .dev URLs or 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 assign each application a stable TLS .dev URL, such as erp.<branch>.dev. Pass --no-portless or set CARBON_PORTLESS=0 to use fixed localhost ports:

ServicePort
Supabase API (Kong)54321
ERP3000
MES3001

Sync files from main

A new worktree does not include Git-ignored local files. Copy them 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 Self-hosting to run Carbon on your own infrastructure.