Skip to content

CLI Commands

Foundry uses the Convex CLI (bunx convex) for all backend operations. This page documents the commands most relevant to self-hosters.


Start the Convex development server with hot-reload. Watches convex/ for changes and pushes schema and function updates to your dev deployment in real time.

Terminal window
bunx convex dev
FlagPurpose
--oncePush once and exit (no watch mode)
--tail-logsStream function logs to the terminal
--typecheck disableSkip TypeScript type-checking on push
--debug-bundle-path <dir>Write the compiled bundle to disk for inspection

Deploy your Convex backend to production. Pushes schema, functions, and indexes to the production deployment configured in your project.

Terminal window
bunx convex deploy
FlagPurpose
--cmd <command>Run a shell command after successful deploy (e.g., build frontend)
--typecheck disableSkip TypeScript type-checking
--dry-runValidate without deploying

Execute a Convex function directly from the command line. Useful for one-off mutations, seeding data, or debugging.

Terminal window
# Run a query
bunx convex run programs:list '{"orgId": "org_abc123"}'
# Run a mutation
bunx convex run programs:create '{"orgId": "org_abc123", "name": "My Program", "clientName": "Acme", "engagementType": "greenfield", "workstreams": []}'
# Run an internal function
bunx convex run --component _internal programs:backfillSlugs '{}'
FlagPurpose
--prodRun against the production deployment
--watchRe-run when the function changes

Arguments are passed as a single JSON string. The function path uses the module:functionName format.


Move data in and out of your Convex deployment.

Terminal window
# Export all tables to a directory
bunx convex export --path ./backup/
# Export from production
bunx convex export --prod --path ./backup/
Terminal window
# Import from a previous export
bunx convex import --path ./backup/
# Import into a specific table
bunx convex import --table programs --path ./backup/programs.jsonl
FlagPurpose
--path <dir>Directory for export output or import source
--table <name>Target a specific table
--prodOperate on the production deployment
--replaceReplace existing data instead of appending (import only)
--format <jsonl|csv>Data format (default: jsonl)

Manage environment variables on your Convex deployment. These are the server-side variables accessed via process.env in Convex actions (not functions using the Convex runtime).

Terminal window
# List all environment variables
bunx convex env list
# Set a variable
bunx convex env set ANTHROPIC_API_KEY sk-ant-...
# Remove a variable
bunx convex env remove ANTHROPIC_API_KEY
# List on production
bunx convex env list --prod
FlagPurpose
--prodOperate on the production deployment

See the Environment Variables page for the full list of variables Foundry requires.


Stream or view function execution logs from your deployment. Essential for debugging server-side errors.

Terminal window
# Stream logs in real time
bunx convex logs
# Stream from production
bunx convex logs --prod
# Filter by log level
bunx convex logs --success false
FlagPurpose
--prodStream from the production deployment
--success <bool>Filter to only successful or failed executions
--no-tailPrint recent logs and exit (no streaming)

A typical Foundry development session runs four processes. From the repository root:

Terminal window
# Terminal 1 — Convex backend (hot-reload)
bun run dev:convex
# Terminal 2 — Next.js frontend
bun run dev
# Terminal 3 — Agent service (local Express sidecar)
bun run dev:agent
# Terminal 4 — Sandbox worker (local Wrangler)
bun run dev:worker

Or use the Zellij layout to start all four at once:

Terminal window
bun run dev:zellij

Terminal window
# 1. Deploy Convex backend
bunx convex deploy
# 2. Deploy agent worker to Cloudflare
cd agent-worker && wrangler deploy
# 3. Frontend auto-deploys on push to main via Vercel
git push origin main