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
Name of your Convex instance. This determines the database name (with
- replaced by _).Secret key for your instance. Keep this very safe and only accessible from the backend.
Required when running the binary directly.
URL configuration
URL of the Convex API as accessed by clients and the frontend.
URL of Convex HTTP actions as accessed by clients and the frontend.
URL of the Convex API as accessed by the dashboard (browser).
Port configuration
Port for the Convex backend API.
Port for HTTP actions.
Port for the dashboard web interface.
Database configuration
Generic database connection string. For specific databases, use
POSTGRES_URL or MYSQL_URL instead.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).MySQL connection string without database name and query parameters.
Disable SSL requirement for database connections. Useful for local development.
S3 storage configuration
AWS region for S3 buckets.
AWS access key ID for S3 authentication.
AWS secret access key for S3 authentication.
AWS session token for temporary credentials.
Custom S3 endpoint URL. Required for S3-compatible services like Cloudflare R2.
S3 bucket name for snapshot exports.
S3 bucket name for snapshot imports.
S3 bucket name for function modules.
S3 bucket name for user files.
S3 bucket name for search indexes.
Force path-style S3 URLs instead of virtual-hosted style. Required for some S3-compatible services.
Disable server-side encryption for S3 objects.
Disable checksums for S3 operations.
Performance tuning
Concurrency limits
Maximum concurrent queries allowed.
Maximum concurrent mutations allowed.
Maximum concurrent Node.js actions allowed.
Maximum concurrent V8 actions allowed.
Timeout configuration
Timeout in seconds for action execution.
HTTP server timeout in seconds.
Data retention
Document retention delay in seconds. Default is 2 days (172800 seconds) for self-hosted deployments.
Logging and monitoring
Log level for the backend. Options:
error, warn, info, debug, trace.Enable Rust backtraces for debugging.
Redact log information to prevent leaking PII.Cloud-hosted Convex automatically redacts logs. Enable this for similar behavior in self-hosted deployments.
Disable the anonymous usage beacon.Self-hosted builds include a beacon to help Convex understand usage. The information is anonymous and minimal.
Dashboard configuration
Load Monaco editor from local assets instead of CDN.
Version configuration
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