Configure Multi-Environment Supabase Project Settings
The Global Administrator needs to configure the Supabase platform with environment-specific settings (database URLs, API keys, service role keys) managed via dart-define or .env loaders. This includes provisioning separate Supabase projects per environment and managing the Supabase CLI tooling configuration used by the CI/CD pipeline. The singleton Supabase client must initialize correctly in each environment context.
User Story
Acceptance Criteria
- Given a new environment is being provisioned, when the admin configures environment variables, then the Supabase client initializes with the correct project URL and anon key for that environment
- Given the admin updates production credentials, when the app is deployed, then all database reads/writes route to the production Supabase project without cross-environment data leakage
- Given dev, staging, and production environments exist, when the admin views configuration, then each environment shows distinct project IDs and connection strings
- Given an incorrect environment variable is set, when the Supabase client initializes, then a clear configuration error is surfaced rather than a silent failure
Business Value
Environment isolation is foundational for GDPR compliance and data integrity. Without separate environments, a misconfigured deployment could expose production personal data (health records, location data, financial records) to developers or corrupt production data with test entries. This is non-negotiable for operating under Norway's data protection requirements.
Components
- Supabase Client Service service
- Supabase Platform infrastructure