Skip to main content

Documentation Index

Fetch the complete documentation index at: https://superflag.sh/docs/llms.txt

Use this file to discover all available pages before exploring further.

Quickstart Guide

Get up and running with Superflag in your React, React Native, or CLI project in under 2 minutes.

Choose Your Platform

Installation

npm
npm install @superflag-sh/react
yarn
yarn add @superflag-sh/react
pnpm
pnpm add @superflag-sh/react
bun
bun add @superflag-sh/react

Setup

Wrap your app with SuperflagProvider:
import { SuperflagProvider } from '@superflag-sh/react'

function App() {
  return (
    <SuperflagProvider clientKey={process.env.NEXT_PUBLIC_SUPERFLAG_CLIENT_KEY}>
      <YourApp />
    </SuperflagProvider>
  )
}

Use Flags

import { useFlag } from '@superflag-sh/react'

function MyComponent() {
  const showNewFeature = useFlag('new-feature', false)

  return (
    <div>
      {showNewFeature && <NewFeature />}
    </div>
  )
}

Full React Docs

Learn more about the React SDK →

Get Your Client Key

  1. Go to your Superflag dashboard
  2. Select your app and environment
  3. Click “API Keys” in the sidebar
  4. Copy your public client key (starts with pub_)
Never use server keys (starting with sdk_) in client-side code. Only use public keys (pub_).

Environment Variables

React / Next.js

.env.local
NEXT_PUBLIC_SUPERFLAG_CLIENT_KEY=pub_...

React Native / Expo

.env
EXPO_PUBLIC_SUPERFLAG_CLIENT_KEY=pub_...

Next Steps

React SDK

Learn about hooks, caching, and advanced patterns

React Native SDK

Explore mobile-specific features and production tips

CLI Commands

Master the CLI for automation and CI/CD

API Reference

Build custom integrations with the HTTP API