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

# OpenFeature integration

> Use the Westyx Nexus Spring Boot SDK as an OpenFeature provider.

The `nexus-openfeature-spring-boot` artifact wraps `NexusClient` behind the
[OpenFeature](https://openfeature.dev) Java SDK standard. Install it alongside the main starter
when your team uses the OpenFeature API.

## Installation

```xml theme={null}
<dependency>
  <groupId>dev.westyx.nexus</groupId>
  <artifactId>nexus-spring-boot-starter</artifactId>
  <version>0.10.0</version>
</dependency>
<dependency>
  <groupId>dev.westyx.nexus</groupId>
  <artifactId>nexus-openfeature-spring-boot</artifactId>
  <version>0.10.0</version>
</dependency>
```

```kotlin theme={null}
implementation("dev.westyx.nexus:nexus-spring-boot-starter:0.10.0")
implementation("dev.westyx.nexus:nexus-openfeature-spring-boot:0.10.0")
```

## Register the provider

```java theme={null}
import dev.openfeature.sdk.OpenFeatureAPI;
import dev.westyx.nexus.openfeature.NexusProvider;

@PostConstruct
void configureOpenFeature() {
    OpenFeatureAPI.getInstance().setProvider(new NexusProvider(nexusClient));
}
```

## Usage

```java theme={null}
Client ofClient = OpenFeatureAPI.getInstance().getClient("my-service");
MutableContext ctx = new MutableContext();

boolean darkMode  = ofClient.getBooleanValue("dark-mode", false, ctx);
String  apiUrl    = ofClient.getStringValue("api.base-url", "https://default.example.com", ctx);
double  rateLimit = ofClient.getDoubleValue("rate-limit", 100.0, ctx);
int     maxItems  = ofClient.getIntegerValue("max-items", 50, ctx);
```

## Evaluation behaviour

| OpenFeature type | Nexus source                                 | Miss                     | Wrong type     |
| ---------------- | -------------------------------------------- | ------------------------ | -------------- |
| `Boolean`        | `NexusClient.getFlag(key, default)`          | Returns default (STATIC) | n/a            |
| `String`         | `NexusClient.getConfig(key)` - `isTextual()` | FLAG\_NOT\_FOUND         | TYPE\_MISMATCH |
| `Double`         | `NexusClient.getConfig(key)` - `isNumber()`  | FLAG\_NOT\_FOUND         | TYPE\_MISMATCH |
| `Integer`        | `NexusClient.getConfig(key)` - `isNumber()`  | FLAG\_NOT\_FOUND         | TYPE\_MISMATCH |
| `Object`         | `NexusClient.getConfig(key)` - any type      | FLAG\_NOT\_FOUND         | n/a            |

`EvaluationContext` is accepted but ignored - Nexus has no per-user targeting.
All successful evaluations return `STATIC` reason.
