Fturex.Client
1.0.9
dotnet add package Fturex.Client --version 1.0.9
NuGet\Install-Package Fturex.Client -Version 1.0.9
<PackageReference Include="Fturex.Client" Version="1.0.9" />
<PackageVersion Include="Fturex.Client" Version="1.0.9" />
<PackageReference Include="Fturex.Client" />
paket add Fturex.Client --version 1.0.9
#r "nuget: Fturex.Client, 1.0.9"
#:package Fturex.Client@1.0.9
#addin nuget:?package=Fturex.Client&version=1.0.9
#tool nuget:?package=Fturex.Client&version=1.0.9
Fturex.Client — .NET SDK
Official .NET SDK for the Fturex feature toggle service. Provides feature flag evaluation with automatic caching, background refresh, usage statistics, and context-based targeting.
Requirements
- .NET 9 or .NET 10
Installation
dotnet add package Fturex.Client
For OpenTelemetry support, also install the companion package:
dotnet add package Fturex.OpenTelemetry
Quick start
Standalone (console apps, workers, etc.)
var client = new FtureXClient(new FtureXConfiguration
{
AppKey = "your-api-key",
BaseUrl = "https://your-api.com"
});
if (await client.IsEnabled("my-feature"))
{
// feature is on
}
client.Dispose();
ASP.NET Core (DI)
// Program.cs
builder.Services.AddFtureX(new FtureXConfiguration
{
AppKey = builder.Configuration["FtureX:AppKey"],
BaseUrl = builder.Configuration["FtureX:BaseUrl"]
});
// Inject IFtureX wherever you need it
public class MyController(IFtureX features)
{
public async Task<IActionResult> Index()
{
if (await features.IsEnabled("my-feature"))
{
// feature is on
}
return View();
}
}
Context-based targeting
Evaluate features against arbitrary context properties (user, role, tenant, etc.).
var context = new Dictionary<string, string>
{
{ "userId", "user-123" },
{ "role", "admin" }
};
await client.IsEnabled("beta-feature", context);
Extension method shortcuts:
using Fturex.Extensions;
await client.IsEnabledForUser("beta-feature", "user-123");
await client.IsEnabledForRole("beta-feature", "admin");
await client.IsEnabledForTenant("beta-feature", "tenant-abc");
// Arbitrary key/value pairs
await client.IsEnabledWithContext("beta-feature", ("plan", "pro"), ("region", "eu"));
Configuration — FtureXConfiguration
| Property | Type | Default | Description |
|---|---|---|---|
BaseUrl |
string |
required | API base URL |
AppKey |
string |
required | API authentication key |
SendStatistics |
bool |
true |
Include usage statistics in each refresh call |
UseCache |
bool |
true |
Enable in-memory caching |
CacheRefreshIntervalSeconds |
int |
30 |
How often the manifest is refreshed (and stats sent) |
EnableFilePersistence |
bool |
false |
Persist cache to disk across restarts |
CacheFilePath |
string |
feature-manifest.json |
File path for disk persistence |
Caching behaviour
The SDK fetches a full feature manifest from the server and evaluates flags locally. Context properties are matched client-side against the manifest on every call — no separate context cache.
| Feature type | Caching | Refresh |
|---|---|---|
| All features | Indefinite in-memory (+ optional disk) | Background refresh on interval |
Statistics
Usage statistics (hit counts, enabled/disabled counts, last-accessed timestamps) are tracked locally and automatically included in each POST /feature/refresh call when SendStatistics is true. No manual wiring required.
Hooks
Register hooks to observe every flag evaluation — useful for custom logging, analytics, or telemetry.
using Fturex.Hooks;
public class MyLoggingHook : IFtureXHook
{
public Task AfterAsync(HookContext context, EvaluationResult result)
{
Console.WriteLine($"{context.FlagKey} => {result.Value}");
return Task.CompletedTask;
}
}
// Standalone
client.AddHook(new MyLoggingHook());
// DI — resolve after AddFtureX
var ftureX = (FtureXClient)app.Services.GetRequiredService<IFtureX>();
ftureX.AddHook(new MyLoggingHook());
IFtureXHook has three optional methods:
| Method | When called |
|---|---|
BeforeAsync(HookContext) |
Before each evaluation |
AfterAsync(HookContext, EvaluationResult) |
After a successful evaluation |
ErrorAsync(HookContext, Exception) |
When evaluation throws |
OpenTelemetry
Register in Program.cs:
builder.Services.AddFtureX(config);
builder.Services.AddFtureXOpenTelemetry(options =>
{
options.AddSpanEvents = true; // add span events to the active span (default: true)
options.AddMetrics = true; // emit evaluation counters as OTel metrics (default: true)
options.RecordFlagValue = false; // include flag value in span attributes (default: false)
options.SetId = "production"; // optional flag-set identifier
});
builder.Services.AddOpenTelemetry()
.WithTracing(t => t.AddSource(FtureXOtelExtensions.ActivitySourceName))
.WithMetrics(m => m.AddMeter(FtureXOtelExtensions.MeterName));
API compatibility
| Endpoint | Purpose |
|---|---|
POST /feature/refresh |
Fetch manifest and report statistics in one call |
Authentication uses the X-Client-Key request header.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Caching.Memory (>= 9.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
-
net9.0
- Microsoft.Extensions.Caching.Memory (>= 9.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.