> ## Documentation Index
> Fetch the complete documentation index at: https://confidence-auth-testing.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript (Node.js)

> Confidence JavaScript SDK for server-side feature flag evaluation in Node.js.

The Confidence JavaScript SDK provides ultra-low latency feature flag evaluation for Node.js applications using the [Confidence Resolver](https://github.com/spotify/confidence-resolver)—a Rust-based resolver that runs as WebAssembly.

See [Local Resolution](/docs/capabilities/flags/local-resolver.md) for how local resolution works and how to run a self-hosted resolver.

## Features

* **Local evaluation**: Flag rules evaluate on your infrastructure in microseconds
* **OpenFeature compatible**: Standard feature flag API through OpenFeature provider
* **Background sync**: Flag rules and logging sync with Confidence in the background
* **High reliability**: No network dependency at evaluation time

## Installation

```bash npm theme={null}
npm install @spotify-confidence/openfeature-server-provider-local
```

```bash yarn theme={null}
yarn add @spotify-confidence/openfeature-server-provider-local
```

```bash pnpm theme={null}
pnpm add @spotify-confidence/openfeature-server-provider-local
```

**Requirements**: Node.js 18+ with WebAssembly support.

## Quickstart

```typescript theme={null}
import { OpenFeature } from '@openfeature/server-sdk';
import { createConfidenceServerProvider } from '@spotify-confidence/openfeature-server-provider-local';

// Initialize the Confidence provider
const provider = createConfidenceServerProvider({
  flagClientSecret: process.env.CONFIDENCE_FLAG_CLIENT_SECRET!,
});

// Register with OpenFeature
await OpenFeature.setProviderAndWait(provider);
const client = OpenFeature.getClient();

// Evaluate a flag with context
const context = {
  targetingKey: 'user-123',
  country: 'US',
  plan: 'premium',
};

const value = await client.getBooleanValue('my-feature-flag.enabled', false, context);
console.log('Flag value:', value);
```

## Resources

> **[GitHub repository](https://github.com/spotify/confidence-resolver/tree/main/openfeature-provider/js)**
>
> Source code and examples

> **[OpenFeature JS SDK](https://openfeature.dev/docs/reference/technologies/server/javascript)**
>
> OpenFeature documentation

> **[Context](/docs/reference/sdks/context.md)**
>
> Configure evaluation context

> **[Apply events](/docs/reference/sdks/apply-event.md)**
>
> Understand flag assignment tracking
