open-index/open-npm huggingface dataset:
npm package: @flags-sdk/bucket
Description: Bucket.co provider for the Flags SDK
Latest version: 0.1.1

# Flags SDK - Bucket Provider

The [Bucket provider](https://flags-sdk.dev/docs/api-reference/adapters/bucket) for the [Flags SDK](https://flags-sdk.dev/) contains support for Bucket's feature flags.

## Setup

The Bucket provider is available in the `@flags-sdk/bucket` module. You can install it with

```bash
pnpm i @flags-sdk/bucket
```

## Provider Instance

You can import the default adapter instance `bucketAdapter` from `@flags-sdk/bucket`:

```ts
import { bucketAdapter } from '@flags-sdk/bucket';
```

## Example

```ts
import { flag } from 'flags/next';
import { bucketAdapter } from '@flags-sdk/bucket';

export const huddleFlag = flag<boolean>({
  key: 'huddle',
  adapter: bucketAdapter.featureIsEnabled(),
});
```

## Documentation

Please check out the [Bucket provider documentation](https://flags-sdk.dev/docs/api-reference/adapters/bucket) for more information.
npm package: @flags-sdk/edge-config
Description: ## Installation
Latest version: 0.1.2

# `@flags-sdk/edge-config`

## Installation

```bash
npm install @flags-sdk/edge-config
```

## Usage

## Using the default adapter

This adapter will connect to the Edge Config available under the `EDGE_CONFIG` environment variable, and read items from a key in the Edge Config called `flags`.

```ts
import { flag } from "flags/next";
import { edgeConfigAdapter } from "@flags-sdk/edge-config";

export const exampleFlag = flag({
  key: "example-flag",
  adapter: edgeConfigAdapter(),
});
```

Your Edge Config should look like this:

```json
{
  "flags": {
    "example-flag": true
  }
}
```

## Using a custom adapter

You can specify a custom adapter which connects to a different Edge Config, and reads

```ts
import { flag } from "flags/next";
import { createEdgeConfigAdapter } from "@flags-sdk/edge-config";

const edgeConfigAdapter = createEdgeConfigAdapter(process.env.EDGE_CONFIG, {
  teamSlug: "your-team-slug",
  edgeConfigItemKey: "my-flags",
});

export const exampleFlag = flag({
  key: "example-flag",
  adapter: edgeConfigAdapter(),
});
```

Your Edge Config should look like this:

```json
{
  "my-flags": {
    "example-flag": true
  }
}
```

Supplying the custom `teamSlug` allows the adapter to generate an `origin` for your flags, which in turn allows the Flags Explorer to link to your Edge Config. This is optional and does not affect runtime behavior.
npm package: @flags-sdk/growthbook
Description: GrowthBook provider for the Flags SDK
Latest version: 0.2.0

# Flags SDK — GrowthBook Provider

The [GrowthBook provider](https://flags-sdk.dev/docs/api-reference/adapters/growthbook) for the [Flags SDK](https://flags-sdk.dev/) contains support for GrowthBook's Feature Flags and Experiments.

## Setup

The GrowthBook provider is available in the `@flags-sdk/growthbook` module. You can install it with

```bash
pnpm i @flags-sdk/growthbook
```

## Provider Instance

You can import the default adapter instance `growthbookAdapter` from `@flags-sdk/growthbook`:

```ts
import { growthBookAdapter } from "@flags-sdk/growthbook";
```

## Example

```ts
import { flag } from "flags/next";
import { growthBookAdapter } from "@flags-sdk/growthbook";

export const summerBannerFlag = feature<boolean>({
  key: "summer-banner",
  adapter: growthBookAdapter.feature(),
});
```

## Experimentation (A/B Testing)

In order to run GrowthBook experiments, you must define a back-end tracking callback function. This is called every time a user is put into an experiment and can be used to track the exposure event in your analytics system. We recommend defining this callback in your flag definition file (e.g. `flags.ts`).

```ts
import { after } from "next/server";

growthbookAdapter.setTrackingCallback((experiment, result) => {
  // Safely fire and forget async calls (Next.js)
  after(async () => {
    console.log("Viewed Experiment", {
      experimentId: experiment.key,
      variationId: result.key,
    });
  });
});
```

In some situations, you may prefer to use a front-end tracking callback. This requires a bit of implementation glue. See the Vercel [Next.js + GrowthBook example](https://github.com/vercel/examples/tree/main/flags-sdk/growthbook) for details.

### Sticky Bucketing

To implement sticky bucketing (required for Bandits), you may create any `StickyBucketService` instance and apply it to the adapter (recommended in `flags.ts`). We recommend using our Redis service for ease of implementation.

```ts
import { RedisStickyBucketService } from "@growthbook/growthbook";
import Redis from "ioredis";

const redis = new Redis(process.env.REDIS_CONNECTION_URL);
const redisStickyBucketService = new RedisStickyBucketService({ redis });

growthbookAdapter.setStickyBucketService(redisStickyBucketService);
```

## Documentation

Please check out the [GrowthBook provider documentation](https://flags-sdk.dev/docs/api-reference/adapters/growthbook) for more information.
npm package: @flags-sdk/hypertune
Description: The [Hypertune adapter](https://flags-sdk.dev/docs/api-reference/adapters/hypertune) for the [Flags SDK](https://flags-sdk.dev/)
Latest version: 0.3.2

# Flags SDK — Hypertune Provider

The [Hypertune adapter](https://flags-sdk.dev/docs/api-reference/adapters/hypertune) for the [Flags SDK](https://flags-sdk.dev/)

## Setup

The Hypertune provider is available in the `@flags-sdk/hypertune` module. You can install it with

```bash
pnpm i @flags-sdk/hypertune
```

## Provider Instance

You must use the code generation powered by `npx hypertune` to create an adapter instance.
Use `createHypertuneAdapter` from `@flags-sdk/hypertune` as shown below:

```ts
import { createHypertuneAdapter } from "@flags-sdk/hypertune";
import { Identify } from "flags";
import { dedupe, flag } from "flags/next";
/** Generated with `npx hypertune` */
import {
  createSource,
  flagFallbacks,
  vercelFlagDefinitions as flagDefinitions,
  Context,
  FlagValues,
} from "./generated/hypertune";

const identify: Identify<Context> = dedupe(async ({ headers, cookies }) => {
  return {
    environment: process.env.NODE_ENV,
    user: {
      id: "e23cc9a8-0287-40aa-8500-6802df91e56a",
      name: "Example User",
      email: "user@example.com",
    },
  };
});

const hypertuneAdapter = createHypertuneAdapter<FlagValues, Context>({
  createSource,
  flagFallbacks,
  flagDefinitions,
  identify,
});

/** Use the adapter to generate flag declarations for use in your app's framework */
export const showSummerBannerFlag = flag(
  hypertuneAdapter.declarations.summerSale,
);

export const showFreeDeliveryBannerFlag = flag(
  hypertuneAdapter.declarations.freeDelivery,
);

export const proceedToCheckoutColorFlag = flag(
  hypertuneAdapter.declarations.proceedToCheckout,
);

/**
 * NOTE: You can provide specific options for flag overrides.
 *
 * However, using enums in Hypertune will provide these automatically.
 */
export const delayFlag = flag({
  ...hypertuneAdapter.declarations.delay,
  options: [
    { value: 0, label: "No delay" },
    { value: 1_000, label: "1 second" },
    { value: 2_000, label: "2 seconds" },
    { value: 3_000, label: "3 seconds" },
  ],
});
```

## Required Environment Variables

```bash
# Required
NEXT_PUBLIC_HYPERTUNE_TOKEN="123="

# For use with precompute, encrypted flag values, overrides, and the Flags Explorer
FLAGS_SECRET="ReplaceThisWith32RandomBytesBase64UrlString"

# Optional: automatically configure with a VercelEdgeConfigInitDataProvider
EXPERIMENTATION_CONFIG="ecfg_abc"
EXPERIMENTATION_CONFIG_ITEM_KEY="hypertune_xyz"
```

## Documentation

Please check out the [Hypertune Adapter reference](https://flags-sdk.dev/docs/api-reference/adapters/hypertune) for more information.
npm package: @flags-sdk/launchdarkly
Description: LaunchDarkly provider for the Flags SDK
Latest version: 0.3.4

# Flags SDK - LaunchDarkly Provider

The [LaunchDarkly provider](https://flags-sdk.dev/docs/api-reference/adapters/launchdarkly) for the [Flags SDK](https://flags-sdk.dev/) contains support for LaunchDarkly's Feature Flags.

## Setup

The Statsig provider is available in the `@flags-sdk/statsig` module. You can install it with

```bash
npm i @flags-sdk/launchdarkly
```

## Provider Instance

**NOTE:** The [LaunchDarkly Vercel integration](https://vercel.com/integrations/launchdarkly) must be installed on your account, as this adapter loads LaunchDarkly from Edge Config. The adapter can not be used without Edge Config.

Import the default adapter instance `ldAdapter` from `@flags-sdk/launchdarkly`:

```ts
import { ldAdapter } from "@flags-sdk/launchdarkly";
```

The default adapter uses the following environment variables to configure itself:

```sh
export LAUNCHDARKLY_CLIENT_SIDE_ID="612376f91b8f5713a58777a1"
export LAUNCHDARKLY_PROJECT_SLUG="my-project"
# Provided by Vercel when connecting an Edge Config to the project
export EDGE_CONFIG="https://edge-config.vercel.com/ecfg_abdc1234?token=xxx-xxx-xxx"
```

## Example

```ts
import { flag, dedupe } from "flags/next";
import { ldAdapter, type LDContext } from "@flags-sdk/launchdarkly";

const identify = dedupe(async (): Promise<LDContext> => {
  return {
    key: "user_123",
  };
});

export const showBanner = flag<boolean, LDContext>({
  key: "show-banner",
  identify,
  adapter: ldAdapter.variation(),
});
```

## Custom Adapter

Create an adapter by using the `createLaunchDarklyAdapter` function:

```ts
import { createLaunchDarklyAdapter } from "@flags-sdk/launchdarkly";

const adapter = createLaunchDarklyAdapter({
  projectSlug: "my-project",
  ldClientSideKey: "612376f91b8f5713a58777a1",
  edgeConfigConnectionString: process.env.EDGE_CONFIG,
});
```

## Documentation

Please check out the [LaunchDarkly provider documentation](https://flags-sdk.dev/docs/api-reference/adapters/launchdarkly) for more information.
npm package: @flags-sdk/openfeature
Description: OpenFeature provider for the Flags SDK
Latest version: 0.1.2

# Flags SDK - OpenFeature Provider

OpenFeature is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool or in-house solution. The Flags SDK OpenFeature adapter allows you to use the Flags SDK with any OpenFeature provider.

## Setup

The OpenFeature provider is available in the `@flags-sdk/openfeature` module. Install it with

```sh
npm i @flags-sdk/openfeature @openfeature/server-sdk
```

The command also installs the @openfeature/server-sdk peer dependency, as the OpenFeature adapter depends on the OpenFeature Node.js SDK.

## Provider Instance

Import the `createOpenFeatureAdapter` function from `@flags-sdk/openfeature` and create an adapter instance with your OpenFeature client.

For usage with regular providers, pass the client directly:

```ts
import { createOpenFeatureAdapter } from "@flags-sdk/openfeature";

OpenFeature.setProvider(new YourProviderOfChoice());
const openFeatureAdapter = createOpenFeatureAdapter(OpenFeature.getClient());
```

For usage with async providers, pass an init function, and return the client:

```ts
import { createOpenFeatureAdapter } from "@flags-sdk/openfeature";

// pass an init function, and return the client
const openFeatureAdapter = createOpenFeatureAdapter(async () => {
  const provider = new YourProviderOfChoice();
  await OpenFeature.setProviderAndWait(provider);
  return OpenFeature.getClient();
});
```

## Documentation

Please check out the [OpenFeature provider documentation](https://flags-sdk.dev/docs/api-reference/adapters/openfeature) for more information.
npm package: @flags-sdk/posthog
Description: PostHog adapter for the Flags SDK
Latest version: 0.2.2

# Flags SDK — PostHog Adapter

The PostHog adapter for [Flags SDK](https://flags-sdk.dev/) supports dynamic server side feature flags powered by [PostHog](https://posthog.com/).

## Setup

Install the adapter

```bash
pnpm i @flags-sdk/posthog
```

## Example Usage

```ts
import { flag } from "flags/next";
import { postHogAdapter } from "@flags-sdk/posthog";

export const marketingGate = flag<boolean>({
  // The key in PostHog
  key: "my_posthog_flag_key_here",
  // The PostHog feature to use (isFeatureEnabled, featureFlagValue, featureFlagPayload)
  adapter: postHogAdapter.featureFlagValue(),
});
```

## Runtimes

| Runtime      | Supported |
| ------------ | --------- |
| Node         | ✅        |
| Edge Runtime | ❌        |

Note: `posthog-node` does not support the Edge Runtime.

To use with middleware and precompute, read more: [Middleware now supports Node.js](https://vercel.com/changelog/middleware-now-supports-node-js)

## Documentation

View more PostHog documentation at [posthog.com](https://posthog.com?utm_source=github&utm_campaign=flags_sdk).
npm package: @flags-sdk/reflag
Description: Reflag provider for the Flags SDK
Latest version: 1.0.1

# Flags SDK - Reflag Provider

The [Reflag provider](https://flags-sdk.dev/docs/api-reference/adapters/reflag) for the [Flags SDK](https://flags-sdk.dev/) contains support for Reflag's feature flags.

## Setup

The Reflag provider is available in the `@flags-sdk/reflag` module. You can install it with

```bash
pnpm i @flags-sdk/reflag
```

## Provider Instance

You can import the default adapter instance `reflagAdapter` from `@flags-sdk/reflag`:

```ts
import { reflagAdapter } from "@flags-sdk/reflag";
```

## Example

```ts
import { flag } from "flags/next";
import { reflagAdapter } from "@flags-sdk/reflag";

export const huddleFlag = flag<boolean>({
  key: "huddle",
  adapter: reflagAdapter.isEnabled(),
});
```

## Documentation

Please check out the [Reflag provider documentation](https://flags-sdk.dev/docs/api-reference/adapters/reflag) for more information.
npm package: @flags-sdk/statsig
Description: Statsig provider for the Flags SDK
Latest version: 0.2.5

# Flags SDK — Statsig Provider

The [Statsig provider](https://flags-sdk.dev/docs/api-reference/adapters/statsig) for the [Flags SDK](https://flags-sdk.dev/) contains support for Statsig's Feature Gates, Dynamic Config, Experiments, Autotune and Layers.

## Setup

The Statsig provider is available in the `@flags-sdk/statsig` module. You can install it with

```bash
pnpm i @flags-sdk/statsig
```

## Provider Instance

You can import the default adapter instance `statigAdapter` from `@flags-sdk/statsig`:

```ts
import { statsigAdapter } from "@flags-sdk/statsig";
```

## Example

```ts
import { flag } from "flags/next";
import { statsigAdapter } from "@flags-sdk/statsig";

export const marketingGate = flag<boolean>({
  key: "marketing_gate",
  adapter: statsigAdapter.featureGate((config) => config.value),
});
```

## Documentation

Please check out the [Statsig provider documentation](https://flags-sdk.dev/docs/api-reference/adapters/statsig) for more information.
npm package: @flags-sdk/vercel
Description: The [Vercel adapter](https://flags-sdk.dev/providers/vercel) for the [Flags SDK](https://flags-sdk.dev/) connects your feature flags to [Vercel Flags](https://vercel.com/docs/flags/vercel-flags), the feature flag platform built into Vercel. Manage flags, 
Latest version: 1.2.1