Skip to content

A lightweight application built using Aspire to showcase OpenFeature capabilities with a focus on feature flag integration.

License

Notifications You must be signed in to change notification settings

askpt/openfeature-aspire-sample

Repository files navigation

OpenFeature .NET OFREP Demo: Le Mans Winners Management System

.NET 10.0 Aspire OpenFeature OFREP

A demonstration application showcasing OpenFeature Remote Evaluation Protocol (OFREP) capabilities in a .NET environment with React frontend. This application manages a collection of Le Mans winner cars.

What This Demonstrates

This demo showcases how to implement feature flags using OpenFeature and the OFREP (OpenFeature Remote Evaluation Protocol) in a full-stack .NET application with React frontend. Key features include:

  • OFREP Integration: Remote feature flag evaluation using the standardized protocol
  • OpenFeature SDK: Industry-standard feature flagging for both .NET backend and React frontend
  • flagd Provider: Using flagd as the feature flag evaluation engine with OFREP
  • Dynamic Configuration: Real-time feature flag updates without redeployment
  • Full-Stack Implementation: Feature flags working seamlessly across React UI and .NET API
  • Kill Switches: Safely toggle features in production environments

Architecture

Components

  • Garage.Web: React + Vite frontend for managing car collections
  • Garage.ApiService: REST API for car data with Entity Framework Core
  • Garage.ServiceDefaults: Shared services including feature flag implementations
  • Garage.Shared: Common models and DTOs
  • Garage.AppHost: .NET Aspire orchestration and service discovery

Infrastructure

  • PostgreSQL: Database for storing car collection data
  • Redis: Caching layer for improved performance
  • flagd: OpenFeature-compliant feature flag evaluation engine

Telemetry Support

This application includes comprehensive telemetry support through .NET Aspire:

  • Distributed Tracing: Track requests across services
  • Metrics Collection: Monitor application performance and feature flag usage
  • Logging: Centralized log aggregation

Note: When deployed, telemetry will work for the API service but not for the web frontend.

Feature Flags Included

The demo demonstrates these feature flags:

Flag Type Purpose Default
enable-database-winners bool Toggle data source (DB vs JSON) true
winners-count int Control number of winners shown 100
enable-stats-header bool Show/hide statistics header true
enable-tabs bool Enable tabbed interface (with targeting) false

Requirements

Prerequisites

  • .NET 10.0 SDK or later
  • Visual Studio, Visual Studio Code with C# extension or JetBrains Rider
  • Git for version control
  • Docker Desktop (for containerized dependencies)

Quick Start

1. Clone the Repository

git clone https://github.com/open-feature/openfeature-dotnet-workshop.git
cd openfeature-dotnet-workshop

2. Restore Dependencies

dotnet restore

3. Run with .NET Aspire

cd src/Garage.AppHost
dotnet run

4. Access the Application

The application will start with flagd running as a container, providing OFREP endpoints for both the React frontend and .NET API service to consume feature flags.

Additional Resources

License

This project is licensed under the MIT License.

About

A lightweight application built using Aspire to showcase OpenFeature capabilities with a focus on feature flag integration.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •