CommunityToolkit.Aspire.Hosting.Flagd 13.1.0

Prefix Reserved
dotnet add package CommunityToolkit.Aspire.Hosting.Flagd --version 13.1.0
                    
NuGet\Install-Package CommunityToolkit.Aspire.Hosting.Flagd -Version 13.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Flagd" Version="13.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Flagd" Version="13.1.0" />
                    
Directory.Packages.props
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Flagd" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommunityToolkit.Aspire.Hosting.Flagd --version 13.1.0
                    
#r "nuget: CommunityToolkit.Aspire.Hosting.Flagd, 13.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CommunityToolkit.Aspire.Hosting.Flagd@13.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommunityToolkit.Aspire.Hosting.Flagd&version=13.1.0
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.Hosting.Flagd&version=13.1.0
                    
Install as a Cake Tool

CommunityToolkit.Aspire.Hosting.Flagd

A .NET Aspire hosting integration for flagd, a feature flag evaluation engine that provides a ready-made, open source, OpenFeature-compliant feature flag backend system.

Getting started

Prerequisites

  • .NET 8.0 or later
  • Docker (for running the flagd container)

Installation

Install the package by adding a PackageReference to your AppHost project:

<PackageReference Include="CommunityToolkit.Aspire.Hosting.Flagd" />

Usage

In your AppHost project, call the AddFlagd method to add flagd to your application with a flag configuration file:

var builder = DistributedApplication.CreateBuilder(args);

var flagd = builder
    .AddFlagd("flagd")
    .WithBindFileSync("./flags/")
    .WithLogging();

builder.Build().Run();

The fileSource parameter specifies the path to your flag configuration file on the host machine, which will be mounted into the flagd container.

Important: The flagd requires a Sync to be configured. You can use the WithBindFileSync method to configure a file sync. The ./flags/ path is the default path where the flag configuration file is expected to be found. You can change this path to match your configuration.

Configuration

Configuring logging

You can enable the logging for flagd:

var flagd = builder
    .AddFlagd("flagd")
    .WithBindFileSync("./flags")
    .WithLogging();
Customizing the port (flagd endpoint)

You can specify a custom port for the flagd HTTP endpoints:

var flagd = builder.AddFlagd("flagd", port: 9090);

If no port is specified, the default port 8013 will be used.

Customizing the port (OFREP endpoint)

You can specify a custom port for the OFREP HTTP endpoints:

var flagd = builder.AddFlagd("flagd", ofrepPort: 9090);

If no port is specified, the default port 8016 will be used.

Flag Configuration Format

flagd uses JSON files for flag definitions. Please refer to the official documentation for more information. You can create a folder named flags in your project root and place your flagd.json file inside it. It is mandatory for the flag configuration file to be called flagd.json.

Here's a simple example:

{
    "$schema": "https://flagd.dev/schema/v0/flags.json",
    "flags": {
        "welcome-banner": {
            "state": "ENABLED",
            "variants": {
                "on": true,
                "off": false
            },
            "defaultVariant": "off"
        },
        "background-color": {
            "state": "ENABLED",
            "variants": {
                "red": "#FF0000",
                "blue": "#0000FF",
                "yellow": "#FFFF00"
            },
            "defaultVariant": "red",
            "targeting": {
                "if": [
                    {
                        "===": [
                            {
                                "var": "company"
                            },
                            "aspire"
                        ]
                    },
                    "blue"
                ]
            }
        },
        "api-version": {
            "state": "ENABLED",
            "variants": {
                "v1": "1.0",
                "v2": "2.0",
                "v3": "3.0"
            },
            "defaultVariant": "v1"
        }
    }
}

Additional Information

For more information about flagd, visit the official documentation.

To use flagd in your application, you'll need to install an OpenFeature provider for .NET. See the OpenFeature .NET documentation for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
13.1.0 32 1/14/2026
13.1.0-beta.499 33 1/14/2026
13.0.1-beta.498 30 1/14/2026
13.0.1-beta.486 42 1/12/2026
13.0.1-beta.468 639 12/3/2025
13.0.1-beta.467 614 12/3/2025
13.0.0 1,194 11/25/2025
13.0.0-beta.462 144 11/25/2025
13.0.0-beta.456 143 11/23/2025
13.0.0-beta.454 93 11/23/2025
13.0.0-beta.453 114 11/22/2025
13.0.0-beta.450 117 11/22/2025
13.0.0-beta.448 121 11/22/2025
13.0.0-beta.444 351 11/17/2025
13.0.0-beta.443 267 11/17/2025
13.0.0-beta.440 99 11/15/2025
13.0.0-beta.439 236 11/12/2025
13.0.0-beta.438 237 11/12/2025
13.0.0-beta.436 236 11/12/2025
13.0.0-beta.435 247 11/11/2025
13.0.0-beta.433 166 11/10/2025
13.0.0-beta.432 167 11/10/2025
13.0.0-beta.431 149 11/6/2025
13.0.0-beta.430 152 11/6/2025
9.9.0 502 11/3/2025
9.9.0-beta.427 152 11/3/2025
9.8.1-beta.426 165 11/3/2025
9.8.1-beta.424 234 10/28/2025