flags-sdk
Set up and use the Flags SDK
The Flags SDK (flags npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pages static using the precompute pattern. Vercel Flags is the first-party provider, letting you manage flags from the Vercel dashboard or the vercel flags CLI.
- Docs: https://flags-sdk.dev
- Repo: https://github.com/vercel/flags
When the user asks to install, configure, or set up feature flags, follow Set up the SDK (including vercel env pull when .env.local is missing). When they ask to create or add a flag, follow Create a flag. A request is CLI-only when the user asks to inspect, create, or change a remote flag and the request involves no code; then follow CLI-only flag management. Inside an app repository, treat an ambiguous request as the full flow. Do not leave CLI steps as "next steps" for the user — execute them yourself.
Core concepts
Flags as code
Each flag is declared as a function. No string keys at call sites:
import { flag } from 'flags/next';