Quickstart
This guide takes you from a fresh clone to a running Foundry instance. Target time: under 15 minutes.
-
Clone the repository and install dependencies
Terminal window git clone https://github.com/qdhenry/Foundry.gitcd Foundrybun installBun resolves all workspace dependencies across
apps/web,packages/ui,convex,agent-service,agent-worker, andsandbox-worker. -
Copy the environment template
Terminal window cp .env.example .env.localOpen
.env.localand fill in the minimum required values:Terminal window # Convex (filled automatically by `bunx convex dev` on first run)NEXT_PUBLIC_CONVEX_URL=https://your-deployment.convex.cloudCONVEX_DEPLOYMENT=dev:your-deployment# ClerkNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_your_keyCLERK_SECRET_KEY=sk_test_your_key# Agent service (local dev default)AGENT_SERVICE_URL=http://localhost:3001 -
Configure Clerk
In your Clerk dashboard:
- Copy the Publishable Key and Secret Key into
.env.local. - Enable Organizations under Settings > Organizations.
- You will configure the webhook endpoint after Convex is running.
- Copy the Publishable Key and Secret Key into
-
Start the Convex backend
Terminal window bunx convex devOn first run, the Convex CLI prompts you to:
- Log in to your Convex account
- Create a new project (or link to an existing one)
- Deploy the schema and server functions
Once complete, it outputs your deployment URL. Copy this into
NEXT_PUBLIC_CONVEX_URLin.env.local. -
Set the Anthropic API key in Convex
In the Convex Dashboard, navigate to your project’s Settings > Environment Variables and add:
Variable Value ANTHROPIC_API_KEYYour Anthropic API key ( sk-ant-...) -
Start the frontend
Open a second terminal:
Terminal window bun run devThis starts the Next.js dev server on http://localhost:3000.
-
Sign in via Clerk
Open http://localhost:3000 in your browser. Clerk’s authentication flow handles sign-up and sign-in. Create an account and an organization — the organization becomes your Foundry tenant.
-
Verify the setup
After signing in, you should see the Programs page. The page will be empty since no programs exist yet. If you see the programs list without errors, your Foundry instance is running.
Running all services (recommended)
Section titled “Running all services (recommended)”The quickstart above runs two processes (Convex + Next.js). For full functionality including AI inference and sandbox execution, run all four:
bun run dev:zellijThis opens a multi-pane terminal layout with all services running simultaneously.
# Terminal 1 — Convex backendbunx convex dev
# Terminal 2 — Next.js frontendbun run dev
# Terminal 3 — Agent service (AI inference, port 3001)bun run dev:agent
# Terminal 4 — Sandbox worker (port 8788)bun run dev:worker| Service | Port | Purpose |
|---|---|---|
| Next.js | 3000 | Frontend (React, App Router) |
| Convex | — | Backend (WebSocket, hot-reload) |
| Agent service | 3001 | AI inference sidecar (Express, Claude Code auth) |
| Sandbox worker | 8788 | Cloudflare sandbox execution (Wrangler local dev) |
Troubleshooting
Section titled “Troubleshooting”Convex dev fails to start
- Confirm Node.js 20+ is installed:
node --version - Ensure you are logged in:
bunx convex auth
Clerk sign-in redirects loop
- Verify
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYandCLERK_SECRET_KEYare set in.env.local - Ensure Organizations are enabled in the Clerk dashboard
“Not authenticated” errors after sign-in
- Check that the Convex deployment URL matches between
.env.localand the running Convex dev process - Confirm Clerk JWT integration is configured in the Convex Dashboard under Auth
Port 3000 already in use
- Kill the existing process:
lsof -ti:3000 | xargs kill -9
Next steps
Section titled “Next steps”- Create your first program with the AcmeCorp demo data
- Review the environment variables reference for optional services
- Explore the architecture overview to understand how the pieces connect