Overview
Umami uses environment variables for configuration. Variables are read from the environment or from a.env file in the application root.
Environment variables are defined in
/next.config.ts and loaded using dotenv.Core Variables
DATABASE_URL (Required)
PostgreSQL database connection string.- Local
- Docker
- With SSL
- With Schema
APP_SECRET
Secret key for securing sessions and cryptographic operations.Server Configuration
PORT
Server listening port.3000
In Docker, the internal port is always 3000. Map to a different external port using
ports in docker-compose.yml.HOSTNAME
Server bind address.0.0.0.0 (all interfaces)
Options:
0.0.0.0- Listen on all network interfaces127.0.0.1- Listen only on localhost::- Listen on all IPv6 interfaces
BASE_PATH
Serve Umami from a subdirectory.- Root Path
- Subdirectory
When using BASE_PATH, you must rebuild the application. It cannot be changed at runtime.
Database Configuration
CLICKHOUSE_URL
ClickHouse database connection for high-volume analytics.- HTTP
- With Auth
- HTTPS
When CLICKHOUSE_URL is set, Umami uses dual databases: PostgreSQL for user data, ClickHouse for analytics.
REDIS_URL
Redis connection for session storage and caching.- Local
- With Password
- With Database
- TLS
Security Configuration
FORCE_SSL
Enforce HTTPS by adding Strict-Transport-Security header.1- Enable HSTS header- Not set - No HSTS header
Only enable this if Umami is served over HTTPS. Enabling on HTTP will break access.
ALLOWED_FRAME_URLS
Allow embedding Umami in iframes from specific domains.'self' (only same origin)
Updates Content-Security-Policy frame-ancestors directive:
CORS_MAX_AGE
Maximum age for CORS preflight cache (in seconds).86400 (24 hours)
Sets the Access-Control-Max-Age header for API endpoints.
Tracker Configuration
TRACKER_SCRIPT_NAME
Custom filename(s) for the tracking script.script.js
Allows accessing the tracker at custom URLs to bypass ad blockers:
TRACKER_SCRIPT_URL
Proxy tracking script from external URL.next.config.ts
COLLECT_API_ENDPOINT
Custom endpoint for data collection./api/send
Changes the data collection endpoint URL to bypass ad blockers.
Localization
DEFAULT_LOCALE
Default language for the interface.en-US
Supported locales:
en-US- English (United States)es-ES- Spanish (Spain)fr-FR- French (France)de-DE- German (Germany)ja-JP- Japanese (Japan)zh-CN- Chinese (Simplified)pt-BR- Portuguese (Brazil)- And many more…
Users can override the default locale in their profile settings.
Cloud Mode
CLOUD_MODE
Enable cloud-specific features.CLOUD_URL
URL for cloud-mode features.Only used when CLOUD_MODE is enabled.
Development Variables
NODE_ENV
Node.js environment.production- Production mode (optimized, no debug)development- Development mode (hot reload, debug)test- Test mode
NEXT_TELEMETRY_DISABLED
Disable Next.js telemetry.1 (disabled in Dockerfile)
Umami disables this by default for privacy.
Database Control
SKIP_DB_CHECK
Skip database connection check on startup.SKIP_DB_MIGRATION
Skip automatic database migration on startup.Use this if you want to manually control when migrations run.
GeoIP Database
GEO_DATABASE_URL
URL to download MaxMind GeoLite2 database.Complete .env Example
Here’s a complete production.env file:
.env
Docker Compose Example
docker-compose.yml
.env file:
.env
Kubernetes ConfigMap
configmap.yaml
secrets.yaml
Environment Variable Priority
Variables are loaded in this order (later overrides earlier):- Default values in
next.config.ts .envfile in application root- System environment variables
- Docker/Kubernetes environment variables
Validation
Umami validates required environment variables on startup:scripts/check-env.js
Troubleshooting
Variables not being read
Variables not being read
Check Verify file format:
.env file location:DATABASE_URL not defined error
DATABASE_URL not defined error
Ensure DATABASE_URL is set:Set it if missing:
BASE_PATH not working
BASE_PATH not working
BASE_PATH requires rebuilding:Cannot be changed at runtime.
Sessions not persisting across restarts
Sessions not persisting across restarts
Set APP_SECRET to prevent session invalidation:Or use Redis for session storage:
Security Best Practices
Strong Secrets
Use cryptographically secure random values for APP_SECRET.
Secure Storage
Never commit .env files to version control.
Principle of Least Privilege
Database users should have minimum required permissions.
Regular Rotation
Rotate secrets periodically, especially after team changes.
.gitignore Entry
Always exclude environment files:.gitignore
Next Steps
Docker Deployment
Deploy with Docker Compose
PostgreSQL
Configure your database
Upgrading
Update your installation
Troubleshooting
Solve configuration issues