Skip to content

Latest commit

 

History

History

README.md

JavaScript SDK Demo

This is a demo React app showcasing the @flagsync/js-sdk for feature flag usage.

✨ Features

  • Type-safe flag evaluation
  • Event tracking
  • Real-time flag updates
  • FlagSync CLI included (@flagsync/cli)

🚀 Quick Start

  1. 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.

  2. Install dependencies and start the dev server:
    npm install
    npm run dev
  3. Update the flag key in main.ts to the flag you want to test:
    const isEnabled = client.flag('my-first-kill-switch');
  4. Visit http://localhost:5173/ to see the flag value and try out the examples.
  5. Toggle the flag in the Flags Dashboard and see real-time updates in the app on refresh.

🖥️ FlagSync CLI

Optional, but highly recommended

Run the FlagSync CLI to get full type safety and autocompletion when accessing flags:

npm run generate

🔧 Example Usage

const isEnabled = client.flag('my-first-kill-switch');

📖 Documentation

For more detailed information about the SDK features and usage, visit: