Provider System
The provider system in Gradiant is designed to manage global state and functionality across the application. It includes several key providers that handle different aspects of the application’s functionality.SharedProviders
TheSharedProviders component is the root provider that composes all other providers. It includes:
- Error handling with ErrorBoundary
- Theme management with ThemeProvider
- Security settings with SecurityProvider
- Convex client with ConvexProvider
Usage
ThemeProvider
Manages the application’s theme state including:- Color scheme (light/dark/system)
- Contrast mode (standard/high)
- Motion preferences (reduced/full)
Usage
SecurityProvider
Handles security-related functionality including:- Security levels (standard/HIPAA/maximum)
- FHE operations
- Key rotation
- Data encryption/decryption
Usage
ErrorBoundary
Provides error handling and fallback UI for runtime errors.Usage
Best Practices
- Always use the
SharedProvidersat the root of your application - Use the appropriate hooks (
useTheme,useSecurity) to access provider functionality - Handle errors appropriately with ErrorBoundary
- Consider performance implications when updating provider state
- Use TypeScript for better type safety and developer experience
- Follow the principle of least privilege when setting security levels
- Test provider integration thoroughly
- Document any custom provider implementations