App Configuration
createAppConfig
Creates and initializes the application configuration.
Parameters
Configuration options to override defaults
Base URL for API requests
'development' | 'staging' | 'production'
Current environment
Feature flag configuration
Authentication configuration
Theme and UI configuration
Analytics and tracking configuration
Return Value
Initialized application configuration object
Example
Feature Flags
FeatureFlags
Feature flag configuration object for enabling/disabling features.
Enable experimental beta features
Enable analytics tracking
Enable push notifications
Enable social authentication providers
Enable file upload functionality
Enable real-time WebSocket features
Enable data export functionality
Example
Authentication Config
AuthConfig
Authentication configuration settings.
string
default:"'auth_token'"
LocalStorage key for storing auth token
string
default:"'refresh_token'"
LocalStorage key for storing refresh token
Session timeout in milliseconds (default: 1 hour)
Automatically refresh tokens before expiry
Time before expiry to refresh token in ms (default: 5 minutes)
string
default:"'/dashboard'"
URL to redirect to after successful login
URL to redirect to after logout
Example
Theme Configuration
ThemeConfig
Theme and visual configuration settings.
'light' | 'dark' | 'system'
default:"'light'"
Default color mode
string
default:"'#3B82F6'"
Primary brand color (hex code)
string
default:"'#10B981'"
Secondary brand color (hex code)
string
default:"'Inter, sans-serif'"
Default font family
Default border radius in pixels
Example
Analytics Configuration
AnalyticsConfig
Analytics and tracking configuration.
Enable analytics tracking
Analytics tracking ID (e.g., Google Analytics)
Enable debug mode for analytics
Anonymize user IP addresses
Automatically track page views
Example
API Configuration
ApiConfig
API client configuration settings.
Base URL for all API requests
Request timeout in milliseconds
Number of retry attempts for failed requests
Delay between retries in milliseconds
Default headers for all requests
Send cookies with cross-origin requests
Example
Getting Config Values
useConfig
React hook to access configuration values.
Return Value
Current application configuration
Example
Updating Config at Runtime
updateConfig
Updates configuration values at runtime.
Parameters
Partial<AppConfig>
required
Configuration values to update
Example