Environment management helps keep your development, testing, and production setups separate and organized. This way, changes in one place don't break things in another.
0
0
Environment management in Supabase
Introduction
When you want to test new features without affecting live users.
When you need to fix bugs safely before updating the real app.
When you want to try different database settings without risk.
When you want to share your project with teammates without mixing work.
When you want to deploy updates step-by-step from development to production.
Syntax
Supabase
supabase projects create --name <project-name> --org <organization-id>
Name projects to indicate the environment like myapp-development, myapp-staging, or myapp-production.
Each environment has its own database and API keys to keep data separate.
Examples
Creates a development environment for your app.
Supabase
supabase projects create --name myapp-dev --org 12345Creates a production environment for your app.
Supabase
supabase projects create --name myapp-prod --org 12345Lists all projects.
Supabase
supabase projects listSample Program
This example creates two environments: development and production. It sets different API keys for each to keep them separate and secure.
Supabase
supabase projects create --name myapp-dev --org 12345 supabase projects create --name myapp-prod --org 12345 supabase secrets set API_KEY=devkey123 --project myapp-dev supabase secrets set API_KEY=prodkey456 --project myapp-prod
OutputSuccess
Important Notes
Always keep your production environment secure and avoid using test data there.
Use environment variables to store sensitive information like API keys.
Regularly back up your production data to prevent loss.
Summary
Environment management separates your app setups for safety and organization.
Use different environments for development, testing, and production.
Keep secrets and data isolated per environment to avoid mistakes.