Complete documentation of environment variables for MultiWA Gateway.
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL |
✅ | - | PostgreSQL connection string |
REDIS_URL |
✅ | - | Redis connection string |
JWT_SECRET |
✅ | - | Secret key for JWT |
SESSIONS_PATH |
❌ | /data/sessions |
WhatsApp session storage path |
API_PORT |
❌ | 3000 |
API server port |
NODE_ENV |
❌ | development |
Environment mode |
Required | String
PostgreSQL connection string in the following format:
postgresql://[user]:[password]@[host]:[port]/[database]?sslmode=[mode]
Example:
# Development
DATABASE_URL=postgresql://multiwa:multiwa_password@localhost:5432/multiwa_gateway
# Production (with SSL)
DATABASE_URL=postgresql://user:password@db.host.com:5432/multiwa?sslmode=requireRequired | String
Redis connection string for queue and caching.
# Development
REDIS_URL=redis://localhost:6379
# Production (with password)
REDIS_URL=redis://:password@redis.host.com:6379Required | String (min 32 characters)
Secret key for signing JWT tokens. MUST be changed in production!
# Generate secure secret
openssl rand -base64 32Optional | String | Default: 7d
JWT token validity duration. Format: Xd (days), Xh (hours), Xm (minutes).
JWT_EXPIRES_IN=7d # 7 days
JWT_EXPIRES_IN=24h # 24 hoursOptional | String (32 characters)
Key for encrypting sensitive data (API keys, credentials).
# Generate 32-character key
openssl rand -hex 16Optional | Number | Default: 3000
Port for the NestJS API server.
Optional | String | Default: 0.0.0.0
Host binding for the API server.
Optional | String (comma-separated)
Allowed origins for CORS. Separate multiple origins with commas.
# Development
CORS_ORIGINS=http://localhost:3000,http://localhost:3001
# Production
CORS_ORIGINS=https://admin.yourdomain.com,https://app.yourdomain.comOptional | String | Default: /data/sessions
Directory for storing WhatsApp session data (Baileys auth files).
# Development
SESSIONS_PATH=./sessions
# Production (Docker volume)
SESSIONS_PATH=/data/sessions
⚠️ Important: This path must be persistent (Docker volume) so sessions are not lost when the container restarts.
Optional | Number | Default: 60
Time window in seconds for rate limiting.
Optional | Number | Default: 100
Maximum requests per time window.
RATE_LIMIT_SHORT=10/1s # 10 requests per second
RATE_LIMIT_MEDIUM=100/1m # 100 requests per minute
RATE_LIMIT_LONG=1000/1h # 1000 requests per hourOptional | Number | Default: 10
Number of concurrent jobs processed by the worker.
# Low-resource server
WORKER_CONCURRENCY=5
# High-performance server
WORKER_CONCURRENCY=20Optional | Number | Default: 30000
Timeout in milliseconds for webhook delivery.
Optional | Number | Default: 3
Number of retry attempts if webhook delivery fails.
Optional | String | Default: info
Logging level: debug, info, warn, error.
# Development (verbose)
LOG_LEVEL=debug
# Production (minimal)
LOG_LEVEL=warnOptional | String | Default: development
Environment mode: development, production, test.
Required for Admin | String
API backend URL for the Admin UI.
# Development
NEXT_PUBLIC_API_URL=http://localhost:3000
# Production
NEXT_PUBLIC_API_URL=https://api.yourdomain.comSENTRY_DSN=https://key@sentry.io/projectMINIO_ENDPOINT=localhost
MINIO_PORT=9000
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
MINIO_BUCKET=multiwa-media
MINIO_USE_SSL=falseDATABASE_URL=postgresql://multiwa:multiwa_password@localhost:5432/multiwa_gateway
REDIS_URL=redis://localhost:6379
JWT_SECRET=development-secret-key-change-in-production
JWT_EXPIRES_IN=7d
API_PORT=3000
CORS_ORIGINS=http://localhost:3000,http://localhost:3001
SESSIONS_PATH=./sessions
LOG_LEVEL=debug
NODE_ENV=developmentDATABASE_URL=postgresql://user:password@db.host.com:5432/multiwa?sslmode=require
REDIS_URL=redis://:password@redis.host.com:6379
JWT_SECRET=your-secure-generated-secret-key-here
JWT_EXPIRES_IN=7d
API_PORT=3000
CORS_ORIGINS=https://admin.yourdomain.com
SESSIONS_PATH=/data/sessions
LOG_LEVEL=warn
NODE_ENV=production
RATE_LIMIT_MAX=100
RATE_LIMIT_TTL=60-
JWT_SECRETuses a random string of 32+ characters -
DATABASE_URLuses SSL in production -
CORS_ORIGINSonly whitelists required domains -
LOG_LEVELset towarnorerrorin production -
SESSIONS_PATHuses a persistent volume