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
.envautomatically or through their standard config. - The scaffold writes a
.env.examplelisting every key your selected providers need, with placeholder values. - Client-exposed values use the framework's public prefix (for example
VITE_,NEXT_PUBLIC_, orPUBLIC_). Never put secrets behind a public prefix.
cp .env.example .env
# then edit .env with your real credentialsKeys by category
The exact keys depend on your selections. Common ones include:
| Category | Typical keys |
|---|---|
| Database | DATABASE_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. |
| Payments | Provider secret + webhook secret, e.g. STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET. |
Provider API key, e.g. RESEND_API_KEY. | |
| Caching | UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN or REDIS_URL. |
| File storage | S3_* / R2_* bucket, key, and secret values. |
| Observability / analytics | Provider DSN or token, e.g. SENTRY_DSN. |
Good practices
- Keep
.envout of version control — the scaffold's.gitignorealready excludes it. - Generate strong secrets for keys like
BETTER_AUTH_SECRET(for exampleopenssl rand -base64 32). - Set the same keys in your hosting provider's dashboard for production; do not ship
.envto production. - If your stack includes env validation, missing or malformed keys fail fast at startup with a clear message.
Next steps
- Create hosted databases in the Database Provisioning guide.
- Match keys to providers via the Auth Provider Comparison.
- Review provider-sensitive options on the TypeScript options page.