Local development
Install the monorepo, configure local services, and run the workspace development stack.
Use a local source checkout when contributing to LegionCode or testing deployment changes. Hosted product users do not need the monorepo.
Prerequisites
- Node.js 20 LTS
- pnpm 9
- Git
- a Cloudflare account for remote bindings and sandbox work
- a Postgres database reachable through Cloudflare Hyperdrive
- a GitHub OAuth application for authentication testing
Install
1git clone https://github.com/Puneet-Pal-Singh/LegionCode.git2cd LegionCode3pnpm installRun baseline checks before changing code:
1pnpm lint2pnpm check-types3pnpm check:boundariesConfigure
Create apps/brain/.dev.vars from its example and provide GitHub OAuth, session, and credential-encryption secrets. A typical local configuration is:
1GITHUB_REDIRECT_URI=http://localhost:8788/auth/github/callback2FRONTEND_URL=http://localhost:51743MUSCLE_BASE_URL=http://localhost:87874BYOK_CREDENTIAL_ENCRYPTION_KEY=<64-character-hex-key>5BYOK_CREDENTIAL_ENCRYPTION_KEY_VERSION=v1Generate encryption material with openssl rand -hex 32. Never commit .dev.vars.
Configure the Web endpoints in a local .env file when defaults do not match:
1VITE_BRAIN_BASE_URL=http://localhost:87882VITE_MUSCLE_BASE_URL=http://localhost:87873VITE_MUSCLE_WS_URL=ws://localhost:8787Run and verify
Start each service in its own terminal:
1pnpm --filter @shadowbox/secure-agent-api dev # 87872pnpm --filter @shadowbox/brain dev # 87883pnpm --filter @shadowbox/web dev # 5174Verify runtime fingerprints before testing a task:
1curl http://localhost:8787/api/debug/runtime2curl http://localhost:8788/api/debug/runtimeThe public site and docs can be developed independently:
1pnpm --filter @shadowbox/landing dev2pnpm --filter @shadowbox/docs devUse the Cloudflare Pages local commands from deployment when you need to test edge functions, /agents/ routing, /docs/ routing, or the Cloud waitlist form.