Prerequisites
Convex Account
Create a Convex account at convex.dev if you don’t have one.
Deployment Process
Initialize Convex Project
From the This will:
executor/ directory:- Create a new Convex deployment
- Generate deployment credentials
- Start watching for code changes
Deploy Functions
Deploy to production:This runs
convex deploy and pushes all backend functions to Convex.Deployment Modes
Executor usesEXECUTOR_DEPLOYMENT_MODE to control security and storage behavior:
Runtime Configuration
Execution Mode
Control where code executes:In production cloud deployments, leave
DANGEROUSLY_ALLOW_LOCAL_VM unset to enforce Cloudflare Worker sandbox execution for security.OpenAPI Generator
For heavy OpenAPI parsing, configure an external generator endpoint:Authentication Setup
WorkOS (Recommended)
Enable organization-based authentication with WorkOS:Create WorkOS Application
Sign up at workos.com and create an application.
Anonymous Mode
For development or single-user deployments, use anonymous JWT auth:.env or Convex environment variables.
Billing Integration
Stripe Setup
Enable checkout and billing portal with Stripe:.env
Stripe is optional. Omit these variables to disable billing features.
Storage Providers
Cloudflare Storage (Cloud)
Required for hosted Convex deployments:Local Storage (Self-Hosted Only)
MCP Endpoints
Cloud deployments expose MCP at:OAuth Protected Endpoint
/mcp requires bearer token verification when MCP_AUTHORIZATION_SERVER is configured:
Anonymous Endpoint
/mcp/anonymous uses API key authentication:
Environment Variables in Convex
Convex uses environment variables set in your dashboard:Open Convex Dashboard
Navigate to your deployment at dashboard.convex.dev
Set Environment Variables
Go to Settings → Environment Variables and add:
EXECUTOR_DEPLOYMENT_MODE=cloudAGENT_STORAGE_PROVIDER=agentfs-cloudflare- Auth credentials (WorkOS or anonymous JWT keys)
- Optional: Stripe keys for billing
Convex environment variables are separate from your local
.env file. Set them in the dashboard for production.Production Checklist
Security
- Set
EXECUTOR_DEPLOYMENT_MODE=cloud - Use
agentfs-cloudflarestorage - Leave
DANGEROUSLY_ALLOW_LOCAL_VMunset - Configure WorkOS or anonymous JWT auth
- Set secure cookie password (32+ chars)
Infrastructure
- Deploy Convex functions with
bun run deploy - Deploy web UI to hosting platform
- Configure custom domain
- Set up SSL/TLS certificates
Monitoring
- Enable Convex logs in dashboard
- Set up error tracking (Sentry, etc.)
- Configure uptime monitoring
Troubleshooting
401 on /mcp endpoint
401 on /mcp endpoint
Verify bearer token issuer matches
MCP_AUTHORIZATION_SERVER:401 on /mcp/anonymous
401 on /mcp/anonymous
Pass API key from workspace settings:
ENOENT after fs.write
ENOENT after fs.write
You’re using
agentfs-local in cloud. Switch to agentfs-cloudflare:Web UI can't load data
Web UI can't load data
Verify
CONVEX_URL and CONVEX_SITE_URL in web UI environment variables match your deployment.Next Steps
Configuration
Complete environment variable reference
Self-Hosting
Deploy locally with the binary CLI