Skip to content
Open
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 Mon Jun 08 2026 09:46:34 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:43 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion 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 Mon Jun 08 2026 09:46:35 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:43 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
83 changes: 56 additions & 27 deletions docs/reference/sdks/client/web/angular.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ 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 Mon Jun 08 2026 09:46:35 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:44 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
<a href="https://github.com/open-feature/spec/releases/tag/v0.8.0">
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
</a>

<a href="https://github.com/open-feature/js-sdk/releases/tag/angular-sdk-v1.2.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.2.0&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/js-sdk/releases/tag/angular-sdk-v1.3.1">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.3.1&color=blue&style=for-the-badge" />
</a>

<br/>
Expand All @@ -46,8 +46,8 @@ In addition to the features provided by the [web sdk](/docs/reference/sdks/clien
- [yarn](#yarn)
- [Required peer dependencies](#required-peer-dependencies)
- [Usage](#usage)
- [Module](#module)
- [Minimal Example](#minimal-example)
- [Standalone configuration (recommended)](#standalone-configuration-recommended)
- [NgModule configuration (deprecated)](#ngmodule-configuration-deprecated)
- [How to use](#how-to-use)
- [Structural Directives](#structural-directives)
- [Boolean Feature Flag](#boolean-feature-flag)
Expand Down Expand Up @@ -100,9 +100,44 @@ See the [package.json](https://github.com/open-feature/js-sdk/blob/main/packages

### Usage

#### Module
#### Standalone configuration (recommended)

To configure OpenFeature for your application, import the `OpenFeatureModule` and call `forRoot` to register the provider(s) and optional evaluation context.
For standalone / `bootstrapApplication`-based apps, pass `provideOpenFeature()` in the `providers` array of your `ApplicationConfig`:

```typescript
import { ApplicationConfig } from '@angular/core';
import { provideOpenFeature } from '@openfeature/angular-sdk';

export const appConfig: ApplicationConfig = {
providers: [
provideOpenFeature({
provider: yourFeatureProvider,
// domainBoundProviders are optional, mostly needed if more than one provider is used in the application.
domainBoundProviders: {
domain1: new YourOpenFeatureProvider(),
domain2: new YourOtherOpenFeatureProvider(),
},
}),
],
};
```

Then bootstrap your app with this config:

```typescript
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';

bootstrapApplication(AppComponent, appConfig);
```

#### NgModule configuration (deprecated)

> [!WARNING]
> `OpenFeatureModule` and `forRoot()` are deprecated. Use [`provideOpenFeature()`](#standalone-configuration-recommended) instead.

To configure OpenFeature for NgModule-based applications, import the `OpenFeatureModule` and call `forRoot` to register the provider(s) and optional evaluation context.

```typescript
import { NgModule } from '@angular/core';
Expand Down Expand Up @@ -358,20 +393,19 @@ const flag$ = this.flagService.getBooleanDetails('my-flag', false, 'my-domain',

##### Setting evaluation context

To set the initial evaluation context, you can add the `context` parameter to the `OpenFeatureModule` configuration.
To set the initial evaluation context, you can add the `context` parameter to the `provideOpenFeature()` configuration.
This context can be either an object or a factory function that returns an `EvaluationContext`.

> [!TIP]
> Updating the context can be done directly via the global OpenFeature API using `OpenFeature.setContext()`

Heres how you can define and use the initial client evaluation context:
Here's how you can define and use the initial client evaluation context:

###### Using a static object

```typescript
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { OpenFeatureModule } from '@openfeature/angular-sdk';
import { ApplicationConfig } from '@angular/core';
import { provideOpenFeature } from '@openfeature/angular-sdk';

const initialContext = {
user: {
Expand All @@ -380,37 +414,32 @@ const initialContext = {
},
};

@NgModule({
imports: [
CommonModule,
OpenFeatureModule.forRoot({
export const appConfig: ApplicationConfig = {
providers: [
provideOpenFeature({
provider: yourFeatureProvider,
context: initialContext,
}),
],
})
export class AppModule {}
};
```

###### Using a factory function

```typescript
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { OpenFeatureModule, EvaluationContext } from '@openfeature/angular-sdk';
import { ApplicationConfig } from '@angular/core';
import { provideOpenFeature, EvaluationContext } from '@openfeature/angular-sdk';

const contextFactory = (): EvaluationContext => loadContextFromLocalStorage();

@NgModule({
imports: [
CommonModule,
OpenFeatureModule.forRoot({
export const appConfig: ApplicationConfig = {
providers: [
provideOpenFeature({
provider: yourFeatureProvider,
context: contextFactory,
}),
],
})
export class AppModule {}
};
```

##### Observability considerations
Expand Down
6 changes: 3 additions & 3 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 Mon Jun 08 2026 09:46:34 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:43 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand All @@ -20,8 +20,8 @@ import MCPInstall from '@site/src/partials/mcp-install';
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
</a>

<a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.8.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.8.0&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.9.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.9.0&color=blue&style=for-the-badge" />
</a>

<br/>
Expand Down
6 changes: 3 additions & 3 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 Mon Jun 08 2026 09:46:34 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:43 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand All @@ -20,8 +20,8 @@ import MCPInstall from '@site/src/partials/mcp-install';
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
</a>

<a href="https://github.com/open-feature/js-sdk/releases/tag/react-sdk-v1.3.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.3.0&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/js-sdk/releases/tag/react-sdk-v1.4.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.4.0&color=blue&style=for-the-badge" />
</a>

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

Last updated at Mon Jun 08 2026 09:46:36 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:44 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
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 Mon Jun 08 2026 09:46:35 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:44 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 Mon Jun 08 2026 09:46:33 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:43 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
16 changes: 8 additions & 8 deletions 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 Mon Jun 08 2026 09:46:33 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:43 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down Expand Up @@ -71,7 +71,7 @@ func main() {
// Register your feature flag provider
openfeature.SetProviderAndWait(openfeature.NoopProvider{})
// Create a new client
client := openfeature.NewClient("app")
client := openfeature.NewDefaultClient()
// Evaluate your feature flag
v2Enabled := client.Boolean(
context.TODO(), "v2_enabled", true, openfeature.EvaluationContext{},
Expand Down Expand Up @@ -137,7 +137,7 @@ openfeature.SetEvaluationContext(openfeature.NewTargetlessEvaluationContext(
))

// set a value to the client context
client := openfeature.NewClient("my-app")
client := openfeature.NewDefaultClient()
client.SetEvaluationContext(openfeature.NewTargetlessEvaluationContext(
map[string]any{
"version": "1.4.6",
Expand All @@ -151,7 +151,7 @@ evalCtx := openfeature.NewEvaluationContext(
"company": "Initech",
},
)
boolValue, err := client.BooleanValue(context.TODO(), "boolFlag", false, evalCtx)
boolValue := client.Boolean(context.TODO(), "boolFlag", false, evalCtx)
```

### Hooks
Expand All @@ -167,11 +167,11 @@ Once you've added a hook as a dependency, it can be registered at the global, cl
openfeature.AddHooks(ExampleGlobalHook{})

// add a hook on this client, to run on all evaluations made by this client
client := openfeature.NewClient("my-app")
client := openfeature.NewDefaultClient()
client.AddHooks(ExampleClientHook{})

// add a hook for this evaluation only
value, err := client.BooleanValue(
value := client.Boolean(
context.TODO(), "boolFlag", false, openfeature.EvaluationContext{}, openfeature.WithHooks(ExampleInvocationHook{}),
)
```
Expand All @@ -184,7 +184,7 @@ For example, a flag enhancing the appearance of a UI component might drive user

```go
// initialize a client
client := openfeature.NewClient("my-app")
client := openfeature.NewDefaultClient()

// trigger tracking event action
client.Track(
Expand Down Expand Up @@ -332,7 +332,7 @@ ec := openfeature.TransactionContext(ctx)
tCtx := openfeature.MergeTransactionContext(ctx, openfeature.EvaluationContext{})

// use TransactionContext in a flag evaluation
client.BooleanValue(tCtx, ....)
_ = client.Boolean(tCtx, ....)
```

### Multi-Provider Implementation
Expand Down
21 changes: 11 additions & 10 deletions 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 Mon Jun 08 2026 09:46:33 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:42 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down Expand Up @@ -213,15 +213,15 @@ If the flag management system you're using supports targeting, you can provide t
// set a value to the global context
OpenFeatureAPI api = OpenFeatureAPI.getInstance();
Map<String, Value> apiAttrs = new HashMap<>();
apiAttrs.put("region", new Value(System.getEnv("us-east-1")));
apiAttrs.put("region", new Value(System.getenv("AWS_REGION")));
EvaluationContext apiCtx = new ImmutableContext(apiAttrs);
api.setEvaluationContext(apiCtx);

// set a value to the client context
Map<String, Value> clientAttrs = new HashMap<>();
clientAttrs.put("region", new Value(System.getEnv("us-east-1")));
clientAttrs.put("region", new Value(System.getenv("AWS_REGION")));
EvaluationContext clientCtx = new ImmutableContext(clientAttrs);
Client client = api.getInstance().getClient();
Client client = api.getClient();
client.setEvaluationContext(clientCtx);

// set a value to the invocation context
Expand Down Expand Up @@ -288,7 +288,7 @@ If a domain has no associated provider, the global provider is used.
FeatureProvider scopedProvider = new MyProvider();

// registering the default provider
OpenFeatureAPI.getInstance().setProvider(LocalProvider());
OpenFeatureAPI.getInstance().setProvider(new LocalProvider());
// registering a provider to a domain
OpenFeatureAPI.getInstance().setProvider("my-domain", new CachedProvider());

Expand Down Expand Up @@ -448,25 +448,26 @@ This can be a new repository or included in [the existing contrib repository](ht
Implement your own hook by conforming to the `Hook interface`.

```java
class MyHook implements Hook {
class MyHook implements Hook<Object> {

@Override
public Optional before(HookContext ctx, Map hints) {
public Optional<EvaluationContext> before(HookContext<Object> ctx, Map<String, Object> hints) {
// code that runs before the flag evaluation
return Optional.empty();
}

@Override
public void after(HookContext ctx, FlagEvaluationDetails details, Map hints) {
public void after(HookContext<Object> ctx, FlagEvaluationDetails<Object> details, Map<String, Object> hints) {
// code that runs after the flag evaluation succeeds
}

@Override
public void error(HookContext ctx, Exception error, Map hints) {
public void error(HookContext<Object> ctx, Exception error, Map<String, Object> hints) {
// code that runs when there's an error during a flag evaluation
}

@Override
public void finallyAfter(HookContext ctx, FlagEvaluationDetails details, Map hints) {
public void finallyAfter(HookContext<Object> ctx, FlagEvaluationDetails<Object> details, Map<String, Object> hints) {
// code that runs regardless of success or error
}
};
Expand Down
6 changes: 3 additions & 3 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 Mon Jun 08 2026 09:46:33 GMT+0000 (Coordinated Universal Time)
Last updated at Fri Jun 19 2026 09:42:42 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand All @@ -20,8 +20,8 @@ import MCPInstall from '@site/src/partials/mcp-install';
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
</a>

<a href="https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.21.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.21.0&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.22.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.22.0&color=blue&style=for-the-badge" />
</a>

<br/>
Expand Down
Loading
Loading