Get the kit
Free tools
SaaS .env example

Generate environment variables for your SaaS stack.

Select your Next.js SaaS setup and get a ready .env template for Stripe, auth, database access, emails, analytics, and production operations.

Stack input

Choose your setup

Ready .env template

Copy into your environment manager

# App
NODE_ENV=production
NEXT_PUBLIC_APP_URL=https://your-app.vercel.app
APP_NAME=Sassy SaaS

# Stripe
STRIPE_SECRET_KEY=sk_live_replace_me
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_replace_me
STRIPE_WEBHOOK_SECRET=whsec_replace_me
STRIPE_PRICE_ID_STARTER=price_replace_me
STRIPE_PRICE_ID_PRO=price_replace_me

# Auth.js / NextAuth
AUTH_SECRET=replace_with_long_random_secret
AUTH_URL=https://your-app.vercel.app
GOOGLE_CLIENT_ID=replace_me
GOOGLE_CLIENT_SECRET=replace_me
GITHUB_CLIENT_ID=replace_me
GITHUB_CLIENT_SECRET=replace_me

# PostgreSQL
DATABASE_URL=postgresql://user:password@host:5432/database?sslmode=require

# Email and operations
RESEND_API_KEY=re_replace_me
SUPPORT_EMAIL=support@your-app.com
ADMIN_EMAIL=founder@your-app.com

# Analytics
NEXT_PUBLIC_GA_MEASUREMENT_ID=G-replace-me
SENTRY_DSN=https://replace-me@sentry.io/project-id

Variable notes

NODE_ENV

Tells Next.js and your server code to run production behavior.

NEXT_PUBLIC_APP_URL

Your public app URL, used for redirects, emails, callbacks, and canonical links.

APP_NAME

A server-side app label for email templates, logs, and internal product copy.

STRIPE_SECRET_KEY

Server-only key used to create checkout sessions, customers, subscriptions, and billing portal links.

NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY

Browser-safe Stripe key used by client-side Stripe components.

STRIPE_WEBHOOK_SECRET

Used to verify Stripe webhook signatures before updating subscription state.

STRIPE_PRICE_ID_*

Maps your app plans to Stripe recurring price IDs.

AUTH_SECRET

Signs and encrypts session tokens. Generate a long random value and keep it private.

AUTH_URL

The canonical URL Auth.js uses when building callback and redirect URLs.

GOOGLE_CLIENT_* / GITHUB_CLIENT_*

OAuth app credentials from each provider dashboard.

DATABASE_URL

Primary PostgreSQL connection string for Prisma, Drizzle, or server-side database clients.

RESEND_API_KEY

Server-only key for transactional email such as invites, receipts, and passwordless login links.

SUPPORT_EMAIL / ADMIN_EMAIL

Operational addresses for support copy, notifications, and internal alerts.

NEXT_PUBLIC_GA_MEASUREMENT_ID

Browser-visible analytics ID. Prefix with NEXT_PUBLIC only when the value is safe for the client.

SENTRY_DSN

Error monitoring DSN used to capture production exceptions.

Launch checks

Keep every secret without NEXT_PUBLIC server-only.

Use live Stripe keys only in production and test keys only locally.

Add webhook secrets for Stripe and auth providers before launch.

Set production callback URLs in OAuth provider dashboards.

Store production variables in your host dashboard, not in git.

Production habit

Keep a separate local, preview, and production environment. Most SaaS launch bugs come from mixing test keys, callback URLs, or database URLs between them.