@vercel/flags-core
v1.0.0
Published
The core evaluation engine for [Vercel Flags](https://vercel.com/docs/flags/vercel-flags), the feature flag platform built into Vercel. This package provides direct access to the flag evaluation client, data fetching, and an [OpenFeature](https://openfeat
Downloads
424,095
Readme
@vercel/flags-core
The core evaluation engine for Vercel Flags, the feature flag platform built into Vercel. This package provides direct access to the flag evaluation client, data fetching, and an OpenFeature provider.
For Next.js and SvelteKit applications, use the Flags SDK with @flags-sdk/vercel provider instead. Use @vercel/flags-core when you need lower-level control, are working with an unsupported framework, or want to use the OpenFeature standard.
Installation
npm i @vercel/flags-coreUsage
import { createClient } from '@vercel/flags-core';
const client = createClient(process.env.FLAGS!);
const result = await client.evaluate<boolean>('show-new-feature', false, {
user: { id: 'user-123' },
});OpenFeature
An OpenFeature-compatible provider is available at @vercel/flags-core/openfeature:
import { OpenFeature } from '@openfeature/server-sdk';
import { VercelProvider } from '@vercel/flags-core/openfeature';
await OpenFeature.setProviderAndWait(new VercelProvider());
const client = OpenFeature.getClient();