Vercel
The @flags-sdk/vercel package connects the Flags SDK to Vercel's own feature flags platform called Vercel Flags, allowing you to manage flags directly in your Vercel projects.
Learn more about Vercel Flags
Learn more about Adapters
Installation
Install the Vercel adapter package:
Quickstart
1. Create a feature flag in Vercel
Create your first feature flag in the Vercel dashboard:
Create Flag
You can create a simple boolean feature flag called example-flag for this quickstart.
When you create a flag, Vercel automatically configures these environment variables:
FLAGS- SDK Key for your Vercel Flags projectFLAGS_SECRET- Secret key used by Flags Explorer for flag overrides
2. Sync environment variables
Pull the environment variables to your local project using Vercel CLI:
You might need to run vercel link first in case you did not link your project to Vercel yet.
3. Declare the flag in your code
Use the vercelAdapter to connect your flag declaration to Vercel Flags:
The vercelAdapter() automatically uses the FLAGS environment variable to connect to your Vercel Flags project.
4. Use the flag
Call the flag as a function to resolve its value:
You can now toggle the feature flag for the development environment on the Vercel dashboard and you should see the updated flag value locally after reloading the page.
User targeting
Target specific users or groups by providing an identify function that returns context about the current user, team, or other entities.
Configure which entities are available for targeting in your Vercel Flags project:
Configure Entities
This allows you to create targeting rules in Vercel Flags based on your specific entity types (users, teams, organizations, etc.).
Flags Explorer integration
Flags Explorer provides a UI for viewing and overriding flags during development and testing.
To enable full integration, create a flags discovery endpoint:
This endpoint allows Flags Explorer to:
- Discover all flags defined in your codebase
- Show flag metadata and default values
- Enable local overrides during development
Advanced configuration
Custom adapter configuration
To connect to a different Vercel Flags project or use a custom SDK Key: