Overview

The feature flags SDK by Vercel for Next.js.

This package provides a simple way to use feature flags in your Next.js applications. It can be used no matter if your application is hosted on Vercel or not. It works with App Router, Pages Router and Edge Middleware. It also works with any feature flag provider.

This package encodes the best practices when using feature flags in Next.js. We also understand that you sometimes need to deviate from the golden path, and have examples for those cases as well.

While this package is called @vercel/flags it does not require using Vercel. It is also not limited to feature flags, and can be used for experimentation, A/B testing and any other dynamic flagging of code.

Rendering strategies

In Next.js, there are several ways to render a page. This SDK works with all of them, no matter if you are using server-side rendering, static site generation, partial prerendering or Edge Middleware.

Feature Flag Providers

The Flags SDK works with any feature flag provider. We offer adapters for commonly used providers, but it is also possible to write a custom adapter in case you have an in-house solution for feature flags.