Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
See how Vercel's Skew Protection feature enables production-ready blue-green deployments with just a few lines of code.
The Blue-Green Deployments on Vercel template from Vercel Labs demonstrates how to serve two versions of a Next.js app at once and switch traffic between them using Vercel's Edge Config, Middleware, and Skew Protection.
This template is a reference implementation from Vercel Labs for running blue-green deployments on Vercel without a load balancer. It takes two Vercel deployment URLs and a traffic split percentage as input, and outputs a routing decision in a Next.js middleware file that sends each user to either the blue or green deployment. It runs on Vercel's platform and uses Next.js middleware, Edge Config storage, and the Skew Protection feature to keep users on the same deployment for the duration of a session.
The setup involves four steps: deploy the template, activate Skew Protection, enable deployment protection bypass, and create an Edge Config with the blue/green domains and traffic percentage. After that, the middleware reads the config and routes traffic. To execute a deployment, you either edit the Edge Config manually or let the CI/CD pipeline call Vercel's Edge Config API to update the stored domains and percentages.
