Skip to content

OpenFeature

OpenFeature is the CNCF open standard for feature flagging. The @featureflip/openfeature-node provider connects the OpenFeature Node.js server SDK to Featureflip, so you can use the vendor-neutral OpenFeature API while Featureflip serves your flags.

Terminal window
npm install @openfeature/server-sdk @featureflip/node @featureflip/openfeature-node

Both @openfeature/server-sdk and @featureflip/node are peer dependencies — your application controls their versions and installs a single copy of each. A single @featureflip/node copy is what lets the provider and any direct SDK usage share one underlying client core (see below).

import { OpenFeature } from '@openfeature/server-sdk';
import { FeatureflipProvider } from '@featureflip/openfeature-node';
await OpenFeature.setProviderAndWait(
new FeatureflipProvider({ sdkKey: 'your-server-sdk-key' }),
);
const client = OpenFeature.getClient();
const enabled = await client.getBooleanValue(
'new-checkout',
false,
{ targetingKey: 'user-42', plan: 'pro' },
);

The provider owns the underlying Featureflip client. If you also need the raw SDK (for track() calls outside OpenFeature, for example), call FeatureflipClient.get() with the same SDK key — both handles share one client core. You can also pass an existing FeatureflipClient instance to the provider constructor instead of a config.

OpenFeature contextFeatureflip context
targetingKeyuser_id (used for rollout bucketing)
Any other attributePassed through unchanged

An explicit user_id (or userId) attribute takes precedence over targetingKey. Without either, percentage rollouts bucketed by user serve the control variation — see the SDK’s keyless-context behavior.

Featureflip outcomeOpenFeature reasonerrorCode
Targeting rule matchedTARGETING_MATCH
Fallthrough serveDEFAULT
Flag disabled in environmentDISABLED
Prerequisite not metPREREQUISITE_FAILED
Flag not foundERRORFLAG_NOT_FOUND
Wrong value type requestedERRORTYPE_MISMATCH
Evaluation errorERRORGENERAL

The matched variation key is exposed as variant, and rule/prerequisite details are available in flagMetadata (ruleId, prerequisiteKey).

OpenFeature tracking calls are forwarded to Featureflip custom events:

client.track('purchase', { targetingKey: 'user-42' }, { value: 9.99 });
  • The provider does not yet emit PROVIDER_CONFIGURATION_CHANGED when flags change; evaluations always reflect the latest flag data (the SDK streams updates), but OpenFeature event handlers won’t fire on changes.
  • getObjectValue accepts objects and arrays only: a Json flag holding a bare primitive (string/number/boolean) resolves as TYPE_MISMATCH and returns the default.
  • Other Featureflip SDKs don’t have OpenFeature providers yet — Node.js is the first.