Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
ConfigCat is a service for feature flag and configuration management. In this template you'll be able to use feature flags at the edge.

Astro landing page starter with gradient background, responsive hamburger/dropdown menu, and switchable floating/fullscreen headers.
A/B Testing with ConfigCat is a Next.js template that runs feature-flag-driven A/B tests at the edge using ConfigCat's feature flag service.
A/B Testing with ConfigCat is an official example from Vercel's examples repository, designed to demonstrate how to use ConfigCat feature flags inside Next.js edge middleware. It takes a ConfigCat SDK key and feature flag configurations as input, and produces A/B-tested pages served from the edge, which reduces layout shift and shrinks JavaScript bundles compared to client-only experimentation. The template is built with Next.js and styled with Tailwind CSS, and it deploys to Vercel. A live demo is available at https://edge-functions-feature-flag-configcat.vercel.app.
_middleware.ts files in the /about and /marketing routes to evaluate different ConfigCat feature flags and serve the appropriate variant directly from the edge.pages/index.tsx) demonstrates how to run A/B tests under a single URL using both server-side rendering and client-side logic.scripts/configcat.js) fetches feature flags and saves them as JSON at build time, so no data fetching happens at the edge./about and /marketing pages, each wired to its own ConfigCat feature flag (FEATURE_FLAG_ABOUT_PAGE and FEATURE_FLAG_MARKETING_PAGE).FEATURE_FLAG_MARKETING_PAGE flag in ConfigCat.FEATURE_FLAG_ABOUT_PAGE flag.To use the template, clone it with create-next-app, create a ConfigCat account, copy .env.example to .env.local, and paste your SDK key. Add the required feature flags in the ConfigCat dashboard, run pnpm dev, and deploy to Vercel. The middleware reads the flags and renders the correct variant for each request at the edge.
