Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
###############################################################################
# Carbon Swarm stack — NON-SECRET configuration.
#
# Copy to `.env` and fill in. `deploy.sh` sources this and exports it so
# `docker stack deploy` can interpolate ${VARS} in docker-compose.prod.yml. Secrets do NOT live
# here — they are Docker Swarm secrets created by `deploy.sh init` (see README).
###############################################################################
# Absolute path to the Carbon repo checkout on this VPS. Config files and edge
# functions are bind-mounted from here, and the app images are built from it.
CARBON_REPO=/opt/carbon
# Swarm stack name (prefix for services/networks/volumes).
STACK_NAME=carbon
# ── Hostnames (must have DNS A/AAAA records pointing at this VPS) ─────────────
DOMAIN=example.com
ERP_HOST=erp.example.com
MES_HOST=mes.example.com
SUPABASE_HOST=api.example.com
# Optional Supabase Studio host — only if you uncomment the studio block in the
# Caddyfile. Leave blank to keep Studio internal-only (recommended).
STUDIO_HOST=
# Public URLs (https:// + the hosts above). Used by the apps and GoTrue.
ERP_URL=https://erp.example.com
MES_URL=https://mes.example.com
SUPABASE_URL=https://api.example.com
# Email for Let's Encrypt / ACME registration.
[email protected]
# ── App config ───────────────────────────────────────────────────────────────
CARBON_EDITION=community
# true answers every request except /health with a 503 maintenance screen.
# Apply with `deploy.sh deploy`; the apps read it at start.
# MAINTENANCE_MODE=true
# Optional JSON document ({ latestVersion?, announcement? }) shown as a bar in the app.
# SYSTEM_STATUS_URL=https://example.com/status.json
# From-address for app email (envelope sender). The apps share the GOTRUE_SMTP_*
# host/port/user below and the `smtp_password` Docker secret.
SMTP_FROM="Carbon <[email protected]>"
# ── Container images ─────────────────────────────────────────────────────────
# Default: build locally on the VPS (`deploy.sh build`) tagging carbon/<app>:latest.
# To pull prebuilt images instead, set CARBON_REGISTRY and the tags, and run
# `deploy.sh build` will skip building when CARBON_REGISTRY is set.
CARBON_REGISTRY=
CARBON_IMAGE_ERP=carbon/erp:latest
CARBON_IMAGE_MES=carbon/mes:latest
# Runs the migrations: the app images do not carry the Supabase CLI.
CARBON_IMAGE_BOOTSTRAP=carbon/bootstrap:latest
# ── Outbound email (GoTrue auth: invites, magic links) ───────────────────────
# The SMTP password is a Docker secret (`smtp_password`), not set here.
GOTRUE_SMTP_HOST=
GOTRUE_SMTP_PORT=587
GOTRUE_SMTP_USER=
[email protected]
GOTRUE_SMTP_SENDER_NAME=Carbon
GOTRUE_DISABLE_SIGNUP=true
# Sign-in methods shown on the login screen (comma-separated): email,google,azure,passkey.
# Default is email,google,azure. google/azure also need the OAuth creds below.
AUTH_PROVIDERS=email,google,azure
# ── OAuth (optional; leave disabled unless configured) ───────────────────────
GOOGLE_AUTH_ENABLED=false
SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID=
SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_SECRET=
SUPABASE_AUTH_EXTERNAL_GOOGLE_REDIRECT_URI=
AZURE_AUTH_ENABLED=false
SUPABASE_AUTH_EXTERNAL_AZURE_CLIENT_ID=
SUPABASE_AUTH_EXTERNAL_AZURE_CLIENT_SECRET=
SUPABASE_AUTH_EXTERNAL_AZURE_REDIRECT_URI=
# ── Supabase Studio ──────────────────────────────────────────────────────────
# Set to 0 to not run the admin UI at all.
STUDIO_REPLICAS=1
# ── Postgres tuning (size to your VPS; see postgres/02-performance.sh) ────────
# Rules of thumb: shared_buffers ~25% RAM, effective_cache_size ~50-75% RAM,
# work_mem * max_connections under ~25% RAM. Defaults suit a ~4 GB host.
PG_MEMORY_LIMIT=2048M
PG_MAX_CONNECTIONS=100
PG_SHARED_BUFFERS=512MB
PG_EFFECTIVE_CACHE_SIZE=1536MB
PG_WORK_MEM=8MB
PG_MAINTENANCE_WORK_MEM=128MB
# ── Realtime (internal keys; override for extra hygiene) ──────────────────────
REALTIME_SECRET_KEY_BASE=
REALTIME_DB_ENC_KEY=
# ── Edge functions ───────────────────────────────────────────────────────────
# Verify the JWT signature of every edge-function call (the gateway check Supabase
# Cloud does). Keep it on: Kong forwards /functions/v1/ without checking tokens.
EDGE_VERIFY_JWT=true
# ── Enterprise SAML SSO ──────────────────────────────────────────────────────
# Generate the key with:
# openssl genpkey -algorithm RSA -out /tmp/pk.pem -quiet && \
# openssl rsa -in /tmp/pk.pem -outform DER -traditional -out /tmp/pk.der && \
# base64 -w 0 /tmp/pk.der
# MUST be base64-encoded PKCS#1 DER (the -traditional flag), min 2048-bit.
SAML_ENABLED=false
SAML_PRIVATE_KEY=