Environment Setup
Configure your development environment and manage environment variables.
Environment Variables
Create a .env.local
file in your project root with the following variables:
# Supabase ConfigurationNEXT_PUBLIC_SUPABASE_URL=your_supabase_urlNEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_keySUPABASE_SERVICE_ROLE_KEY=your_service_role_key# Stripe ConfigurationSTRIPE_SECRET_KEY=your_stripe_secret_keyNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_keySTRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret# Email ConfigurationRESEND_API_KEY=your_resend_api_key# Application URLsNEXT_PUBLIC_SITE_URL=http://localhost:3000NEXT_PUBLIC_APP_URL=http://localhost:3000# AuthenticationNEXTAUTH_URL=http://localhost:3000NEXTAUTH_SECRET=your_nextauth_secret # Generate with: openssl rand -base64 32
API Keys Setup
Supabase
Get your Supabase API keys from your project settings:
# 1. Go to https://app.supabase.com# 2. Select your project# 3. Go to Project Settings > API# 4. Copy the following:NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.coNEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-keySUPABASE_SERVICE_ROLE_KEY=your-service-role-key
Stripe
Set up your Stripe API keys for payment processing:
# 1. Go to https://dashboard.stripe.com/apikeys# 2. Get your API keys:STRIPE_SECRET_KEY=sk_test_...NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...# 3. Set up webhooks at https://dashboard.stripe.com/webhooks# 4. Add the webhook secret:STRIPE_WEBHOOK_SECRET=whsec_...
Email (Resend)
Configure Resend for sending transactional emails:
# 1. Create an account at https://resend.com# 2. Go to API Keys# 3. Create a new API keyRESEND_API_KEY=re_...
Development Environment
Set up your local development environment:
# Install dependenciesnpm install# Start the development servernpm run dev# Run testsnpm run test# Build for productionnpm run build# Start production servernpm run start
Environment Types
Development (.env.local)
Local development environment variables, not committed to version control.
Testing (.env.test)
Environment variables for running tests, can be committed to version control.
Production (.env.production)
Production environment variables, set through your hosting platform.