Overview
Edge Config provides a way to update configuration values at runtime without redeploying your application. This is powered by Vercel’s Edge Config infrastructure and allows you to control service hours, store status, and emergency messages instantly.Edge Config values are fetched at the edge, providing ultra-low latency access to configuration worldwide.
Configuration File
Edge Config integration is implemented insrc/config/edgeConfig.js:1-94.
Edge Config Keys
Three main configuration keys are supported:Controls service operating hours and availabilitySee Service Hours Configuration for details.
Manual store status controls (open/closed, maintenance mode)
Display emergency or important messages to customers
Configuration Structure
Service Hours
Master switch for service hours
Service start hour (24-hour format)
Service start minute
Service end hour (24-hour format)
Service end minute
Enable service on weekdays
Enable service on weekends
Array of dates when service is closed (YYYY-MM-DD format)
Timezone for time calculations
Store Status
Master on/off switch for the entire storeSet to
false to close the store completely.Temporary closure flag (e.g., for emergencies, staff shortage)
Maintenance mode flag (shows maintenance message to customers)
Reason for closure (displayed to customers)Example: “Teknik bakım nedeniyle geçici olarak kapalıyız”
Emergency Message
Whether to display the emergency message
The message text to displayExample: “Yoğun talep nedeniyle teslimat süreleri uzamıştır”
Message priority level:
normal, warning, or urgentAffects styling and prominence of the message display.Setup Guide
Create Edge Config Store
In your Vercel dashboard, go to Storage and create a new Edge Config store.
Get Connection String
Copy the Edge Config connection string from Vercel dashboard.It looks like:
https://edge-config.vercel.com/[your-id]?token=[your-token]Usage Examples
Fetch All Settings
src/config/edgeConfig.js
Get Single Value
src/config/edgeConfig.js
Merge with Local Settings
src/config/edgeConfig.js
Integration with Service Hours
The service hours system automatically loads Edge Config (seesrc/config/serviceHours.js:39-65):
src/config/serviceHours.js
API Reference
getEdgeConfigServiceSettings()
Fetches all service-related settings from Edge Config.null if Edge Config is unavailable
Implementation (see src/config/edgeConfig.js:11-29):
- Fetches all three keys in parallel using
Promise.all() - Returns
nulland logs warning if fetch fails - Non-blocking: Application continues with default values if Edge Config fails
getEdgeConfigValue()
Fetches a single value from Edge Config.key- The Edge Config key to fetch
null if unavailable
mergeWithEdgeConfig()
Merges local settings with Edge Config values (Edge Config takes priority).localSettings- Default/fallback settings from codeedgeSettings- Settings from Edge Config (or null)
src/config/edgeConfig.js:68-94):
- If
edgeSettingsis null, returnslocalSettingsunchanged - Otherwise, spreads local settings and overwrites with Edge Config values
- Handles nested objects (serviceHours, storeStatus, emergencyMessage)
Default Configuration Structure
Reference structure for Edge Config values (seesrc/config/edgeConfig.js:42-65):
src/config/edgeConfig.js
Common Use Cases
Emergency Store Closure
Quickly close your store without redeploying:Extend Hours for Special Event
Show Important Message
Maintenance Mode
Error Handling
The system is designed to be resilient:src/config/edgeConfig.js
If Edge Config is unavailable, your application automatically falls back to the default configuration defined in code. This ensures your app continues working even during Edge Config outages.
Best Practices
Version Control
Keep
DEFAULT_EDGE_CONFIG_STRUCTURE in your code as documentation and fallback.Test Changes
Test Edge Config changes in staging environment before applying to production.
Monitoring
Monitor console warnings for Edge Config fetch failures.
Cache Strategy
Edge Config values are cached at the edge. Updates propagate within seconds globally.
Security Considerations
- Edge Config is read-only from your application
- Only Vercel team members with appropriate permissions can modify values
- Connection string should be kept in environment variables, not committed to code
- Use Vercel’s environment variable management for different environments
Updating Configuration
You can update Edge Config values through:- Vercel Dashboard: Web UI for manual updates
- Vercel CLI: Command-line updates
- Vercel API: Programmatic updates
Using Vercel CLI
Performance
Ultra-Low Latency
Edge Config is served from Vercel’s edge network worldwide:
- Global read latency: < 10ms (P95)
- Update propagation: < 10 seconds globally
- Availability: 99.99% SLA
Related Configuration
- Service Hours - Controlled via Edge Config
- Order Limits - Could be extended to use Edge Config
- Damacana Limits - Could be extended to use Edge Config