How to build zero-CLS A/B tests with Next.js and Vercel Edge Config
Mar 23, 2023

Summary
This post details the implementation of a high-performance A/B testing engine for vercel.com using Next.js and Vercel Edge Config. It introduces a system for creating type-safe experiments, pre-rendering experiment variations using dynamic routes and `getStaticPaths`/`getStaticProps`, serving experiments to users via Next.js Middleware rewrites powered by Edge Config and user cookies, and automatically capturing events with a React Context. The engine aims to provide zero Cumulative Layout Shift (CLS) and a great developer experience for experiments.