A browser example demonstrating how to use @replanejs/sdk for dynamic configuration with real-time updates in the browser.
npm installCreate a .env file with your Replane credentials:
VITE_REPLANE_SDK_KEY=your-sdk-key
VITE_REPLANE_BASE_URL=https://replane.example.comThen start the development server:
npm run devWithout credentials, the example will use an in-memory client with demo data.
npm run build
npm run preview- Creating a Replane client in the browser
- Getting config values with type safety
- Using context for user-specific config evaluation
- Real-time updates via SSE with visual feedback
- Proper cleanup on page unload
- Fallback to in-memory client for demo purposes
The SDK uses standard web APIs:
fetchfor HTTP requestsEventSourcefor SSE connections
These are supported in all modern browsers. For older browsers, you may need polyfills.