Supabase Client Service
Component Detail
Service Layer
high complexity
mobileshared
0
Dependencies
0
Dependents
2
Entities
0
Integrations
Description
Singleton Riverpod provider that initializes and exposes the Supabase Flutter client with environment-based configuration for dev, staging, and production. Serves as the single entry point for all database reads/writes, authentication state, and real-time access consumed by every feature in the application.
supabase-client-service
Responsibilities
- Initialize Supabase client as a singleton with environment-specific config
- Expose typed database, auth, and realtime interfaces to all features
- Manage connection lifecycle and re-authentication on token expiry
- Provide environment switching (dev/staging/prod) via dart-define or .env loader
Interfaces
initialize(url, anonKey)
getClient()
getAuthClient()
getDatabaseClient()
getRealtimeClient()
getStorageClient()
getFunctionsClient()
getSession()
refreshSession()
signOut()
onAuthStateChange()
Related Data Entities (2)
Data entities managed by this component