Production Deployment

Deploy to Vercel with Neon PostgreSQL. Set up preview and production environments.

1. Domain Setup

Purchase a domain and add it to Vercel. Use Vercel nameservers for automatic DNS configuration.

1# Change nameservers at your registrar to:
2ns1.vercel-dns.com
3ns2.vercel-dns.com

Skip this step if you only need a preview environment.

2. Neon Database

  1. 1. Create account at neon.tech
  2. 2. Create two branches: main (production) and preview
  3. 3. Get connection strings for each branch
Vercel Environment Variables
# Production (main branch)
DATABASE_URL="postgresql://user:pass@ep-xxx.neon.tech/neondb"
# Preview (preview branch)
DATABASE_URL="postgresql://user:pass@ep-yyy.neon.tech/neondb"

3. PostHog Analytics

Create account at posthog.com and get your project API key.

Vercel Environment Variables
NEXT_PUBLIC_POSTHOG_KEY="phc_..."
NEXT_PUBLIC_POSTHOG_HOST="https://eu.i.posthog.com"

4. Stripe Live Mode

Complete Stripe verification to accept real payments (1-7 days). Use test keys for preview, live keys for production.

Production Environment
# Production only
STRIPE_SECRET_KEY="sk_live_..."
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_live_..."
STRIPE_WEBHOOK_SECRET="whsec_live_..."
# Price IDs (create in Stripe Dashboard)
STRIPE_PRICE_PRO_MONTHLY="price_live_..."
STRIPE_PRICE_PRO_YEARLY="price_live_..."
STRIPE_PRICE_ULTRA_MONTHLY="price_live_..."
STRIPE_PRICE_ULTRA_YEARLY="price_live_..."

Webhook URLs

1# Production
2https://yourdomain.com/api/webhooks/stripe
3
4# Preview
5https://your-project-preview.vercel.app/api/webhooks/stripe

5. Email Setup

  1. 1. Add your domain to Resend
  2. 2. Configure DNS records (SPF, DKIM, DMARC)
  3. 3. Verify domain ownership
Vercel Environment Variables
AUTH_RESEND_KEY="re_..."
EMAIL_FROM="noreply@yourdomain.com"

6. Vercel Deployment

  1. 1. Sign up at vercel.com
  2. 2. Import your GitHub repository
  3. 3. Add environment variables (see below)
  4. 4. Deploy

Shared (All Environments)

AUTH_GOOGLE_ID="..."
AUTH_GOOGLE_SECRET="..."
AUTH_RESEND_KEY="re_..."
EMAIL_FROM="noreply@yourdomain.com"
NEXT_PUBLIC_POSTHOG_KEY="phc_..."
NEXT_PUBLIC_POSTHOG_HOST="https://eu.i.posthog.com"

Preview Only

AUTH_SECRET="preview-secret"
DATABASE_URL="postgresql://...preview-branch..."
STRIPE_SECRET_KEY="sk_test_..."
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_test_..."

Production Only

AUTH_SECRET="production-secret"
DATABASE_URL="postgresql://...main-branch..."
STRIPE_SECRET_KEY="sk_live_..."
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_live_..."
STRIPE_WEBHOOK_SECRET="whsec_live_..."

Important: Use different AUTH_SECRET values for preview and production. Redeploy after adding variables.

Verify

Authentication

  • • Google OAuth sign-in
  • • Magic link emails
  • • Session persistence

Payments

  • • Subscription checkout
  • • Webhook processing
  • • Customer portal

Next: Core Features

Explore authentication, payments, and more

Continue →