Skip to content

Flaggy

A simple, fast, and modular feature flag library for .NET that helps you manage feature toggles with ease.

πŸš€ Features

  • Simple & Fast: Minimal overhead with efficient caching strategies
  • Multiple Providers: Support for MySQL, PostgreSQL, MS SQL Server, and InMemory (with JSON persistence)
  • Flexible Caching: Built-in support for MemoryCache and Redis with automatic cache invalidation
  • Auto-Migration: Automatic database schema creation and version management
  • Flag Values: Store typed values (string, int, double, etc.) in flags, not just on/off states
  • Beautiful Dashboard: Web UI for managing feature flags with secure authentication
  • User Management: Built-in user management with BCrypt password hashing
  • Programmatic API: Full CRUD operations with extension methods and fluent API
  • Easy Integration: Simple configuration with dependency injection
  • Production Ready: Built with best practices and performance in mind

πŸ› οΈ Requirements

  • .NET 9.0 or later
  • One of the supported databases (MySQL, PostgreSQL, MS SQL Server) or use InMemory provider

πŸ“¦ Packages

Core Package

dotnet add package Flaggy

Provider Packages

# MySQL Provider
dotnet add package Flaggy.Provider.MySQL

# PostgreSQL Provider
dotnet add package Flaggy.Provider.PostgreSQL

# MS SQL Server Provider
dotnet add package Flaggy.Provider.MsSql

πŸ’‘ Quick Start

using Flaggy.Extensions;

// 1. Configure Flaggy with a provider
builder.Services.AddFlaggy(options =>
{
    options.UsePostgreSQL(
        connectionString: "Host=localhost;Database=myapp;Username=postgres;Password=pass"
    );
});

var app = builder.Build();

// 2. Add UI Dashboard (optional)
app.UseFlaggyUI();

// 3. Use feature flags in your code
app.MapGet("/api/products", async (IFeatureFlagService flagService) =>
{
    if (await flagService.IsFlagEnabledAsync("new-product-ui"))
    {
        return Results.Ok("New UI is enabled!");
    }
    return Results.Ok("Using legacy UI");
});

app.Run();

🎯 Use Cases

Flaggy is perfect for:

  • Feature Toggles: Enable/disable features without redeployment
  • A/B Testing: Test different versions of features with different user groups
  • Gradual Rollouts: Gradually roll out new features to production
  • Kill Switches: Quickly disable problematic features in production
  • Configuration Management: Manage configuration values dynamically
  • Maintenance Mode: Control application behavior during maintenance
  • Dark Launches: Deploy features in production but keep them disabled

πŸ“š Documentation Structure

Getting Started

Features

Examples

API Reference

Advanced Topics

Guides

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“ž Contact

🌟 Next Steps


Made with ❀️ for the .NET community