惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
人人都是产品经理
人人都是产品经理
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
博客园_首页
雷峰网
雷峰网
V
Visual Studio Blog
爱范儿
爱范儿
A
About on SuperTechFans
量子位
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
S
SegmentFault 最新的问题
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More

Flags SDK Documentation

Global Config Bulk Evaluation Evaluation Context Precompute GrowthBook Hypertune PostHog Split Evaluation Context Quickstart Precompute Evaluation Context Quickstart Precompute Hypertune PostHog Split Proxy Dashboard Pages Marketing Pages Dashboard Pages Marketing Pages Data Locality Providers LaunchDarkly Optimizely Reflag Statsig Server-side vs Client-side Flags as Code
GrowthBook
Vercel · 2026-05-28 · via Flags SDK Documentation

Use GrowthBook with the Flags SDK

GrowthBook can be used with the Flags SDK through OpenFeature. Set up the Flags SDK adapter for OpenFeature, along with the GrowthBook OpenFeature provider to get started.

This provider has a native adapter available at @flags-sdk/growthbook, which you should use instead.

Install the following packages:

npm install flags @flags-sdk/openfeature @growthbook/growthbook @openfeature/growthbook-provider

Set up your GrowthBook OpenFeature provider as a Flags SDK adapter.

// adapter.ts
import { OpenFeature } from "@openfeature/server-sdk";
import { createOpenFeatureAdapter } from "@flags-sdk/openfeature";
import { GrowthBookClient, ClientOptions, InitOptions } from '@growthbook/growthbook';
import { GrowthbookProvider } from '@openfeature/growthbook-provider';

export const openFeatureAdapter = createOpenFeatureAdapter(async () => {
  /*
  * Configure your GrowthBook instance with GrowthBook context
  * @see https://docs.growthbook.io/lib/js#step-1-configure-your-app
  */
  const gbClientOptions: ClientOptions = {
    apiHost: 'https://cdn.growthbook.io',
    clientKey: 'sdk-abc123',
    // Only required if you have feature encryption enabled in GrowthBook
    decryptionKey: 'key_abc123',
  };

  /*
  * optional init options
  * @see https://docs.growthbook.io/lib/js#switching-to-init
  */
  const initOptions: InitOptions = {
    timeout: 2000,
    streaming: true,
  };

  const provider = new GrowthbookProvider(gbClientOptions, initOptions);

  await OpenFeature.setProviderAndWait(provider);
  return OpenFeature.getClient();
});

See the OpenFeature adapter for more details.

Use your newly configured adapter when declaring flags.

// flags.ts
import { flag } from "flags/next";
import type { EvaluationContext } from "@openfeature/server-sdk";
import { openFeatureAdapter } from "./adapter";

export const exampleFlag = flag<boolean, EvaluationContext>({
  key: "example-flag",
  defaultValue: false,
  adapter: openFeatureAdapter.booleanValue(),
});

Flags SDK adapter for OpenFeature

GrowthBook OpenFeature Provider

Note that OpenFeature providers may require additional configuration for optimal performance and compatibility. Setup instructions are provided on a best effort basis. Refer to each provider's own documentation.

If there is a native Flags SDK adapter for your provider, we recommend using that instead. Native Flags SDK adapters tune your flag provider's SDK for optimal performance and integrate with Flags Explorer and Edge Config. See available adapters.

If you are a feature flag provider interested in developing a native adapter please open a GitHub issue to get in touch.