Configuration
Configure environment variables and connect external services.
Environment Variables
All configuration is done through environment variables in .env.local.
Required Variables
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
# App Configuration
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Stripe Configuration (Test Mode)
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_xxxxxxxxxxxxxxxxxxxxx
STRIPE_SECRET_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxx
STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxx
# Resend Email Configuration
RESEND_API_KEY=re_xxxxxxxxxxxxxxxxxxxxx
RESEND_FROM_EMAIL=onboarding@resend.dev
# Vercel Blob (for file uploads)
BLOB_READ_WRITE_TOKEN=Optional Variables
# Analytics (leave empty to disable)
NEXT_PUBLIC_GA_MEASUREMENT_ID= # Google Analytics 4
NEXT_PUBLIC_GTM_ID= # Google Tag Manager
NEXT_PUBLIC_PLAUSIBLE_DOMAIN= # Plausible (privacy-friendly)
# Admin Configuration
ADMIN_IP_WHITELIST=
# Cloudflare Turnstile (Anti-bot protection)
NEXT_PUBLIC_TURNSTILE_SITE_KEY=
TURNSTILE_SECRET_KEY=Production Keys
Important: For production, replace test keys with live keys:
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxxxxxxxxxxxx
STRIPE_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxx
STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxSupabase Setup
- Create a Project
Go to supabase.com/dashboard and click "New Project"
- Get API Keys
Go to Settings → API and copy:
- Project URL →
NEXT_PUBLIC_SUPABASE_URL - anon public key →
NEXT_PUBLIC_SUPABASE_ANON_KEY - service_role key →
SUPABASE_SERVICE_ROLE_KEY
- Project URL →
- Run Database Setup
In Supabase SQL Editor, run
supabase-setup.sqlthensetup-storage.sql
Security: Never expose SUPABASE_SERVICE_ROLE_KEY on the client side. It bypasses Row Level Security.
Stripe Setup
- Get API Keys
- Create Products
Create your subscription products in Stripe and copy the Price IDs
- Configure Webhooks
For local development, use Stripe CLI:
# Install Stripe CLI brew install stripe/stripe-cli/stripe # Login and forward webhooks stripe login stripe listen --forward-to localhost:3000/api/stripe/webhook
Resend Setup
- Get API Key
Sign up at resend.com and create an API key
- Verify Domain (Production)
Add DNS records to verify your email domain
Verification
After configuration, verify everything works:
npm run dev
# Then test:
# - Sign up a new user
# - Add a product to cart
# - Try checkout with test card 4242 4242 4242 4242