Environment Setup
Configure separate environments for development, preview, and production on Vercel
Branch Strategy
How we organize deployments
Production
Live site
Preview/Staging
Testing environment
Template
Not deployed
Configure Vercel Branches
Set up production and preview deployments
In Vercel Dashboard:
- Go to Settings → Git
- Configure production branch:
master - Enable preview deployments for
devbranch
Create Separate Supabase Projects
Use different databases for production and development
Production Database (master branch)
- Create project:
echo-production - Wait for initialization (2-3 minutes)
- Get credentials from Settings → API
Development/Preview Database (dev branch)
- Create project:
echo-dev - Get credentials from Settings → API
Configure OAuth Providers
Separate OAuth apps for each environment
Google OAuth
Production:
Add redirect URI: https://yourdomain.com/api/auth/callback/google
Preview/Dev:
Add redirect URI: http://localhost:3000/api/auth/callback/google
GitHub OAuth
Production:
Callback URL: https://yourdomain.com/api/auth/callback/github
Preview/Dev:
Callback URL: http://localhost:3000/api/auth/callback/github
Configure Vercel Environment Variables
Set variables for each environment scope
Production Environment (master branch)
Add these with Production scope selected:
Preview/Development Environment (dev branch)
Add these with Preview scope selected:
Important:
When adding environment variables in Vercel, select the scope (Production, Preview, or Development) for each variable. You can select multiple scopes if needed.
Setup Checklist
- Created production Supabase project
- Created dev/preview Supabase project
- Set up production OAuth apps (Google + GitHub)
- Set up dev OAuth apps (Google + GitHub)
- Added all Production-scoped env vars in Vercel
- Added all Preview-scoped env vars in Vercel
- Configured production branch = master in Vercel
- Tested production deployment
- Tested preview deployment
- Ran migrations on production database
- Ran migrations on dev database
Next Steps
Once your environments are configured, continue with: