The open core for manufacturing
<a href="https://discord.gg/yGUJWhNqzy">Discord</a>
·
<a href="https://carbon.ms">Website</a>
·
<a href="https://docs.carbon.ms">Documentation</a>
We built Carbon after years of building end-to-end manufacturing systems with off-the-shelf solutions. We realized that:
We built Carbon to solve these problems ☝️
Carbon is designed to make it easy for you to extend the platform by building your own apps through our API. We provide some examples to get you started in the examples folder.
Features:
Technical highlights:
The monorepo follows the Turborepo convention of grouping packages into one of two folders.
/apps for applications/packages for shared code/apps| Package Name | Description | How to run |
|---|---|---|
erp |
ERP Application | pnpm dev (boots stack + ERP via crbn up picker) |
mes |
MES | pnpm dev (select MES in picker, or both) |
academy |
Academy | pnpm dev:academy |
starter |
Starter | pnpm dev:starter |
pnpm dev runs the per-worktree dev CLI (crbn up). ERP and MES are first-class — the CLI boots the docker stack, applies migrations, regenerates types/swagger, and spawns the selected apps behind portless. Academy and starter are standalone Turborepo entries.
/packages| Package Name | Description |
|---|---|
@carbon/database |
Database schema, migrations and types |
@carbon/documents |
Transactional PDFs and email templates |
@carbon/ee |
Integration definitions and configurations |
@carbon/config |
Shared configuration (vitest, tsconfig, tailwind) across apps and packages |
@carbon/jobs |
Background jobs and workers |
@carbon/logger |
Shared logger used across apps |
@carbon/react |
Shared web-based UI components |
@carbon/kv |
Redis cache client |
@carbon/lib |
Third-party client libraries (slack, resend) |
@carbon/stripe |
Stripe integration |
@carbon/utils |
Shared utility functions used across apps and packages |
sh
git clone https://github.com/crbnos/carbon.git
sh
cd carbon
Make sure that you have Docker installed on your system since this monorepo uses the Docker for local development.
In addition you must configure the following external services:
| Service | Purpose | URL |
|---|---|---|
| Posthog | Product analytics platform | https://us.posthog.com/signup |
| Stripe | Payments service | https://dashboard.stripe.com/login |
| Resend | Email service | https://resend.com |
Posthog has a free tier which should be plenty to support local development. If you're self hosting and you don't want to use Posthog, it's pretty easy to remove the analytics.
First download and initialize the repository dependencies.
This repo uses pnpm as its package manager. Enable Corepack so the correct pnpm version (pinned via packageManager in package.json) is used automatically:
$ corepack enable # one-time: activates pnpm shim from packageManager field
Then install dependencies:
$ nvm use # use node v22
$ pnpm install # install dependencies
The dev stack (Postgres, GoTrue, Kong, Storage, Inngest, Inbucket, Studio, Realtime) is booted later by crbn up — see Local dev CLI below. There is no separate "start the database" step.
crbn)crbn is a small CLI at packages/dev/bin/crbn that wraps two things:
carbon-<slug> compose project. Routing is handled by portless (a local HTTPS reverse proxy that serves *.dev hostnames on :443 with locally-trusted certs — installed automatically on first crbn up).Windows users: the dev CLI (
crbn,setup.sh) is POSIX-only and expects WSL or Git Bash. Native cmd.exe / PowerShell shells are not supported. From a WSL/Git Bash prompt, the standard flow (./setup.sh,pnpm dev,crbn checkout …) works the same as on macOS/Linux.
Run setup.sh once to put crbn on your $PATH and install the crbn shell function (so crbn checkout can change cwd):
$ ./setup.sh # writes a sentinel block to ~/.zshrc or ~/.bashrc
$ source ~/.zshrc # or open a new shell
$ crbn # shows commands
Common flows:
$ crbn checkout sid/cool-thing # cd into worktree (creates if missing,
# auto-fetches from origin if needed)
$ crbn checkout -b feat/new-thing # new branch off origin/main + worktree
$ crbn checkout sid/cool-thing --up # …and boot the stack inside it
$ crbn checkout 760 # fetch GitHub PR #760 into a `pr-760`
# branch + worktree (fork PRs work too)
$ crbn copy # re-sync .env from main checkout
$ crbn up | down | reset | status # per-worktree compose stack
$ crbn new | list | remove # interactive worktree management
crbn up flags:
--no-migrate — skip supabase migration up (use when schema is already current and you just want to re-boot containers fast)--no-regen — skip regenerating packages/database/src/types.ts + swagger-docs-schema.ts (auto-skipped when --no-migrate is set, since no schema change implies no type drift)Files synced by crbn copy are listed under package.json#crbn.copy (defaults to [".env"]). To uninstall the rc block: ./setup.sh --uninstall.
Create an .env file and copy the contents of .env.example file into it
$ cp ./.env.example ./.env
Social Sign In: Signing in requires you to setup one of two methods:
Email requires a Resend API key (you'll set this up later on)
Authorized JavaScript origins to https://api.carbon.devAuthorized redirect URIs to https://api.carbon.dev/auth/v1/callbackhttps://<worktree>.api.dev) for app traffic, and there is one stable alias https://api.carbon.dev registered on whichever worktree is currently up. The stable alias exists only so OAuth callbacks have a single registered redirect URI — one Google Console entry covers every worktree. Day-to-day, your app talks to its worktree-scoped URL; only the OAuth callback hits the stable alias.SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID="******.apps.googleusercontent.com"SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_SECRET="GOCSPX-****************"
Supabase: Backend services run inside the per-worktree docker stack — crbn up boots them and writes everything you need into .env.local automatically:
SUPABASE_URL — portless alias (e.g. https://local-dev.api.dev)
SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY — keys minted per-worktree from a random SUPABASE_JWT_SECRETSUPABASE_DB_URL — direct Postgres URL on a dynamic port.env.local is generated; do not commit it or hand-edit values that came from crbn up (they are re-derived on each boot). Put genuine secrets (OAuth client IDs, Stripe keys, Resend) in .env only.
Run crbn status at any time to see the live port assignment and the URLs portless is serving.
Redis (Caching): No setup needed for local dev — crbn up boots a shared Redis container and writes REDIS_URL into .env.local automatically (each worktree gets its own logical Redis DB). For self-hosted production, set REDIS_URL to any Redis-compatible endpoint (Upstash, AWS ElastiCache, etc.) in your prod environment.
Posthog (Analytics): In Posthog go to https://[region].posthog.com/project/[project-id]/settings/project-details to find your Project ID and Project API key:
POSTHOG_API_HOST=[https://[region].posthog.com]
POSTHOG_PROJECT_PUBLIC_KEY=[Project API Key starting 'phc*']
Stripe (Payment service) - Create a stripe account, add a STRIPE_SECRET_KEY from the Stripe Settings > Developers interface
STRIPE_SECRET_KEY="sk_test_*************"
Resend (Email service) - Create a Resend account and configure:
RESEND_API_KEY="re_**********"
RESEND_DOMAIN="carbon.ms" (or your domain, no trailing slashes or protocols)RESEND_AUDIENCE_ID="*****" (Optional - required for contact management in packages/jobs)Resend is used for transactional emails (user invitations, email verification, onboarding). All three variables are stored in packages/auth/src/config/env.ts.
Finally, boot the stack and the apps:
$ pnpm dev # equivalent to `crbn up` — picker lets you choose ERP/MES
crbn up prints a summary box with the live URLs once the stack is healthy. Defaults look like:
| Surface | URL |
|---|---|
| ERP | https://<worktree>.erp.dev |
| MES | https://<worktree>.mes.dev |
| Supabase API | https://<worktree>.api.dev |
$ claude mcp add carbon \
-- python -m otcore.mcp_server <graph>