SaaS
Getting Started

Configuration

All environment variables and how to configure the template for your SaaS.

Environment Variables

Create a .env file (copy from .env.example) and set these values:

Required

VariableDescriptionHow to get it
AUTH_SECRETJWT signing secretopenssl rand -base64 32
POSTGRES_URLPostgreSQL connection stringNeon, Supabase, or Vercel Postgres dashboard
STRIPE_SECRET_KEYStripe secret keyStripe Dashboard → Developers → API keys
STRIPE_WEBHOOK_SECRETStripe webhook signing keyStripe Dashboard → Webhooks → Add endpoint

Optional (OAuth)

VariableDescription
GOOGLE_CLIENT_IDGoogle OAuth client ID
GOOGLE_CLIENT_SECRETGoogle OAuth client secret
GITHUB_CLIENT_IDGitHub OAuth client ID
GITHUB_CLIENT_SECRETGitHub OAuth client secret

Stripe Setup

  1. Create a Stripe account
  2. Create products and prices in Stripe Dashboard
  3. Set STRIPE_SECRET_KEY to your secret key (sk_test_...)
  4. Create a webhook endpoint pointing to https://your-domain.com/api/stripe/webhook
  5. Set STRIPE_WEBHOOK_SECRET to the webhook signing secret
Test Mode

Use Stripe test mode (sk_test_...) while developing. Test card: 4242 4242 4242 4242 with any future expiration and CVC.

Database Setup

  1. Create a PostgreSQL database (we recommend Neon)
  2. Copy the connection string to POSTGRES_URL
  3. Run migrations: npx drizzle-kit migrate

The schema includes tables for users, teams, team members, invitations, activities, and Stripe subscriptions.

Next: Deployment →

Next.js SaaS Starter — Launch your SaaS