Skip to content

Environment variables

The backend reads its configuration from environment variables. The Compose stack supplies them through .env. Values with a default are optional.

Core

VariableDescription
DATABASE_URLAsync SQLAlchemy URL. Defaults to the Compose PostgreSQL service.
ENCRYPTION_KEYRequired Fernet key used to encrypt API credentials at rest. Generate with python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())".

Database (Compose)

VariableDescription
POSTGRES_DBPostgreSQL database name. Defaults to usage_dashboard.
POSTGRES_USERPostgreSQL user. Defaults to usage_dashboard.
POSTGRES_PASSWORDPostgreSQL password. Defaults to change-me (change it).
POSTGRES_IMAGEPostgreSQL image used by Compose. Defaults to postgres:18-alpine; the Compose volume is mounted at /var/lib/postgresql for the 18+ image layout.

Authentication

VariableDescription
ADMIN_SESSION_EXPIRE_HOURSHours before password-login session tokens expire. Defaults to 24.
ADMIN_RECOVERY_CODE_EXPIRE_MINUTESMinutes before setup/reset codes printed in backend logs expire. Defaults to 30.

API access

VariableDescription
BACKEND_CORS_ORIGINSComma-separated allowed origins for the FastAPI API.
HOMEPAGE_ALLOWED_HOSTSComma-separated hostnames that may access GET /api/v1/homepage without a bearer token; ports are ignored. All other API routes still require a valid admin session or scoped API token.
CUSTOM_HTTP_ALLOWED_HOSTSComma-separated hostnames the Custom HTTP provider is allowed to reach. Blank allows any host.

Images and networking (Compose)

VariableDescription
IMAGE_TAGTag for the default GHCR backend/frontend images. Defaults to latest.
BACKEND_IMAGEOptional full backend image override. Defaults to ghcr.io/skulldorom/usage-dashboard-backend:${IMAGE_TAG}.
FRONTEND_IMAGEOptional full frontend image override. Defaults to ghcr.io/skulldorom/usage-dashboard-frontend:${IMAGE_TAG}.
NGINX_HTTP_PORTHost port published by the frontend/proxy container. Defaults to 3000.
VITE_API_BASE_URLFrontend API base path baked into the published frontend image. Defaults to /api.

Polling and retention

VariableDescription
AUTO_POLL_ENABLEDEnables background provider polling. Defaults to true.
AUTO_POLL_INTERVAL_MINUTESMinutes between automatic provider polls. Defaults to 60.
SNAPSHOT_RETENTION_DAYSDays of usage history to retain. Defaults to 90.
REQUEST_TIMEOUT_SECONDSSeconds before an upstream provider request times out. Defaults to 20.

Browser extension targets

VariableDescription
EXTENSION_TARGET_CHROME_IDOptional runtime Chrome extension ID used by one-click setup.
EXTENSION_TARGET_EDGE_IDOptional runtime Edge extension ID.
EXTENSION_TARGET_OPERA_IDOptional runtime Opera extension ID.
EXTENSION_TARGET_FIREFOX_IDOptional runtime Firefox extension ID.
EXTENSION_TARGET_SAFARI_IDOptional runtime Safari extension ID.

These override the published extension IDs at runtime (loaded through /runtime-config.js), which is useful for testing unpacked/dev builds without rebuilding the GHCR image. See Browser Extension for details.

Self-hosted API usage dashboard.