Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference/sdks/client/kotlin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from kotlin-sdk.
Edits should be made here: https://github.com/open-feature/kotlin-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:29 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
47 changes: 38 additions & 9 deletions docs/reference/sdks/client/swift.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from swift-sdk.
Edits should be made here: https://github.com/open-feature/swift-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:29 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down Expand Up @@ -39,10 +39,10 @@ import MCPInstall from '@site/src/partials/mcp-install';
### Requirements

This SDK supports the following Apple platforms:
- **iOS 14+**
- **macOS 11+**
- **watchOS 7+**
- **tvOS 14+**
- **iOS 15+**
- **macOS 12+**
- **watchOS 8+**
- **tvOS 15+**

The SDK is built with Swift 5.5+ and uses only Foundation and Combine frameworks, making it suitable for all Apple platform contexts including mobile, desktop, wearable, and TV applications.

Expand Down Expand Up @@ -345,19 +345,48 @@ A shutdown function is not yet available in the iOS SDK.
To develop a provider, you need to create a new project and include the OpenFeature SDK as a dependency.
You'll then need to write the provider by implementing the `FeatureProvider` interface exported by the OpenFeature SDK.

#### Status ownership

Providers are fully responsible for managing their own status. The SDK reads `status` from the
provider but never sets it. You must keep `status` consistent with the events you emit, and the
property must be thread-safe (it can be read concurrently from flag evaluation paths).

The easiest way to satisfy these requirements is to delegate to `ProviderStatusTracker`.

#### Example implementation

```swift
import Combine
import OpenFeature

final class CustomProvider: FeatureProvider {
var hooks: [any Hook] = []
var metadata: ProviderMetadata = CustomMetadata()

func initialize(initialContext: EvaluationContext?) async {
// add context-aware provider initialisation
// ProviderStatusTracker keeps `status` in sync with emitted events,
// handles thread safety, and replays the current status to new subscribers.
private let statusTracker = ProviderStatusTracker()
var status: ProviderStatus { statusTracker.status }
func observe() -> AnyPublisher<ProviderEvent, Never> { statusTracker.observe() }

func initialize(initialContext: EvaluationContext?) -> Future<Void, Never> {
Future { promise in
// Perform context-aware initialisation, then emit any non-.notReady status.
// .ready and .error are the most common outcomes.
self.statusTracker.send(.ready(nil))
promise(.success(()))
}
}

func onContextSet(oldContext: EvaluationContext?, newContext: EvaluationContext) async {
// add necessary changes on context change
func onContextSet(oldContext: EvaluationContext?, newContext: EvaluationContext) -> Future<Void, Never> {
// Note: this may be called again before a previous lifecycle Future has
// resolved. Cancel any in-flight async work when a new call arrives.
Future { promise in
self.statusTracker.send(.reconciling(nil))
// ... re-initialize with new context ...
self.statusTracker.send(.contextChanged(nil)) // or .error(nil) on failure
promise(.success(()))
}
}

func getBooleanEvaluation(
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/client/web/angular.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:30 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
21 changes: 16 additions & 5 deletions docs/reference/sdks/client/web/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:29 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down Expand Up @@ -287,16 +287,27 @@ A domain is a logical identifier which can be used to associate clients with a p
If a domain has no associated provider, the default provider is used.

```ts
import { OpenFeature, InMemoryProvider } from '@openfeature/web-sdk';
import { OpenFeature, TypedInMemoryProvider } from '@openfeature/web-sdk';

const myFlags = {
v2_enabled: {
variants: {
on: true,
off: false,
},
disabled: false,
defaultVariant: 'on',
},
} as const;

// Registering the default provider
OpenFeature.setProvider(InMemoryProvider(myFlags));
OpenFeature.setProvider(new TypedInMemoryProvider(myFlags));
// Registering a provider to a domain
OpenFeature.setProvider('my-domain', new InMemoryProvider(someOtherFlags));
OpenFeature.setProvider('my-domain', new TypedInMemoryProvider(someOtherFlags));

