Everything Vercel Inc. publishes
V

Vercel Inc.

Flags SDK Reference

/docs/flags/flags-sdk-reference

docs
Words
235
Reading time
1 min
Last crawled
2026-09-26
Cited by
3 of their pages
Language
EN
cat vercel.com/docs/flags/flags-sdk-reference.md
The Flags SDK is a free, open-source library that gives you the tools you need to use feature flags in Next.js and SvelteKit applications. It works with any flag provider, custom setups, or no provider at all. This page provides an overview of key concepts and APIs. For complete API documentation, visit [flags-sdk.dev](https://flags-sdk.dev/), the official source of truth for the Flags SDK. -   Framework-native: Built specifically for Next.js (App Router, Pages Router, Middleware) and SvelteKit-   Provider-agnostic: Works with any [flag provider](https://flags-sdk.dev/docs/adapters/supported-providers) or [custom adapters](https://flags-sdk.dev/docs/adapters/custom-adapters)-   Type-safe: Full TypeScript support with type inference-   Optimized for performance: Uses precompute pattern for static generation-   Integrated: Works seamlessly with Flags Explorer and Vercel observability features Flags are defined using the `flag()` function. Each flag has a key and a `decide` function that returns the flag's value: The `decide` function determines a flag's value. It can be sync or async, and can access request context: Flags can have multiple options for A/B testing and experimentation: The precompute pattern generates multiple versions of static pages with different flag values: Learn more about [precompute on flags-sdk.dev](https://flags-sdk.dev/docs/core-concepts/precompute). Call your flag functions to read their values: Report flag values for observability (automatic with SDK): Handle flag overrides from Flags Explorer (automatic with SDK integrations): Create a Flags API endpoint for Flags Explorer: The Flags SDK works with many providers out of the box: For the full API documentation, including all functions, types, and advanced patterns, visit: