Dev setup
This guide walks through setting up a Foundry development environment for contributors. If you are self-hosting for evaluation, see the Quickstart instead.
Prerequisites
Section titled “Prerequisites”Before starting, confirm you have:
- Bun 1.1+ (
bun --version) - Node.js 20+ (
node --version) - Git 2.30+ (
git --version) - A Convex account (free tier) at convex.dev
- A Clerk account (development instance) at clerk.com
See Prerequisites for installation instructions.
Fork and clone
Section titled “Fork and clone”-
Fork the repository on GitHub: github.com/qdhenry/Foundry
-
Clone your fork
Terminal window git clone https://github.com/YOUR_USERNAME/Foundry.gitcd Foundry -
Add the upstream remote
Terminal window git remote add upstream https://github.com/qdhenry/Foundry.git -
Install dependencies
Terminal window bun installThis installs dependencies for all workspaces:
apps/web,packages/ui,convex,agent-service,agent-worker, andsandbox-worker. -
Copy the environment template
Terminal window cp .env.example .env.localFill in the required values. See Environment variables for the full reference. At minimum you need:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYandCLERK_SECRET_KEYfrom your Clerk dashboardAGENT_SERVICE_URL=http://localhost:3001
The Convex variables are populated automatically in the next step.
-
Initialize Convex
Terminal window bunx convex devFollow the prompts to log in and create a development project. This:
- Deploys the schema (55+ tables)
- Deploys all server functions
- Populates
CONVEX_DEPLOYMENTandNEXT_PUBLIC_CONVEX_URL
Set your
ANTHROPIC_API_KEYin the Convex Dashboard (Settings > Environment Variables) if you need AI features.
Running the dev stack
Section titled “Running the dev stack”Foundry runs as a 4-process distributed system locally.
bun run dev:zellijOpens a multi-pane terminal with all services.
# Terminal 1 — Convex backend (keep running)bunx convex dev
# Terminal 2 — Next.js frontend (port 3000)bun run dev
# Terminal 3 — Agent service (port 3001)bun run dev:agent
# Terminal 4 — Sandbox worker (port 8788)bun run dev:workerFor most frontend and backend work, two processes are sufficient:
# Terminal 1bunx convex dev
# Terminal 2bun run devThe agent service and sandbox worker are only needed when working on AI inference or sandbox execution features.
Project structure
Section titled “Project structure”All feature UI lives in packages/ui/src/. App route pages in apps/web/ are thin wrappers:
apps/ web/ # Next.js frontend (thin route wrappers only) desktop/ # Tauri 2 desktop app (shares @foundry/ui) docs/ # Documentation site (Starlight)packages/ ui/ # All feature UI (@foundry/ui, 547 components) types/ # Shared TypeScript typesconvex/ # Backend: schema, queries, mutations, actions schema.ts # Data model (55+ tables) sandbox/ # Sandbox orchestration sourceControl/ # GitHub App integration atlassian/ # Jira/Confluence integrationagent-service/ # Express 5 AI inference sidecar (local dev)agent-worker/ # Cloudflare Worker AI inference (production)sandbox-worker/ # Cloudflare Worker + Durable Objects sandbox executionSeed test data
Section titled “Seed test data”The AcmeCorp reference dataset provides realistic data for development:
bunx convex run seed:seedAcmeCorp '{"orgId": "org_YOUR_ORG_ID"}'This creates a program with 118 requirements, 8 skills, and 7 workstreams. See Your first program for details on exploring the seeded data.
Running tests
Section titled “Running tests”# Run all tests oncebun run test
# Watch mode (re-runs on file changes)bun run test:watch
# Coverage report for the web appbun run test:coverage:web
# Type checking across all workspacesbun run typecheck
# End-to-end tests (requires Playwright browsers installed)bun run test:e2eKeeping your fork in sync
Section titled “Keeping your fork in sync”git fetch upstreamgit checkout maingit merge upstream/mainThen rebase your feature branch:
git checkout your-feature-branchgit rebase main