Environment Variables Reference

Repo-accurate environment variable guidance.

This repo reads environment variables through standard Node/Next.js env loading plus next-runtime-env for public runtime values.

Practical Repo Guidance

  • keep local secrets in ./.env.local
  • use hosting-provider environment variables in production
  • treat apps/web/config/*.ts as the source of truth for app-level config parsing

Key config files:

  • apps/web/config/app.config.ts
  • apps/web/config/auth.config.ts
  • apps/web/config/account-mode.config.ts
  • apps/web/config/feature-flags.config.ts

Common Variables

DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
BETTER_AUTH_SECRET=replace-me
NEXT_PUBLIC_SITE_URL=http://localhost:3000
NEXT_PUBLIC_PRODUCT_NAME=My App
NEXT_PUBLIC_DEFAULT_LOCALE=en
NEXT_PUBLIC_DEFAULT_THEME_MODE=light
NEXT_PUBLIC_ACCOUNT_MODE=hybrid

Auth

NEXT_PUBLIC_AUTH_PASSWORD=true
NEXT_PUBLIC_AUTH_MAGIC_LINK=false
NEXT_PUBLIC_AUTH_OAUTH_PROVIDERS=google
NEXT_PUBLIC_DISPLAY_TERMS_AND_CONDITIONS_CHECKBOX=false
TURNSTILE_SECRET_KEY=
NEXT_PUBLIC_CAPTCHA_SITE_KEY=

Billing

Billing configuration also depends on:

  • packages/billing/config/src/config.ts
  • provider-specific keys for Stripe or Polar

Monitoring

NEXT_PUBLIC_MONITORING_PROVIDER=sentry
NEXT_PUBLIC_SENTRY_DSN=
NEXT_PUBLIC_SENTRY_ENVIRONMENT=

Email

MAILER_PROVIDER=nodemailer
EMAIL_SENDER=My App <noreply@example.com>
EMAIL_HOST=
EMAIL_PORT=
EMAIL_TLS=
EMAIL_USER=
EMAIL_PASSWORD=
RESEND_API_KEY=

Runtime Public Env

Client-side code should read public runtime variables with:

import { env } from '@kit/shared/env';

Server-side code can use process.env.

Important Constraint

Do not assume the repo ships committed ./.env.local, ./.env.local, or ./.env.local files. Use ./.env.local locally and your deployment platform in production.