Skip to content

Configuration

Configuration is a single typed Settings object (Pydantic v2 BaseSettings) loaded from the environment in backend/app/core/config.py. Invalid or missing required values fail fast at startup with a clear error — not at 2 a.m. on the first request that needs them.

VariableRequiredDefaultWhat it does
DATABASE_URLyesAsync PostgreSQL connection string (postgresql+asyncpg://...).
CLERK_SECRET_KEYyesClerk server-side API key.
CLERK_JWKS_URLyesClerk JWKS endpoint; the public keys used to verify RS256 tokens.
CLERK_ISSUERyesExpected iss claim; tokens from any other issuer are rejected.
CLERK_AUTHORIZED_PARTIESyesAllowed azp values, so a token minted for another app cannot be replayed against yours.
STRIPE_SECRET_KEYfor billing""Stripe server key (test or live).
STRIPE_WEBHOOK_SECRETfor billing""Signing secret used to verify incoming webhook signatures.
STRIPE_PRICE_IDfor billing""The price the checkout session is created against.
CORS_ORIGINSno["http://localhost:3000"]The explicit list of allowed browser origins you set — the default is your real origins, not a permissive *.
ALLOWED_REDIRECT_HOSTSno["localhost","127.0.0.1"]Open-redirect guard for checkout success/cancel URLs.
APP_ENVnodevelopmentdevelopment / production; gates production-only behavior.
DEBUGnofalseVerbose errors locally; keep false in production.

Three things you get for free by configuring this way:

  • Fail-fast validation. A missing DATABASE_URL or a malformed CORS_ORIGINS list stops the app at boot with a precise message, instead of surfacing as a confusing 500 later.
  • One source of truth. Every module reads settings.x; there are no scattered os.getenv calls to hunt down, and no undocumented variable that only one engineer knows about.
  • Security defaults that are safe, not convenient. CORS is an explicit allow-list, redirects are host-checked, and Clerk’s iss/azp claims are validated — all driven from this one file.

The frontend reads the standard Clerk publishable key and the API base URL from its own .env.local; the download ships a documented template for both. The full configuration reference, including production hardening notes, ships as docs/CONFIGURATION.md.