Skip to content

Environment Variables

This page documents every environment variable that Foundry reads at runtime. Variables are grouped by the service that consumes them.


These variables are read by the Next.js app at build time or runtime. Variables prefixed with NEXT_PUBLIC_ are exposed to the browser.

VariableRequiredWhere SetDescription
NEXT_PUBLIC_CONVEX_URLYesVercel + .env.localFull URL of the Convex deployment (e.g., https://your-deployment.convex.cloud). Used by the Convex React client to establish the WebSocket connection.
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYYesVercel + .env.localClerk publishable key for frontend authentication. Starts with pk_live_ or pk_test_.

VariableRequiredWhere SetDescription
CLERK_SECRET_KEYYesVercelClerk backend secret key. Used by Next.js middleware for server-side auth verification. Starts with sk_live_ or sk_test_. Never expose to the browser.
CLERK_WEBHOOK_SECRETYesConvex DashboardSvix signing secret for the Clerk user webhook (/clerk-users-webhook). Used to verify HMAC signatures on incoming webhook payloads. Starts with whsec_.

Convex server-side environment variables are set via the Convex Dashboard or bunx convex env set. They are available in Convex actions (Node.js runtime) via process.env.

VariableRequiredWhere SetDescription
ANTHROPIC_API_KEYYesConvex DashboardAnthropic API key for Claude model calls. Used by Convex actions for document analysis, skill execution, and AI scoring.

The agent service is a stateless AI inference sidecar. In local development it runs as an Express server; in production it runs as a Cloudflare Worker.

VariableRequiredWhere SetDescription
AGENT_SERVICE_URLYesConvex Dashboard + VercelURL of the agent service. Local: http://localhost:3001. Production: the Cloudflare Worker URL (e.g., https://foundry-agent-worker.<account>.workers.dev).
AGENT_SERVICE_SECRETProd onlyConvex Dashboard + WranglerBearer token shared between Convex and the agent worker for request authentication. Not needed in local dev where the Express server runs without auth.
ANTHROPIC_API_KEYYesWrangler secretsSame Anthropic API key, set separately on the Cloudflare Worker so it can call Claude directly.

The sandbox system provisions ephemeral Claude Code environments for task execution. It consists of a Cloudflare Worker with Durable Objects and Docker containers.

VariableRequiredWhere SetDescription
SANDBOX_WORKER_URLYesConvex DashboardURL of the Cloudflare sandbox worker (e.g., https://migration-sandbox-worker.<account>.workers.dev). Convex calls this to provision and manage sandbox sessions.
SANDBOX_API_SECRETYesConvex Dashboard + WranglerShared secret for authenticating requests between Convex and the sandbox worker. Set on both sides.

VariableRequiredWhere SetDescription
GITHUB_WEBHOOK_SECRETYesConvex DashboardHMAC secret for validating GitHub webhook signatures. Set this to the same value configured in your GitHub App’s webhook settings. Used by the /api/webhooks/github HTTP endpoint.

VariableRequiredWhere SetDescription
ATLASSIAN_WEBHOOK_SECRETYesConvex DashboardHMAC secret for validating Atlassian webhook payloads. Used by the /api/webhooks/jira and /api/webhooks/confluence HTTP endpoints.

VariableFrontendConvexAgent WorkerSandbox Worker
NEXT_PUBLIC_CONVEX_URLYes
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYYes
CLERK_SECRET_KEYYes
CLERK_WEBHOOK_SECRETYes
ANTHROPIC_API_KEYYesYes
AGENT_SERVICE_URLYes
AGENT_SERVICE_SECRETYesYes
SANDBOX_WORKER_URLYes
SANDBOX_API_SECRETYesYes
GITHUB_WEBHOOK_SECRETYes
ATLASSIAN_WEBHOOK_SECRETYes

Create a .env.local file in apps/web/ with at minimum:

Terminal window
NEXT_PUBLIC_CONVEX_URL=https://your-dev-deployment.convex.cloud
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...

All other variables are set on the Convex deployment via bunx convex env set or on the Cloudflare Workers via wrangler secret put.