> ## Documentation Index
> Fetch the complete documentation index at: https://docs.growthbook.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK Quickstart

> Get GrowthBook feature flags and experiments running in your app in a few lines of code, then pick a language-specific SDK.

Get GrowthBook running in your application in minutes.

> [!NOTE]
>
> **New to GrowthBook SDKs?**
>
> The [SDK Overview](https://docs.growthbook.io/lib.md) covers how SDKs work and helps you choose the right one for your use case.

**React**

**1. Get your SDK Client Key**

Go to [**SDK Configuration**](https://app.growthbook.io/sdks), create a new SDK Connection, and copy the **Client Key** (starts with `sdk-`).

**2. Install the SDK**

```bash npm theme={null}
npm install @growthbook/growthbook-react @growthbook/growthbook
```

```bash Yarn theme={null}
yarn add @growthbook/growthbook-react @growthbook/growthbook
```

```bash pnpm theme={null}
pnpm add @growthbook/growthbook-react @growthbook/growthbook
```

```bash bun theme={null}
bun add @growthbook/growthbook-react @growthbook/growthbook
```

**3. Wrap your app with `GrowthBookProvider`**

```tsx theme={null}
import { GrowthBook, GrowthBookProvider } from "@growthbook/growthbook-react";
import { thirdPartyTrackingPlugin, autoAttributesPlugin } from "@growthbook/growthbook/plugins";

// Create a GrowthBook instance
const gb = new GrowthBook({
  apiHost: "https://cdn.growthbook.io",
  clientKey: "sdk-abc123", // Your SDK client key
  enableDevMode: true,
  plugins: [
    thirdPartyTrackingPlugin(), // Optional, sends "Experiment Viewed" events to Google Analytics, Google Tag Manager, and Segment. For GrowthBook's warehouse, use growthbookTrackingPlugin() instead.
    autoAttributesPlugin(), // Optional, sets common attributes (browser, session_id, etc.)
  ],
});

// Load feature definitions from the GrowthBook API
gb.init();

export default function App() {
  return (
    <GrowthBookProvider growthbook={gb}>
      <MyApp />
    </GrowthBookProvider>
  );
}
```

**4. Use feature flags**

```tsx theme={null}
import { useFeatureIsOn, useFeatureValue } from "@growthbook/growthbook-react";

function MyApp() {
  const showNewFeature = useFeatureIsOn("new-feature");
  const buttonColor = useFeatureValue("button-color", "blue");

  return (
    <div>
      {showNewFeature && <NewFeature />}
      <button style={{ backgroundColor: buttonColor }}>Click me</button>
    </div>
  );
}
```

**Next steps:** - See the [example Next.js app](https://github.com/growthbook/examples/tree/main/next-js) - See the [React SDK docs](https://docs.growthbook.io/lib/react.md)

**JavaScript**

**1. Get your SDK Client Key**

Go to [**SDK Configuration**](https://app.growthbook.io/sdks), create a new SDK Connection, and copy the **Client Key** (starts with `sdk-`).

**2. Install the SDK**

```bash npm theme={null}
npm install @growthbook/growthbook
```

```bash Yarn theme={null}
yarn add @growthbook/growthbook
```

```bash pnpm theme={null}
pnpm add @growthbook/growthbook
```

```bash bun theme={null}
bun add @growthbook/growthbook
```

**3. Initialize GrowthBook**

```javascript theme={null}
import { GrowthBook } from "@growthbook/growthbook";
import { thirdPartyTrackingPlugin, autoAttributesPlugin } from "@growthbook/growthbook/plugins";

const gb = new GrowthBook({
  apiHost: "https://cdn.growthbook.io",
  clientKey: "sdk-abc123",
  plugins: [
    thirdPartyTrackingPlugin(), // Optional, sends "Experiment Viewed" events to Google Analytics, Google Tag Manager, and Segment. For GrowthBook's warehouse, use growthbookTrackingPlugin() instead.
    autoAttributesPlugin(), // Optional, sets common attributes (browser, session_id, etc.)
  ],
});

await gb.init();
```

**4. Use feature flags**

```javascript theme={null}
if (gb.isOn("new-feature")) {
  showNewFeature();
}

const color = gb.getFeatureValue("button-color", "blue");
```

**Next steps:** - See the [JavaScript SDK docs](https://docs.growthbook.io/lib/js.md) for TypeScript, plugins, and more. - See an [example Typescript app](https://github.com/growthbook/examples/tree/main/vanilla-typescript)

**Node.js**

**1. Get your SDK Client Key**

Go to [**SDK Configuration**](https://app.growthbook.io/sdks), create a new SDK Connection, and copy the **Client Key** (starts with `sdk-`).

**2. Install the SDK**

```bash npm theme={null}
npm install @growthbook/growthbook
```

```bash Yarn theme={null}
yarn add @growthbook/growthbook
```

```bash pnpm theme={null}
pnpm add @growthbook/growthbook
```

```bash bun theme={null}
bun add @growthbook/growthbook
```

**3. Initialize GrowthBook**

```javascript theme={null}
import { GrowthBookClient } from "@growthbook/growthbook";

const gbClient = new GrowthBookClient({
  apiHost: "https://cdn.growthbook.io",
  clientKey: "sdk-abc123",
  trackingCallback: (experiment, result, userContext) => {
    const userId = userContext.attributes.id;
    // Required for A/B testing
    // TODO: Replace with your own tracking implementation
    console.log("Viewed Experiment", userId, {
      experimentId: experiment.key,
      variationId: result.key
    });
  }
});
await gbClient.init({timeout: 3000});
```

**4. Use feature flags**

```javascript theme={null}
// User context with attributes that feature flags can use for targeting
const userContext = {
  attributes: {
    id: "123",
    country: "US",
    // ... other attributes ...
  }
}

// Boolean on/off flags
if (gbClient.isOn("my-feature", userContext)) {
  console.log("My feature is on!");
}

// String, Number, or JSON flags
const value = gbClient.getFeatureValue("my-string-feature", "fallback", userContext);
console.log(value);
```

**Next steps:** - See the full [Node.js SDK docs](https://docs.growthbook.io/lib/node.md) - Use the SDK in [Express middleware](https://docs.growthbook.io/lib/node.md#express-middleware)

**Python**

**1. Get your SDK Client Key**

Go to [**SDK Configuration**](https://app.growthbook.io/sdks), create a new SDK Connection, and copy the **Client Key** (starts with `sdk-`).

**2. Install the SDK**

```bash pip theme={null}
pip install growthbook
```

**3. Initialize GrowthBook**

```python theme={null}
from growthbook import GrowthBookClient, Options, UserContext

def on_experiment_viewed(experiment, result):
    # TODO: track in your analytics system
    print(f"Experiment: {experiment.key}, Variation: {result.key}")

# Create and initialize client
client = GrowthBookClient(
    Options(
        api_host="https://cdn.growthbook.io",
        client_key="sdk-abc123",
        on_experiment_viewed=on_experiment_viewed,
    )
)
await client.initialize()

# Create user context for targeting
user = UserContext(
    attributes={
        "id": "user-123",
        "country": "US",
    }
)
```

**4. Use feature flags**

```python theme={null}
if await client.is_on("new-feature", user):
    show_new_feature()

color = await client.get_feature_value("button-color", "blue", user)
```

**Next steps:** - See the full [Python SDK docs](https://docs.growthbook.io/lib/python.md) - See the [how to integrate with FastAPI](https://docs.growthbook.io/lib/python.md#async-web-framework-integration-fastapi) example.

**22+ More SDKs**

## All SDKs

**Client**

> **[HTML Script Tag](https://docs.growthbook.io/lib/script-tag.md)**
>
> Drop-in script for any website

> **[JavaScript](https://docs.growthbook.io/lib/js.md)**
>
> Vanilla JS and TypeScript

> **[React](https://docs.growthbook.io/lib/react.md)**
>
> Hooks and providers with SSR

> **[Vue](https://docs.growthbook.io/lib/vue.md)**
>
> Vue 3 composables

> **[Kotlin (Android)](https://docs.growthbook.io/lib/kotlin.md)**
>
> Native Android

> **[Swift (iOS)](https://docs.growthbook.io/lib/swift.md)**
>
> Native iOS

> **[Flutter](https://docs.growthbook.io/lib/flutter.md)**
>
> Cross-platform mobile

> **[React Native](https://docs.growthbook.io/lib/react-native.md)**
>
> Cross-platform React

**Server**

> **[Node.js](https://docs.growthbook.io/lib/node.md)**
>
> Express, Fastify, etc.

> **[Python](https://docs.growthbook.io/lib/python.md)**
>
> Flask, Django, FastAPI

> **[Ruby](https://docs.growthbook.io/lib/ruby.md)**
>
> Rails and Ruby apps

> **[PHP](https://docs.growthbook.io/lib/php.md)**
>
> Laravel, Symfony, etc.

> **[Java](https://docs.growthbook.io/lib/java.md)**
>
> Spring Boot and Java

> **[Go](https://docs.growthbook.io/lib/go.md)**
>
> High-performance Go

> **[C#](https://docs.growthbook.io/lib/csharp.md)**
>
> .NET Core and ASP.NET

> **[Elixir](https://docs.growthbook.io/lib/elixir.md)**
>
> Phoenix and Elixir

> **[Rust](https://docs.growthbook.io/lib/rust.md)**
>
> Actix, Axum, Rocket, and more

**Edge**

> **[Cloudflare Workers](https://docs.growthbook.io/lib/edge/cloudflare.md)**
>
> Edge computing on Cloudflare

> **[Fastly Compute](https://docs.growthbook.io/lib/edge/fastly.md)**
>
> WebAssembly-powered edge

> **[Lambda@Edge](https://docs.growthbook.io/lib/edge/lambda.md)**
>
> AWS CloudFront edge

***

## Verify your setup

After setting up your SDK, verify it's working by following these steps:

1. Create a feature flag called `test-flag` in your [GrowthBook](https://app.growthbook.io/features)
2. Set its value to `true` and enable it for your environment
3. Check that `isOn("test-flag")` returns `true` in your app
4. Toggle the flag off and verify the change is reflected

> [!TIP]
>
> Use the [GrowthBook DevTools](https://docs.growthbook.io/tools/chrome-extension.md) browser extension to inspect and test feature flags in development.
