Skip to content

Configuration

All configuration is through environment variables. Copy .env.example to .env and fill in the values you need.

Device Integrations

Variable Description
GARMIN_EMAIL Garmin Connect email
GARMIN_PASSWORD Garmin Connect password
GARMIN_TOKENSTORE Token storage path (default: ~/.garminconnect)
WHOOP_CLIENT_ID WHOOP OAuth app client ID
WHOOP_CLIENT_SECRET WHOOP OAuth app client secret
WHOOP_REDIRECT_URI WHOOP OAuth redirect URI
STRAVA_CLIENT_ID Strava OAuth app client ID
STRAVA_CLIENT_SECRET Strava OAuth app client secret
STRAVA_REDIRECT_URI Strava OAuth redirect URI

Persisted WHOOP Tokens

For deployments where the database is ephemeral (like Railway free tier), you can persist WHOOP tokens via environment variables. Use the whoop_export_tokens MCP tool to get these values after initial OAuth:

Variable Description
WHOOP_ACCESS_TOKEN Exported access token
WHOOP_REFRESH_TOKEN Exported refresh token
WHOOP_TOKEN_EXPIRES_AT Token expiry timestamp

Database

Variable Description
DATABASE_URL PostgreSQL connection string. If set, uses Postgres.
DB_PATH SQLite file path (default: coaching_bot.db). Used when DATABASE_URL is not set.

Authentication & Security

Variable Description
SECRET_KEY Session signing key. Change this in production.
ENCRYPTION_KEY Fernet key for encrypting stored credentials. Auto-generated if not set.
SIGNUP_MODE open (default), invite (require invite code), or closed (no signups)

MCP Server

Variable Description
MCP_SERVER_URL Public URL of your deployment. Required for OAuth-based MCP auth. Omit to disable auth.
MCP_AUTH_SECRET Secret for MCP login page. Omit to auto-approve MCP clients.
CACHE_TTL_SECONDS In-memory cache TTL (default: 300)

LLM API Keys

The chat feature supports multiple LLM providers. Set at least one:

Variable Provider
ANTHROPIC_API_KEY Anthropic (Claude)
OPENAI_API_KEY OpenAI (GPT-4, etc.)
GOOGLE_API_KEY Google (Gemini)
XAI_API_KEY xAI (Grok)
GROQ_API_KEY Groq
MISTRAL_API_KEY Mistral

These are fallback keys. Users can also configure their own API keys per-account in Settings.

Email (Optional)

Variable Description
RESEND_API_KEY Resend API key for email verification and password resets
RESEND_FROM_EMAIL Sender address (default: Cadence <noreply@yourdomain.com>)

Analytics (Optional)

Variable Description
POSTHOG_API_KEY PostHog project API key for event tracking
POSTHOG_HOST PostHog instance URL (default: https://us.i.posthog.com)

Feature Flags

Feature flags control which capabilities are enabled. They can be set globally via env vars, overridden per-user in the admin panel, or toggled by individual users in settings.

Variable Default Controls
CHAT_ENABLED true AI coaching chat
WORKOUTS_ENABLED true Strength training / workout logging
GARMIN_ENABLED true Garmin device integration
WHOOP_ENABLED true WHOOP device integration
STRAVA_ENABLED true Strava device integration

Priority order: per-user DB override > global admin setting > environment variable.