Environment variables
All configuration is done through environment variables. These can be set in:- A
.envfile next to yourdocker-compose.yml - Directly in your
docker-compose.ymlfile - Through your hosting platform’s configuration (Fly.io secrets, Railway variables, etc.)
Core configuration
Instance configuration
string
default:"convex-self-hosted"
Name of your Convex instance. This determines the database name (with
- replaced by _).string
Secret key for your instance. Keep this very safe and only accessible from the backend.
Required when running the binary directly.
URL configuration
string
default:"http://127.0.0.1:3210"
URL of the Convex API as accessed by clients and the frontend.
string
default:"http://127.0.0.1:3211"
URL of Convex HTTP actions as accessed by clients and the frontend.
string
default:"http://127.0.0.1:3210"
URL of the Convex API as accessed by the dashboard (browser).
Port configuration
number
default:"3210"
Port for the Convex backend API.
number
default:"3211"
Port for HTTP actions.
number
default:"6791"
Port for the dashboard web interface.
Database configuration
string
Generic database connection string. For specific databases, use
POSTGRES_URL or MYSQL_URL instead.string
PostgreSQL connection string without database name and query parameters.The backend will connect to a database named after your instance (e.g.,
convex_self_hosted).string
MySQL connection string without database name and query parameters.
boolean
default:"false"
Disable SSL requirement for database connections. Useful for local development.
S3 storage configuration
string
AWS region for S3 buckets.
string
AWS access key ID for S3 authentication.
string
AWS secret access key for S3 authentication.
string
AWS session token for temporary credentials.
string
Custom S3 endpoint URL. Required for S3-compatible services like Cloudflare R2.
string
S3 bucket name for snapshot exports.
string
S3 bucket name for snapshot imports.
string
S3 bucket name for function modules.
string
S3 bucket name for user files.
string
S3 bucket name for search indexes.
boolean
Force path-style S3 URLs instead of virtual-hosted style. Required for some S3-compatible services.
boolean
Disable server-side encryption for S3 objects.
boolean
Disable checksums for S3 operations.
Performance tuning
Concurrency limits
number
default:"16"
Maximum concurrent queries allowed.
number
default:"16"
Maximum concurrent mutations allowed.
number
default:"16"
Maximum concurrent Node.js actions allowed.
number
default:"16"
Maximum concurrent V8 actions allowed.
Timeout configuration
number
Timeout in seconds for action execution.
number
HTTP server timeout in seconds.
Data retention
number
default:"172800"
Document retention delay in seconds. Default is 2 days (172800 seconds) for self-hosted deployments.
Logging and monitoring
string
default:"info"
Log level for the backend. Options:
error, warn, info, debug, trace.string
Enable Rust backtraces for debugging.
boolean
default:"false"
Redact log information to prevent leaking PII.Cloud-hosted Convex automatically redacts logs. Enable this for similar behavior in self-hosted deployments.
boolean
default:"false"
Disable the anonymous usage beacon.Self-hosted builds include a beacon to help Convex understand usage. The information is anonymous and minimal.
Dashboard configuration
boolean
default:"false"
Load Monaco editor from local assets instead of CDN.
Version configuration
string
Override the Convex release version for development.
Example configurations
Local development
.env
Production with PostgreSQL and S3
.env
Production with Cloudflare R2
.env
Advanced tuning
For detailed configuration options beyond the commonly used variables, see the knobs.rs source file. These knobs are configurable via environment variables but require careful tuning based on your specific workload and hardware.Next steps
Database setup
Connect to PostgreSQL or MySQL
Storage
Configure S3-compatible storage