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¶
- Introduction - Learn about Flaggy and its benefits
- Installation - Install and configure Flaggy
- Basic Usage - Your first feature flag
Features¶
- Providers - MySQL, PostgreSQL, MS SQL, and InMemory providers
- Caching - MemoryCache and Redis caching strategies
- Dashboard UI - Web UI for managing flags and users
- User Management - Built-in authentication and user management
- Programmatic API - Manage flags without UI
- Flag Values - Store and retrieve typed values
- Auto-Migration - Automatic database schema management
Examples¶
- Basic Examples - Simple feature flag scenarios
- Advanced Examples - Complex use cases
- Real World Scenarios - Production-ready examples
API Reference¶
- IFeatureFlagService - Core service interface
- IFeatureFlagProvider - Provider interface
- Extension Methods - Helper extension methods
- Models - Feature flag and user models
Advanced Topics¶
- Best Practices - Production best practices
- Performance - Optimization and tuning
- Testing - Testing feature flags
- Integration - Integrate with existing systems
- Custom Providers - Build your own provider
Guides¶
- Migration Guide - Migrate from other feature flag libraries
- Deployment Guide - Deploy Flaggy to production
- Security Guide - Security best practices
π€ 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¶
- GitHub: MuratDincc
- LinkedIn: Murat DinΓ§
- Medium: Murat DinΓ§
π Next Steps¶
Made with β€οΈ for the .NET community