Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Learn how to set up the LaunchDarkly integration to read flags from Edge Config
LaunchDarkly Integration example — a Next.js boilerplate from Vercel's examples repository that shows how to read LaunchDarkly feature flags from Edge Config using the native Vercel Marketplace integration.
The LaunchDarkly Integration example is a Next.js template that demonstrates how to connect a Next.js application to LaunchDarkly through the Vercel Marketplace integration. It takes a LaunchDarkly client-side ID and an Edge Config connection string as environment variables, evaluates a boolean feature flag, and renders the result on the page. The template runs on Vercel's edge middleware and is authored by Vercel as part of the vercel/examples repository.
NEXT_PUBLIC_LAUNCHDARKLY_CLIENT_SIDE_ID environment variable.EXPERIMENTATION_CONFIG.my-flag flag, with variations true and false, against an org context keyed as my-org-key.pnpm create next-app.https://feature-flag-launchdarkly.vercel.app.The template is aimed at Next.js developers who want to integrate LaunchDarkly feature flags with minimal setup. It's also useful for teams using Vercel and LaunchDarkly who want to understand Edge Config syncing, and for developers exploring edge middleware patterns.
org context kind and verify changes appear on the page.my-flag and turn it ON.org context and displays the result, so toggling targeting changes the page.Edge Config syncing is a LaunchDarkly feature that mirrors feature flag values into a Vercel Edge Config. When you enable it during the Vercel Marketplace installation, a new Edge Config is provisioned and its connection string is exposed as the EXPERIMENTATION_CONFIG environment variable.
The template requires a LaunchDarkly account and a project with an environment that has a client-side ID. You also need to create the my-flag boolean flag in the LaunchDarkly Console before the example works.
The example is written for Next.js specifically. It uses Next.js App Router and edge middleware, so porting to another framework would require adapting the environment variable handling and flag evaluation logic.
You can edit the flag key in the LaunchDarkly Console and update the key in the Next.js code, typically found in app/page.tsx, to match.