// A Client bound to the default provider
const clientWithDefault = OpenFeature.getClient();
// A Client bound to the InMemoryProvider provider
// A Client bound to the TypedInMemoryProvider provider
const domainScopedClient = OpenFeature.getClient('my-domain');
```

Expand Down
16 changes: 11 additions & 5 deletions docs/reference/sdks/client/web/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:29 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down Expand Up @@ -100,10 +100,16 @@ See the [package.json](https://github.com/open-feature/js-sdk/blob/main/packages

The `OpenFeatureProvider` is a [React context provider](https://react.dev/reference/react/createContext#provider) which represents a scope for feature flag evaluations within a React application.
It binds an OpenFeature client to all evaluations within child components, and allows the use of evaluation hooks.
The example below shows how to use the `OpenFeatureProvider` with OpenFeature's `InMemoryProvider`.
The example below shows how to use the `OpenFeatureProvider` with OpenFeature's `TypedInMemoryProvider`.

```tsx
import { EvaluationContext, OpenFeatureProvider, useFlag, OpenFeature, InMemoryProvider } from '@openfeature/react-sdk';
import {
EvaluationContext,
OpenFeatureProvider,
useFlag,
OpenFeature,
TypedInMemoryProvider,
} from '@openfeature/react-sdk';

const flagConfig = {
'new-message': {
Expand All @@ -120,11 +126,11 @@ const flagConfig = {
return 'off';
},
},
};
} as const;

// Instantiate and set our provider (be sure this only happens once)!
// Note: there's no need to await its initialization, the React SDK handles re-rendering and suspense for you!
OpenFeature.setProvider(new InMemoryProvider(flagConfig));
OpenFeature.setProvider(new TypedInMemoryProvider(flagConfig));

// Enclose your content in the configured provider
function App() {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/dart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from dart-server-sdk.
Edits should be made here: https://github.com/open-feature/dart-server-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:30 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from dotnet-sdk.
Edits should be made here: https://github.com/open-feature/dotnet-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:28 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from go-sdk.
Edits should be made here: https://github.com/open-feature/go-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:28 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/java.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from java-sdk.
Edits should be made here: https://github.com/open-feature/java-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:27 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
12 changes: 6 additions & 6 deletions docs/reference/sdks/server/javascript/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:27 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down Expand Up @@ -291,7 +291,7 @@ A domain is a logical identifier which can be used to associate clients with a p
If a domain has no associated provider, the default provider is used.

```ts
import { OpenFeature, InMemoryProvider } from '@openfeature/server-sdk';
import { OpenFeature, TypedInMemoryProvider } from '@openfeature/server-sdk';

const myFlags = {
v2_enabled: {
Expand All @@ -302,16 +302,16 @@ const myFlags = {
disabled: false,
defaultVariant: 'on',
},
};
} as const;

// Registering the default provider
OpenFeature.setProvider(InMemoryProvider(myFlags));
OpenFeature.setProvider(new TypedInMemoryProvider(myFlags));
// Registering a provider to a domain
OpenFeature.setProvider('my-domain', new InMemoryProvider(someOtherFlags));
OpenFeature.setProvider('my-domain', new TypedInMemoryProvider(someOtherFlags));

// A Client bound to the default provider
const clientWithDefault = OpenFeature.getClient();
// A Client bound to the InMemoryProvider provider
// A Client bound to the TypedInMemoryProvider provider
const domainScopedClient = OpenFeature.getClient('my-domain');
```

Expand Down
10 changes: 5 additions & 5 deletions docs/reference/sdks/server/javascript/nestjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:28 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down Expand Up @@ -83,24 +83,24 @@ The minimum required version of `@openfeature/server-sdk` currently is `1.7.5`.

### Usage

The example below shows how to use the `OpenFeatureModule` with OpenFeature's `InMemoryProvider`.
The example below shows how to use the `OpenFeatureModule` with OpenFeature's `TypedInMemoryProvider`.

```ts
import { Module } from '@nestjs/common';
import { OpenFeatureModule, InMemoryProvider } from '@openfeature/nestjs-sdk';
import { OpenFeatureModule, TypedInMemoryProvider } from '@openfeature/nestjs-sdk';

@Module({
imports: [
OpenFeatureModule.forRoot({
defaultProvider: new InMemoryProvider({
defaultProvider: new TypedInMemoryProvider({
testBooleanFlag: {
defaultVariant: 'default',
variants: { default: true },
disabled: false,
},
}),
providers: {
differentProvider: new InMemoryProvider(),
differentProvider: new TypedInMemoryProvider(),
},
}),
],
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/php.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from php-sdk.
Edits should be made here: https://github.com/open-feature/php-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:28 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from python-sdk.
Edits should be made here: https://github.com/open-feature/python-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:28 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/ruby.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from ruby-sdk.
Edits should be made here: https://github.com/open-feature/ruby-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:29 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/rust.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from rust-sdk.
Edits should be made here: https://github.com/open-feature/rust-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Wed Apr 08 2026 08:34:30 GMT+0000 (Coordinated Universal Time)
Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
Loading