npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@flagward/openfeature-web

v0.1.0

Published

OpenFeature web provider for Flagward - Feature Flags as a Service

Downloads

126

Readme

@flagward/openfeature-web

OpenFeature web provider for Flagward. Flags are downloaded once and evaluated in the browser, so an evaluation costs nothing and never blocks on the network — and changes still arrive in real time over SSE.

If your application already talks to OpenFeature, switching to Flagward is one line. If it does not, you probably want the Flagward adapter for your framework instead (@flagward/react, @flagward/vue, @flagward/solid, @flagward/svelte).

[!NOTE] This provider is for the browser (@openfeature/web-sdk). A server provider for @openfeature/server-sdk is not available yet.

Installation

npm install @openfeature/web-sdk @flagward/openfeature-web

@flagward/core comes with the provider — you do not install it separately.

Quick start

import { OpenFeature } from "@openfeature/web-sdk";
import { FlagwardWebProvider } from "@flagward/openfeature-web";

await OpenFeature.setContext({ targetingKey: user.id, country: user.country });
await OpenFeature.setProviderAndWait(
  new FlagwardWebProvider({
    apiKey: "your-environment-api-key",
    host: "https://flags.example.com",
  }),
);

const client = OpenFeature.getClient();

if (client.getBooleanValue("new-checkout", false)) {
  renderNewCheckout();
}

host is optional and defaults to the hosted service at https://app.flagward.com. The options are the same as FlagwardClient's: apiKey, host, timeout and logLevel.

Coming from another provider, the change is the provider itself:

- OpenFeature.setProvider(new SomeOtherProvider(...));
+ OpenFeature.setProvider(new FlagwardWebProvider({ apiKey }));

The evaluation context

Flagward rules read the same context OpenFeature holds:

  • targetingKey becomes user_id, the identity percentage rollouts and variant splits bucket by. A user_id attribute is used only when there is no targeting key.
  • Every other attribute is a trait, under its own name: country in the context is what a country EQUALS US rule reads.

Changing the context (OpenFeature.setContext) needs nothing from the server: the next evaluation uses it.

Flag types

| OpenFeature call | Flagward flag | Value | | --- | --- | --- | | getBooleanValue | BOOLEAN | the flag's result | | getBooleanValue | MULTIVARIATE | whether the flag is enabled | | getStringValue | MULTIVARIATE | the variant's name | | getStringValue | BOOLEAN | your default, with TYPE_MISMATCH | | getNumberValue, getObjectValue | any | your default, with TYPE_MISMATCH |

A key this environment does not have answers with your default and FLAG_NOT_FOUND.

Reasons

getBooleanDetails and getStringDetails say why a value was chosen:

| Reason | When | | --- | --- | | TARGETING_MATCH | a rule matched and decided the value | | SPLIT | the user's hash bucket picked the variant | | DEFAULT | nothing targeted the user: no rule matched, or there is no targeting key to split by (the control variant) | | STATIC | the value does not depend on the user: an override, or an enabled flag with nothing to target | | DISABLED | the flag is off |

client.getStringDetails("checkout-flow", "control");
// { value: "treatment", variant: "treatment", reason: "SPLIT", ... }

Real-time updates

When a flag changes in the dashboard, the provider emits ConfigurationChanged:

import { ProviderEvents } from "@openfeature/web-sdk";

client.addHandler(ProviderEvents.ConfigurationChanged, () => rerender());

If the flags cannot be loaded — a wrong API key, an unreachable host — setProviderAndWait rejects, the provider is in the ERROR state, and every evaluation answers with its default.

Frameworks

OpenFeature's own SDKs build on this provider:

  • React: @openfeature/react-sdk
  • Angular: @openfeature/angular-sdk

Vue, Solid and Svelte have no OpenFeature SDK; there you use @openfeature/web-sdk directly, or Flagward's adapter for the framework.

Pick one entry point per application. The provider and a Flagward adapter each create their own client, so using both means two connections and two caches that can briefly disagree.

License

MIT