This is a demo React app showcasing the @flagsync/js-sdk for feature flag usage.
- Type-safe flag evaluation
- Event tracking
- Real-time flag updates
- FlagSync CLI included (@flagsync/cli)
- Add your FlagSync SDK key to
.env:VITE_FLAGSYNC_SDK_KEY=your-key-here
To find this, navigate to the desired workspace environment from the Dashboard. Be sure to use a client-side SDK key.
- Install dependencies and start the dev server:
npm install npm run dev
- Update the flag key in
main.tsto the flag you want to test:const isEnabled = client.flag('my-first-kill-switch');
- Visit http://localhost:5173/ to see the flag value and try out the examples.
- Toggle the flag in the Flags Dashboard and see real-time updates in the app on refresh.
Optional, but highly recommended
Run the FlagSync CLI to get full type safety and autocompletion when accessing flags:
npm run generateconst isEnabled = client.flag('my-first-kill-switch');For more detailed information about the SDK features and usage, visit: