Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A Next.js example for controlling e-commerce UI variants with Vercel Flags, the Flags SDK, and the Flags Explorer.
Vercel Flags SDK Example is a Next.js demo template from the vercel/examples repository that shows how to use Vercel Flags, the Flags SDK, the @flags-sdk/vercel adapter, and the Flags Explorer to control page content with feature flags. The demo renders an e-commerce-style page where banner visibility and a checkout button color change based on flag values managed in the Vercel Dashboard.
This template is a working reference implementation for adding Vercel Flags to a Next.js application. It accepts feature flag definitions created in the Vercel Dashboard — two boolean flags (summer-sale and free-delivery) and one string flag (proceed-to-checkout-color with values blue, green, red) — and uses them to adjust what is rendered on the page. The project lives in the official Vercel examples collection and can be deployed immediately through a one-click Vercel button.
vercel link, the Flags Explorer lets you enable or disable features locally and test overrides securely.vercel link, vercel env pull, and FLAGS_SECRET in .env.local to support precompute and secure Flags Explorer overrides.After deploying and creating the feature flags in the Vercel Dashboard, you pull environment variables with vercel env pull, install dependencies with pnpm install, and start the development server with pnpm dev. The app then reads flag values through the Flags SDK and adjusts rendered content accordingly.
The example defines three feature flags in flags.ts: summer-sale and free-delivery as boolean flags, and proceed-to-checkout-color as a string flag with values blue, green, or red. These exact keys must be created in the Vercel Dashboard.
If the FLAGS or FLAGS_SECRET environment variables are missing, requests are rewritten to a /setup page. That page shows a checklist and the required flag keys, so the app tells you exactly what to configure.
Deploy the template, link the project locally with vercel link, and pull environment variables with vercel env pull. Then set FLAGS_SECRET in .env.local to enable precompute and secure overrides in the Flags Explorer.
Yes. The instructions state that local development requires linking with vercel link, pulling environment variables with vercel env pull, and setting FLAGS_SECRET in .env.local for precompute and secure Flags Explorer overrides.
