# @openfeature/flagd-web-provider

> ![Experimental](https://img.shields.io/badge/experimental-breaking%20changes%20allowed-yellow)

Latest version **0.8.0** (published 2026-09-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @openfeature/flagd-web-provider
pnpm add @openfeature/flagd-web-provider
yarn add @openfeature/flagd-web-provider
bun add @openfeature/flagd-web-provider
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.8.0 |
| Published | 2026-09-23 |
| First published | 2022-12-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 174.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 75 |
| Maintainers | toddbaert, beeme1mr, lukas.reining, jonathannorris |

## Links

- npm: https://www.npmjs.com/package/@openfeature/flagd-web-provider
- Repository: https://github.com/open-feature/js-sdk-contrib
- Homepage: https://github.com/open-feature/js-sdk-contrib#readme
- Issues: https://github.com/open-feature/js-sdk-contrib/issues
- npm.io page: https://npm.io/package/@openfeature/flagd-web-provider

## Dependencies (3)

- [@bufbuild/protobuf](https://npm.io/package/@bufbuild/protobuf.md) ^1.2.0
- [@connectrpc/connect](https://npm.io/package/@connectrpc/connect.md) ^1.4.0
- [@connectrpc/connect-web](https://npm.io/package/@connectrpc/connect-web.md) ^1.4.0

## Recent versions

- 0.8.0 (latest) — 2026-09-23
- 0.7.4 — 2026-02-12
- 0.7.3 — 2025-03-20
- 0.7.2 — 2024-07-08
- 0.7.1 — 2024-04-26
- 0.7.0 — 2024-04-18
- 0.6.0 — 2024-03-19
- 0.5.1 — 2024-02-15
- 0.5.0 — 2024-02-14
- 0.4.1 — 2023-12-15
- 0.4.0 — 2023-07-31
- 0.3.5 — 2023-07-27
- 0.3.4 — 2023-04-24
- 0.3.3 — 2023-04-06
- 0.3.2 — 2023-03-23
- … 7 more at https://npm.io/package/@openfeature/flagd-web-provider/versions

## README

# flagd-web Provider for OpenFeature

![Experimental](https://img.shields.io/badge/experimental-breaking%20changes%20allowed-yellow)

A feature flag daemon with a Unix philosophy.

## Installation

:warning: This provider requires the use of the experimental @openfeature/web-sdk:

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

```sh
npm install @openfeature/flagd-web-provider
```

## Usage

The `FlagdWebProvider` communicates with flagd via the [connect protocol](https://buf.build/blog/connect-a-better-grpc).

### Available options

| Option name | Type    | Default | Description                                                                                                                                            |
| ----------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| host        | string  |         | sets the host used to connect to the flagd instance                                                                                                    |
| pathPrefix  | string  | ""      | sets the path at which the flagd gRPC service is available, for example: `/api/flagd` (optional)                                                       |
| port        | number  | 443     | sets the port used to connect to the flagd instance                                                                                                    |
| tls         | boolean | true    | when set to true the provider will attempt to connect to flagd via https                                                                               |
| maxRetries  | number  | 0       | Sets the maximum number of retries for a connection to be made to the flagd instance. A value of 0 means unlimited. A negative value means no retries. |
| maxDelay    | number  | 60000   | sets the maximum time in ms to wait between reconnect intervals                                                                                        |

### Reconnection

If the connection to the flagd instance fails, the provider will attempt to reconnect with an exponential back-off. The `maxDelay` and `maxRetries` can be specified to customize reconnect behavior.

### Event streaming

The `FlagdWebProvider` receives events from flagd with changes. Combined with the event API in the web SDK, this allows for subscription to flag value changes in clients.

```typescript
client.addHandler(ProviderEvents.Ready, () => {
  // do something when the configuration has changed.
});
```

### Caching

The `FlagdWebProvider` evaluates flags in bulk, taking into account the evaluation context, and then caches them in memory for local evaluation.
The cache is invalidated when flag configuration change events are received.

## Example

```typescript
OpenFeature.setProvider(
  new FlagdWebProvider({
    host: 'myapp.com',
    port: 443,
    tls: true,
    maxRetries: 10,
    maxDelay: 30000,
  }),
);
```

## Building

Run `npx nx package flagd-web` to build the library.

> NOTE: [Buf](https://docs.buf.build/installation) must be installed to build locally.

## Running unit tests

Run `npx nx test flagd-web` to execute the unit tests via [Jest](https://jestjs.io).

---
_Source: https://npm.io/package/@openfeature/flagd-web-provider · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
