Environment
Getting StartedEnvironment setupValidation-ready
Environment variables are validated in src/env.js with @t3-oss/env-nextjs and Zod.
This page shows which variables are required, which ones are optional, and what each integration expects before the app can run correctly in development or production.
Recommended workflow
Complete your environment values before running database setup, auth flows, email delivery, or payment tests. It avoids false errors caused by incomplete configuration.
Variable reference
Required server variables
| Variable | Propósito |
|---|---|
AUTH_SECRET | Secret used by NextAuth |
DATABASE_URL | PostgreSQL connection string |
RESEND_API_KEY | Resend API access for transactional email |
GOOGLE_CLIENT_ID | Google OAuth client ID |
GOOGLE_CLIENT_SECRET | Google OAuth client secret |
STRIPE_SECRET_KEY | Stripe server API key |
STRIPE_PUBLISHABLE_KEY | Stripe publishable key |
STRIPE_WEBHOOK_SECRET | Signature secret for the Stripe webhook route |
STRIPE_PRICE_BASIC_ID | Stripe price ID for the BASIC tier |
STRIPE_PRICE_PRO_ID | Stripe price ID for the PRO tier |
STRIPE_PRICE_ENTERPRISE_ID | Stripe price ID for the ENTERPRISE tier |
STRIPE_PRICE_ONE_TIME_ID | Stripe price ID for one-time checkout |
Optional server variables
| Variable | Propósito |
|---|---|
STRIPE_COUPON_BASIC | Optional coupon applied to the BASIC plan |
STRIPE_COUPON_PRO | Optional coupon applied to the PRO plan |
Required client variables
| Variable | Propósito |
|---|---|
NEXT_PUBLIC_APP_URL | Base URL used for app links and checkout redirects |
Integration notes
Notes by integration
Auth
AUTH_SECRETis required in production.- Google OAuth is enabled in the current auth configuration.
Stripe
- Create all prices first in Stripe and store their IDs in the .env file.
- The webhook route expects the signing secret from your Stripe endpoint configuration.
Resend
- The sender address is configured in
src/config/site.tsasresendEmail. - That address must belong to a verified domain in your Resend account.
Keep values consistent
If you change provider settings in your environment file, make sure the related defaults in your config and integration files still match those choices.
Validation
Validation behavior
- Empty strings are treated as missing values.
- Validation can be skipped with
SKIP_ENV_VALIDATION, which is usually only useful in controlled build contexts.