Skip to main content
The @westyx-nexus/openfeature-provider-nodejs package wraps a NexusClient as an OpenFeature Server SDK provider. It reads boolean flags from the Nexus flags cache and string/number/object values from the Nexus configs cache - no extra network calls per evaluation.

Requirements

  • @westyx-nexus/sdk-nodejs >= 0.8.0
  • @openfeature/server-sdk >= 1.7.0
  • Node.js >= 22

Installation

The @westyx-nexus/openfeature-provider-nodejs package is published to the same GitLab Package Registry as the main SDK. Ensure the @westyx-nexus scope points to the GitLab registry in your .npmrc - see Installation.

Quick start

Resolution behaviour

All evaluations are served from the in-memory cache - no per-evaluation network call is made. The cache is kept fresh by the SDK’s background polling and SSE live-update stream.

Boolean flags

Boolean values come from the Nexus flags cache (getAllFlags()). A missing key returns the default value with FLAG_NOT_FOUND. No TYPE_MISMATCH is possible because Nexus flags are always boolean.

String configs

The stored config value must already be a string. Numbers, booleans, and objects return TYPE_MISMATCH - use getNumberValue / getObjectValue for those.

Number configs

If the config value is a number it is returned as-is. String values are coerced with Number(raw); NaN yields TYPE_MISMATCH. Other types (boolean, object) also yield TYPE_MISMATCH.

Object configs

The config value must be a non-null object. Primitive values yield TYPE_MISMATCH.

Resolution reasons

All successful resolutions report STATIC. The provider does not perform targeting or segmentation.

Lifecycle

The NexusProvider does not manage the NexusClient lifecycle. Create the client before passing it to NexusProvider, and call client.close() during shutdown as usual.

Migration note (v0.8.0)

getConfig() return type changed from string | undefined to unknown. If you previously relied on the (incorrect) string type, add an explicit as string cast or use typeof value === 'string' narrowing.