Skip to content

SDK Integration

The GrowthBook SDK follows a fetch-once, evaluate-locally model. When your app starts, the SDK connects to the GrowthBook API and downloads a compact JSON bundle called feature definitions — all the flags, rules, and experiment configurations for your project. After that initial fetch, every flag evaluation happens entirely inside your app. There is no network round-trip per call.

Here is the end-to-end flow:

  1. GrowthBook UI — you create flags, configure targeting rules, and publish changes.
  2. GrowthBook CDN — stores the compiled feature definitions for each SDK key.
  3. SDK init() — your app fetches and caches those definitions on startup.
  4. isOn() / getFeatureValue() — every evaluation reads from the local cache; no network call.

This architecture keeps flag evaluation fast (sub-millisecond), works offline after the first fetch, and scales to any request volume without adding load to GrowthBook.

LessonWhat you will learn
JavaScript SDKInstalling the vanilla SDK, initialising it, setting attributes, and evaluating flags in any JS environment
React SDKThe GrowthBookProvider, the useFeatureIsOn hook, and feature-flag patterns in React components
Node.js / Server-sidePer-request GrowthBook instances and safe server-side evaluation
Streaming & CachingReal-time flag updates with Server-Sent Events and cache strategy options

The GrowthBook SDK is available for every major language and platform:

  • JavaScript / TypeScript — browser and Node.js
  • React — hooks and context provider
  • React Native — mobile apps
  • Go — server-side
  • Python — server-side
  • Ruby — server-side
  • PHP — server-side
  • iOS (Swift) — native mobile
  • Android (Kotlin) — native mobile
  • Flutter — cross-platform mobile

The two required config values are apiHost (the CDN endpoint) and clientKey (the SDK key for your environment, found in GrowthBook under SDK Connections).

import { GrowthBook } from '@growthbook/growthbook';

const gb = new GrowthBook({
  apiHost: 'https://cdn.growthbook.io',
  clientKey: 'sdk-abc123',
});

await gb.init({ timeout: 2000 });
// Definitions are now cached locally — evaluate away
console.log(gb.isOn('my-flag')); // true or false, no network call
Where does the GrowthBook SDK evaluate feature flags?
What two values does the SDK need to fetch feature definitions?
Which of these is NOT a platform the GrowthBook SDK supports?