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

# Local Resolution

> Reference documentation for in-process and self-hosted flag resolution.

Local resolve providers resolve flags locally within your application using the [OpenFeature](https://openfeature.dev/) specification. The provider fetches all flag and segment state from Confidence and stores it locally. Flag evaluations happen in-process—no network call at resolve time.

Local resolve providers are available for:

* Go
* Java
* JavaScript/TypeScript
* Python
* Rust

## How It Works

The local resolve provider periodically fetches the resolver state for a given client from Confidence. This state contains all flags, segments, targeting rules, and bloom filters for that client. When your application evaluates a flag, the provider resolves it locally against the cached state.

This approach provides fast, predictable response times and removes the dependency on network availability at evaluation time.

## SDK Configuration

Configure the local resolve provider in your SDK. For example, with the JavaScript server SDK:

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

const provider = createConfidenceServerProvider({
  flagClientSecret: process.env.CONFIDENCE_FLAG_CLIENT_SECRET,
});

try {
  await OpenFeature.setProviderAndWait(provider);
} catch (e) {
  console.error('Failed to initialize Confidence provider', e);
}

const client = OpenFeature.getClient();
const value = await client.getBooleanValue('my-feature-flag.enabled', false, context);
```

See the [SDK documentation](/docs/sdks/introduction) for configuration examples in other languages.

## Materialized Segments

Local resolve providers support [materialized segments](/docs/flags/materialized-segments) via bloom filters. When a materialized segment contains up to \~100,000 entities, the resolver state includes its bloom filter and the provider checks membership locally. Larger segments fall back to key-value store lookup over the network.

Bloom filters require no additional setup—Confidence builds and delivers them automatically as part of the resolver state.

## Sticky Assignments

If you want to use sticky assignments with a local resolver, you need access to a low latency key-value storage that can store mappings between entity IDs and variants. Reach out to Confidence support for more information!

<div id="sidecar-resolver" />

## Self-Hosted Resolver

As an alternative to SDK providers, you can run a self-hosted resolver in your network. The resolver exposes the flag resolution API over HTTP. Configure your SDKs to use the resolve URL you host instead of the Confidence managed resolver.

You can operate it as a standalone service or run the container as a sidecar alongside your application. Run it as a sidecar when each application instance needs a resolver on `localhost`.

The self-hosted resolver downloads encrypted flag state from a state URI created in Confidence. It decrypts and caches the state in memory. By default, it checks for updates every 30 seconds and keeps the last successfully loaded state if a refresh fails.

<Note>
  The self-hosted resolver does not support bloom filters for materialized segments. It requires a low latency key-value store for materialized segment lookups.
</Note>

A sidecar deployment is typically available at `http://localhost:8090`. Configure the SDK to use it:

```javascript highlight={3} theme={null}
const confidence = Confidence.create({
  clientSecret: '<flags-client-secret>',
  resolveBaseUrl: 'http://localhost:8090',
  ...
});
```

See [Set Up a Self-Hosted Resolver](/docs/how-to-guides/setup-local-resolver) for configuration, Docker, Kubernetes, and credential rotation instructions.

### Apply Data

By default, the self-hosted resolver sends apply logs to Confidence for exposure and experiment analysis. If you
need to keep apply data within your network, you can disable apply log forwarding while continuing
to accept apply requests. See [Stop Apply Log Propagation](/docs/how-to-guides/setup-local-resolver#stop-apply-log-propagation)
for configuration and behavior details.

<Warning>
  Disabling apply logs degrades experiments and rollouts because Confidence can't observe exposure.
  Exposure counts, experiment results, and rollout monitoring will be missing or incomplete.
</Warning>

## Related Resources

<CardGroup cols={2}>
  <Card title="Set Up a Self-Hosted Resolver" href="/docs/how-to-guides/setup-local-resolver">
    Configure and deploy the resolver
  </Card>

  <Card title="Materialized Segments" href="/docs/flags/materialized-segments">
    Bloom filters and local segment resolution
  </Card>

  <Card title="Data Transfer" href="/docs/flags/data-transfer">
    Understand data flow options
  </Card>

  <Card title="SDKs Reference" href="/docs/sdks/introduction">
    SDK configuration options
  </Card>
</CardGroup>
