Quickstart Guide
Get up and running with Superflag in your React, React Native, or CLI project in under 2 minutes.
React (Web)
React Native
CLI
Installation npm install @superflag-sh/react
yarn add @superflag-sh/react
pnpm add @superflag-sh/react
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 →
Installation npm install @superflag-sh/react-native @react-native-async-storage/async-storage
yarn add @superflag-sh/react-native @react-native-async-storage/async-storage
npx expo install @superflag-sh/react-native @react-native-async-storage/async-storage
Setup Wrap your app with SuperflagProvider: import { SuperflagProvider } from '@superflag-sh/react-native'
export default function App () {
return (
< SuperflagProvider clientKey = { process . env . EXPO_PUBLIC_SUPERFLAG_CLIENT_KEY } >
< YourApp />
</ SuperflagProvider >
)
}
Use Flags import { useFlag } from '@superflag-sh/react-native'
function MyScreen () {
const showNewUI = useFlag ( 'new-ui' , false )
return (
< View >
{ showNewUI ? < NewUI /> : < OldUI /> }
</ View >
)
}
Full React Native Docs Learn more about the React Native SDK →
Installation npm install -g @superflag-sh/cli
yarn global add @superflag-sh/cli
bun install -g @superflag-sh/cli
Authentication Log in to your Superflag account: This will open your browser for authentication. Set Context Set your default app and environment: superflag use my-app production
Manage Flags # List all flags
superflag flags list
# Create a new flag
superflag flags create --key new-feature --type bool --value true
# Get a flag value
superflag get new-feature
# Set a flag value
superflag set new-feature true
# Toggle a boolean flag
superflag flags toggle new-feature
Full CLI Docs Learn more about the CLI →
Get Your Client Key
Go to your Superflag dashboard
Select your app and environment
Click “API Keys” in the sidebar
Copy your public client key (starts with pub_)
Never use SDK keys (starting with sdk_) in client-side code. Only use public keys (pub_).
Environment Variables
React / Next.js
NEXT_PUBLIC_SUPERFLAG_CLIENT_KEY = pub_...
React Native / Expo
EXPO_PUBLIC_SUPERFLAG_CLIENT_KEY = pub_...
Next Steps