All variables live in a single .env file at the repository root. Copy .env.example to get started.
Variables prefixed with `VITE_` are baked into the frontend bundle at build time. If you change them you must rebuild the frontend image.
These must be set before starting the stack.
Variable Used by Description TWITCH_CLIENT_IDapi, bot Your app’s client ID from the Twitch Developer Console TWITCH_CLIENT_SECRETapi Your app’s client secret (never exposed to the frontend) TWITCH_BOT_CALLBACK_URIapi Full URL of the bot OAuth callback — e.g. https://your-domain.com/auth/bot/callback BOT_USER_IDbot Twitch user ID of the bot account (not the broadcaster) BOT_ACCESS_TOKENbot OAuth access token for the bot account — requires user:bot + user:write:chat scopes VITE_TWITCH_CLIENT_IDfrontend Same client ID — baked into the SPA at build time VITE_TWITCH_REDIRECT_URIfrontend Frontend OAuth callback — e.g. https://your-domain.com/auth/twitch/callback
Variable Used by Description DATABASE_URLapi, bot Full Postgres connection string — e.g. postgresql://maple:password@postgres:5432/maple POSTGRES_USERpostgres Database username (default: maple) POSTGRES_PASSWORDpostgres Required. Database password — choose a strong valuePOSTGRES_DBpostgres Database name (default: maple)
Variable Used by Description ENCRYPTION_KEYapi, bot 64-character hex string — encrypts all stored OAuth tokens. Generate with openssl rand -hex 32
Variable Used by Description FRONTEND_URLapi, bot The public URL of the frontend — used for CORS and OAuth redirects. e.g. https://your-domain.com VITE_API_URLfrontend The public URL of the frontend — baked into the SPA. Set to the same value as FRONTEND_URL e.g. https://your-domain.com VITE_DOC_URLfrontend The public URL of the docs site — baked into the SPA. e.g. https://docs.your-domain.com
Variable Default Description LASTFM_API_KEY— Last.fm API key — required for !song command and now-playing overlay API_PORT3099Host port for the API container FRONTEND_PORT5173Host port for the frontend container DOCS_PORT4321Host port for the docs container DB_POOL_MAX10Max Postgres connections in the bot’s pool DB_IDLE_TIMEOUT_MS30000Idle connection timeout in the bot’s pool DB_CONNECTION_TIMEOUT_MS5000Timeout when acquiring a connection from the pool DB_STATEMENT_TIMEOUT_MS10000Max time a single query can run before being cancelled
The BOT_ACCESS_TOKEN is a user token for the bot’s own Twitch account (not a broadcaster token). To obtain one:
Start the API server
Visit https://your-domain.com/bot/token-helper in your browser (or http://localhost:3099/bot/token-helper if testing locally)
Complete the Twitch OAuth flow for the bot account
Copy the displayed BOT_ACCESS_TOKEN=... value into .env
The token requires the user:bot and user:write:chat scopes. It does not expire automatically but can be revoked from the bot account’s Twitch connections page.