Files
vercel__flags/packages/adapter-edge-config
Dominik Ferber c0d8224015 docs: use adapter factory shorthand (adapter: vercelAdapter) (#409)
Update docs and examples to pass the adapter factory directly
(adapter: vercelAdapter) instead of calling it (adapter: vercelAdapter()),
reflecting the AdapterOrFactory support in flag(). Applied consistently to
all zero-arg factory adapters (vercel, edge-config, custom adapter examples).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 12:22:47 +02:00
..
2026-06-17 16:22:35 +03:00
2026-06-17 16:22:35 +03:00

@flags-sdk/edge-config

Installation

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.

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:

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

Using a custom adapter

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

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:

{
  "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.