apps/api/.env. This page documents all available options.
Quick reference
Copy.env.example to .env and customize for your environment:
Database
PostgreSQL connection string.Default (development):Production example:Format:
Skip automatic database migrations on startup.
Server
Port the API server listens on.In Docker, this is typically
20000 internally, mapped to a different port externally:Public-facing URL of your PlanningSup instance. Required in production for:
- SEO (robots.txt, sitemap.xml)
- OAuth callbacks
- WebAuthn (passkey authentication)
Omit trailing slash. Use full URL including protocol.
Comma-separated list of origins allowed for CORS and OAuth redirects.Development example:Production example:
Include all frontend origins: web app, Tauri desktop app, browser extension deep links.
Environment mode. Set to Affects:
production for production deployments.- Logging verbosity
- Error response details
- Static file serving
- OPS_TOKEN requirement
Authentication
Enable BetterAuth authentication features (OAuth, passkeys, user preferences sync).When enabled, requires additional auth variables below.
Secret key for signing authentication tokens. Required when
AUTH_ENABLED=true.Base URL for BetterAuth endpoints. Should match your API URL.In production:
OAuth providers
Discord OAuth application client secret.
GitHub OAuth application client secret.
Background jobs
Enable background job workers for planning refresh and backfill.Jobs:
plannings-backfill: Ensures all plannings have database backupsplannings-refresh-worker: Processes refresh queue for stale plannings
Time window to reduce job activity (e.g., overnight). Format: During quiet hours:
HH:MM-HH:MM.- Refresh intervals are extended
- Background activity is minimized
Times are in the server’s local timezone.
Comma-separated list of jobs to run. Omit to run all jobs.Available jobs:
plannings-backfillplannings-refresh-worker
Job tuning parameters
Interval between backfill job runs (milliseconds).
Maximum time refresh worker waits for queue items (milliseconds).
Maximum retry attempts for failed planning refreshes.
Operations
Secret token for accessing operations endpoints (Usage:
/api/ops/*).In production,
OPS_TOKEN is required. In development, operations endpoints are open if OPS_TOKEN is not set.Planning data
Directory containing planning JSON files.Default (Docker):Development:Planning files are loaded at startup from this directory.
Directory containing built frontend static files.Default (Docker):In production, the API serves the PWA from this location.
Extensions and integrations
Chrome Web Store extension ID for browser extension integration.Used for:
- Extension OAuth callbacks
- Deep link handling
Analytics
Domain name for Plausible Analytics tracking.
Custom Plausible Analytics endpoint URL.Omit to use Plausible’s default endpoint.
Complete example
Environment-specific notes
Docker Compose
Useenv_file to load variables:
Kubernetes
Use ConfigMaps and Secrets:Systemd service
Use an environment file:Security best practices
Recommended secret generation:
Next steps
Self-hosting guide
Deploy PlanningSup on your own infrastructure
Architecture
Understand how PlanningSup components work together