Docs / Provider Setup

Open documentation actions

Environment Variables

How generated projects load environment variables and the keys each provider integration expects.

Better Fullstack generates a .env.example (and, where applicable, a validated env module) for the integrations in your stack. After scaffolding, copy the example to .env and fill in real values before running the app.

How env loading works

  • Each generated app reads environment variables at startup. Server frameworks load .env automatically or through their standard config.
  • The scaffold writes a .env.example listing every key your selected providers need, with placeholder values.
  • Client-exposed values use the framework's public prefix (for example VITE_, NEXT_PUBLIC_, or PUBLIC_). Never put secrets behind a public prefix.
cp .env.example .env
# then edit .env with your real credentials

Keys by category

The exact keys depend on your selections. Common ones include:

CategoryTypical keys
DatabaseDATABASE_URL (plus provider tokens like TURSO_AUTH_TOKEN).
Auth (Better Auth)BETTER_AUTH_SECRET, BETTER_AUTH_URL.
Auth (hosted)Provider client id/secret, e.g. CLERK_SECRET_KEY, AUTH0_CLIENT_ID.
PaymentsProvider secret + webhook secret, e.g. STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET.
EmailProvider API key, e.g. RESEND_API_KEY.
CachingUPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN or REDIS_URL.
File storageS3_* / R2_* bucket, key, and secret values.
Observability / analyticsProvider DSN or token, e.g. SENTRY_DSN.

Good practices

  • Keep .env out of version control — the scaffold's .gitignore already excludes it.
  • Generate strong secrets for keys like BETTER_AUTH_SECRET (for example openssl rand -base64 32).
  • Set the same keys in your hosting provider's dashboard for production; do not ship .env to production.
  • If your stack includes env validation, missing or malformed keys fail fast at startup with a clear message.

Next steps

Patreon