This is a comprehensive explanation of different approaches to setting up development and production environments with . Let me break down each method and explain the technical details:
Method 1: Official (Paid Solution - 35+/month)Whatitis:<REDACTED>′snativebranchin25/month for Supabase Pro plan + $10/month per active branch
Deployment Integration:
Vercel: Automatically connects to the branch-specific instance
Netlify: Requires manual configuration of environment variables (database URL and anonymous key) for each branch
Workflow Example:
Create feature branch → Push to GitHub → Open PR
creates dedicated environment automatically
Deploy preview connects to branch-specific database
Test changes in isolation
Merge PR → Branch environment gets cleaned up
Method 2: CLI with Multiple Projects (Free Tier)
What it is: Using Supabase CLI to manage separate Supabase projects for dev/prod.
Key Commands:
supabase db push: Applies database migrations to remote project
supabase functions deploy: Deploys Edge Functions to remote project
Setup Process:
Create separate Supabase projects (one for dev, one for prod)
Configure environment variables in your app to point to different projects
Use CLI commands to deploy changes to appropriate environment
Limitations:
Manual process - no automatic branching
Need to manage multiple projects separately
More prone to human error (deploying to wrong environment)
Method 3: Local Development with (Recommended for Solo Developers)
What it is: Running a complete stack locally using Docker containers.
Setup Requirements:
Docker Desktop installed
Supabase CLI installed
Key Commands:
supabase start: Spins up local stack (PostgreSQL, API server, Auth, etc.)
supabase status: Shows connection details (URLs, keys) for local instance
supabase db reset: Wipes local database and reapplies all migrations from scratch
supabase migrations up: Applies new migrations to local database
supabase functions serve: Runs Edge Functions locally for testing
Development Workflow:
Local Development:
Run supabase start to get local environment
Point your app's environment variables to local instance
Develop and test changes locally
Migration Management:
Create/modify migrations locally
Test with supabase db reset and supabase migrations up
If you make mistakes, easily reset and start over
Function Development:
Write Edge Functions
Test locally with supabase functions serve
Debug and iterate quickly
Deployment:
Once satisfied locally, deploy to cloud:
supabase db push (for database changes)
supabase functions deploy (for Edge Functions)
Why Local Development is Recommended
Clean Migration History: You can experiment and make mistakes locally without polluting your cloud database's migration history. If you mess up, just reset locally and try again.
Faster Development: No network latency, instant feedback, work offline.
Better IDE Integration: Works seamlessly with modern code editors (VSCode, Cursor, Windsurf, etc.) for database schema inspection and autocomplete.
Cost Effective: Free local development, only pay for production usage.
Technical Architecture
Each method provides:
Database: PostgreSQL instance with your schema
API: Auto-generated REST and GraphQL APIs
Auth: User authentication and authorization
Edge Functions: Serverless functions (similar to AWS Lambda)
Storage: File storage system
The key difference is where these services run (local Docker containers vs. cloud instances) and how they're managed (automatic branching vs. manual CLI commands).
The author recommends the local development approach because it combines the benefits of free development with professional workflow practices, while keeping your production environment clean and controlled.