Use FastStats as an OpenFeature provider on the server or in the browser
OpenFeature is a vendor-neutral API for feature flags.
@faststats/openfeature provides FastStats providers for its server and web
SDKs, so you can read FastStats flags through the OpenFeature client you already
use.
Already using @faststats/web or @faststats/react in the browser? The
built-in SDK shares the visitor and session
with analytics and records exposures only for flags you read.
Both providers take a token: the project’s public token, or a FastStats API
key scoped to the project with the featureFlagEvaluation:evaluate permission.
Only use an API key on the server.
Each evaluation is one request for that one flag, and is recorded as an
exposure.
On the server, the flags service sees your server rather than the visitor. Pass
userAgent so rules can match browser, os, and device, and set country
yourself if your rules use it.
Flags load once, and again whenever the context changes, then resolve from
memory. Browser, OS, device, and country come from the visitor’s own request.
The web provider records every flag it loads as an exposure, whether or not
the app reads it. List the keys your app uses in flags, or every flag in the
project is loaded and counted.
A flag resolves to the default passed at the call site when it does not exist,
is archived, has a different type, or the service cannot be reached within
timeoutMs. The evaluation details carry the matching OpenFeature error code.
const details = await client.getBooleanDetails("new-checkout", false, context);
details.variant; // "on"
details.reason; // OpenFeature reason, such as "TARGETING_MATCH"
details.flagMetadata.reason; // FastStats reason, such as "rule_match"