
Template details
Flags SDK with LaunchDarkly
A Next.js App Router example that uses Flags SDK and LaunchDarkly to evaluate a greeting and banner flag on the server.
About this template
A minimal Next.js App Router template that connects Vercel's Flags SDK to LaunchDarkly and evaluates two feature flags on the server. The example demonstrates flag-driven rendering of a welcome message and a conditional banner, and ships with Flags Explorer support for overriding evaluated values in the Vercel Toolbar.
What is Flags SDK with LaunchDarkly?
Flags SDK with LaunchDarkly is a provider example in the Vercel Flags SDK repository, built on the Next.js App Router. It takes a LaunchDarkly environment plus a Global Config connection string as input, evaluates two flags (welcome_message, a string, and show_banner, a boolean) via the Flags SDK evaluate() API, and outputs a home page whose greeting and banner come from those server-side values. It is published by Vercel as part of the open-source Flags SDK repository (628 GitHub stars).
Key Features
- Next.js App Router base — a single example app that installs published SDK packages and builds with the standard Next.js build command.
- Server-side flag evaluation — both flags are resolved with the Flags SDK
evaluate()API rather than in the browser. - Two sample flags —
welcome_message(String, defaultHello from LaunchDarkly) andshow_banner(Boolean, defaulttrue). - LaunchDarkly adapter —
@flags-sdk/launchdarklysuppliesgetProviderData, which loads flag metadata from LaunchDarkly for the Flags Explorer. - Discovery endpoint —
/.well-known/vercel/flagsexposes flag metadata protected byFLAGS_SECRETand reports evaluated values to the toolbar. - Flags Explorer overrides — override the greeting or banner for a single session from the Vercel Toolbar, which is included during local development.
- Shared demo context — every visitor uses the same
demo-usercontext; targeting is added by editingidentifyinflags.ts. - One-click Deploy button — copies only this folder, prompts for
LAUNCHDARKLY_API_KEY,LAUNCHDARKLY_ENVIRONMENT, andFLAGS_SECRET, and installs the LaunchDarkly integration.
How does it work?
- Install the LaunchDarkly integration from the Vercel Marketplace and enable Global Config Syncing; the integration supplies the
EXPERIMENTATION_CONFIGconnection string. - Create
welcome_messageandshow_bannerin your LaunchDarkly environment, enable SDKs using the client-side ID, and turn both flags on. - Set
EXPERIMENTATION_CONFIG,LAUNCHDARKLY_PROJECT_SLUG,LAUNCHDARKLY_CLIENT_SIDE_ID, and a generatedFLAGS_SECRETin.env.local. - Run
pnpm installandpnpm dev, then change flag values in LaunchDarkly and refresh once Global Config has synced.
Who is it for?
- Next.js developers evaluating a feature-flag provider — get a working LaunchDarkly-backed page without writing adapter code.
- Teams standardizing on Flags SDK — use it as the reference pattern for a server-evaluated provider adapter.
- Developers testing Flags Explorer — try session-level overrides in the Vercel Toolbar against real LaunchDarkly flags.
Use cases
- Server-rendered personalization: swap the greeting string for each visitor by replacing the shared
demo-usercontext with your ownidentifylogic. - Progressive rollout of UI changes: toggle
show_bannerin LaunchDarkly and refresh to see the flag take effect after Global Config syncs. - Monorepo development: run the example inside the Flags SDK repository with
turbo run dev --filter=flags-sdk-launchdarkly, where workspace overrides pointflagsand@flags-sdk/launchdarklyat local source.
What are the requirements?
Node.js 22 or newer is recommended. Flags Explorer metadata needs a LaunchDarkly REST API token with read access to flags (LAUNCHDARKLY_API_KEY) plus your environment key (LAUNCHDARKLY_ENVIRONMENT, for example test) — both are separate from the client-side ID and the Global Config connection string. For local toolbar use, link the folder with vercel link and add the same FLAGS_SECRET to the project's Development environment, then restart the dev server.
















