For the complete documentation index, see llms.txt. This page is also available as Markdown.

OpenFeature Provider for Node.js SDK

Integrate OpenFeature with Harness FME in your Node.js applications to evaluate feature flags, manage contexts, and track events using a standardized SDK.

Integrate your Node.js applications with Harness FME using the Node.js OpenFeature Provider, a standardized, vendor-agnostic feature flagging API. This provider implements the OpenFeature specification and bridges the OpenFeature SDK with the Harness FME Node.js SDK.

This page walks you through installing, configuring, and using the Node.js OpenFeature provider to evaluate feature flags in your Node.js applications.

Before you begin

Before you begin, ensure you have the following:

  • A valid Harness FME SDK key for your project

  • A Node.js environment running version 14.x or later

  • Access to npm or yarn to install dependencies

Version compatibility

Component
Minimum Version

Node.js

14.x+

@splitsoftware/openfeature-js-split-provider

≥ 1.0.0

OpenFeature Node.js SDK

≥ 1.0.0

Install the provider and dependencies

Install the Harness FME OpenFeature provider and required peer dependencies:

npm install @splitsoftware/openfeature-js-split-provider
npm install @splitsoftware/splitio
npm install @openfeature/server-sdk

Initialize the provider

You can register the provider with OpenFeature in one of several ways, depending on your setup.

If you are using an SDK API key:

If you are using a Split client directly (not recommended for new implementations):

The recommended approach is to pass the splitFactory instance instead of a splitClient. This ensures consistency with the JS Web Provider and allows future access to additional splitFactory features beyond the client itself.

Construct an evaluation context

Provide an evaluation context with a targeting key to evaluate flags. The evaluation context passes targeting information such as user IDs, email addresses, or plan types for flag targeting.

For example:

If the same targeting key is reused across evaluations, set the context at the client level:

Or at the API level:

Once the context is set at the client or API level, you don't need to provide it for each evaluation.

Evaluate with details

Use the get*Details(...) APIs to get flag values and metadata (such as variant, reason, error code, and configuration). The FME treatment configuration is returned as a raw JSON string under flagMetadata["config"].

For example:

Track events

The Harness FME OpenFeature provider supports tracking user actions or conversion events directly from your Node.js application.

To enable event tracking, your evaluation context must include the following:

  • A non-empty targetingKey

  • A trafficType (for example, "user" or "account")

  • A non-blank event name

Optionally, you can include a numeric value (defaults to 0) and additional event properties (prefers primitives such as string, number, boolean, or null). For more information, see Sending Events.

For example:

For more information, go to the Harness FME Node.js OpenFeature Provider GitHub repository.

Last updated

Was this helpful?