DEV Community

Cover image for Stop Paying for Feature Flags: Meet ToggleNet, the Open-Source .NET Alternative
Carlo Luisito Adap
Carlo Luisito Adap

Posted on

Stop Paying for Feature Flags: Meet ToggleNet, the Open-Source .NET Alternative

How I built a full-featured feature flag system that rivals expensive SaaS solutions - and why you should consider it for your next .NET project

ToggleNet Dashboard Overview

Let's be honest: feature flags are no longer a "nice-to-have" - they're essential. But if you're like most developers, you've probably experienced the frustration of hitting limits on popular SaaS solutions or justifying yet another monthly subscription to your finance team.

What if I told you there's a better way?

After years of wrestling with expensive feature flag services and their limitations, I built ToggleNet - a comprehensive, open-source feature flag SDK that brings enterprise-grade functionality to .NET applications without the enterprise price tag.

The Problem with Current Solutions

Before diving into ToggleNet, let's acknowledge the elephant in the room. Existing feature flag solutions generally fall into three categories:

SaaS Solutions (LaunchDarkly, Split, etc.)

  • ๐Ÿ’ธ Expensive monthly subscriptions ($50-$500+ per month)
  • ๐Ÿ”’ Your data lives on their servers
  • ๐Ÿ“Š Usage limits and per-seat pricing
  • ๐ŸŽฏ Great features, but at a premium cost

Simple Open-Source Libraries

  • โœ… Free and open
  • โŒ Limited to basic on/off functionality
  • โŒ No dashboard or management UI
  • โŒ Minimal targeting capabilities

Build Your Own

  • ๐Ÿ›  Complete control
  • โฐ Months of development time
  • ๐Ÿ› All the bugs and edge cases to solve yourself
  • ๐Ÿ”„ Ongoing maintenance burden

The sweet spot? A feature-rich, open-source solution that doesn't compromise on functionality. That's exactly what ToggleNet delivers.

What Makes ToggleNet Different?

Here's where things get interesting. ToggleNet isn't just another basic feature flag library - it's a complete feature management platform that rivals expensive SaaS solutions:

๐ŸŽฏ Sophisticated Targeting Beyond Percentages

While most libraries stop at "show this to 20% of users," ToggleNet lets you create complex targeting rules:

// Target enterprise customers in North America using mobile devices
var userContext = new UserContext
{
    UserId = "user123",
    Attributes = new Dictionary<string, object>
    {
        ["country"] = "US",
        ["plan"] = "enterprise",
        ["deviceType"] = "mobile",
        ["appVersion"] = "2.1.0"
    }
};

bool showPremiumFeature = await _featureFlagManager
    .IsEnabledAsync("premium-analytics", userContext);
Enter fullscreen mode Exit fullscreen mode

Real talk: This level of targeting usually costs hundreds per month in SaaS solutions. ToggleNet gives it to you for free.

Targeting operators include:

  • String matching: Equals, Contains, StartsWith, Regex
  • List operations: In, NotIn (perfect for country codes, user segments)
  • Numeric comparisons: GreaterThan, LessThan (age, account value, etc.)
  • Date operations: Before, After (account creation date, subscription expiry)
  • Version comparisons: VersionGreaterThan, VersionLessThan (semantic versioning support)

โฐ Time-Based Scheduling (Set It and Forget It)

Remember the last time you had to wake up at 3 AM to manually enable a Black Friday sale? Yeah, me too. ToggleNet's scheduling system eliminates those moments:

// Schedule your Black Friday sale to start automatically
await _scheduler.ScheduleActivationAsync(
    "black-friday-deals", 
    new DateTime(2025, 11, 29, 0, 1, 0), // Start time
    TimeSpan.FromDays(4),                // Duration (through Cyber Monday)
    "America/New_York"                   // Timezone support
);

// Need an emergency feature toggle? Activate temporarily right now
await _scheduler.ScheduleTemporaryActivationAsync(
    "emergency-maintenance-banner",
    TimeSpan.FromHours(2) // Auto-disable in 2 hours
);
Enter fullscreen mode Exit fullscreen mode

Pro tip: The timezone support is a game-changer for global applications. No more UTC conversion headaches.

๐Ÿ“Š Built-in Analytics (No More Guessing)

Stop wondering if anyone actually uses your features:

// Automatic usage tracking
bool showNewCheckout = await _featureFlagManager
    .IsEnabledAsync("redesigned-checkout", userContext);

// Custom event tracking for conversions
if (checkoutCompleted)
{
    await _featureFlagManager.TrackFeatureUsageAsync(
        "redesigned-checkout", 
        userId, 
        "checkout-completed" // Custom context
    );
}
Enter fullscreen mode Exit fullscreen mode

The analytics dashboard shows you:

  • Who's using what - User engagement per feature
  • Conversion tracking - Did that new feature actually improve metrics?
  • Time-based insights - Usage trends over 7, 30, or 90 days
  • A/B test results - Real data to drive decisions

๐ŸŽ› Professional Dashboard (No Code Required)

Here's where ToggleNet really shines. While most open-source libraries leave you writing custom admin interfaces, ToggleNet includes a polished, production-ready dashboard:

ToggleNet Dashboard

What your non-technical team members will love:

  • Visual rule builder - Create complex targeting without touching code
  • Real-time testing - See exactly how features appear for different users
  • Scheduling interface - Set up campaigns with a few clicks
  • Analytics overview - Charts and metrics that actually make sense
  • Secure access - Built-in authentication, no additional setup needed

What you'll love as a developer:

  • No maintenance - It just works
  • Responsive design - Looks great on mobile
  • Fast performance - Built with ASP.NET Core
  • Customizable - Extend or modify as needed

Getting Started (Seriously, It's This Easy)

Let me show you how quickly you can get ToggleNet running. This isn't marketing fluff - you can literally have feature flags working in under 10 minutes:

Step 1: Install the Packages

dotnet add package ToggleNet.Core
dotnet add package ToggleNet.EntityFrameworkCore
dotnet add package ToggleNet.Dashboard
Enter fullscreen mode Exit fullscreen mode

Step 2: Configure Your Services

Add this to your Program.cs:

using ToggleNet.Dashboard;
using ToggleNet.Dashboard.Auth;
using ToggleNet.EntityFrameworkCore.Extensions;

// Database setup (PostgreSQL or SQL Server)
services.AddEfCoreFeatureStorePostgres(
    Configuration.GetConnectionString("DefaultConnection"),
    "Development");

// Dashboard with secure access
services.AddToggleNetDashboard(
    new DashboardUserCredential 
    { 
        Username = "admin", 
        Password = "your-secure-password", // Change this!
        DisplayName = "Administrator" 
    }
);

// Enable the dashboard
app.UseToggleNetDashboard(); // Available at /feature-flags
Enter fullscreen mode Exit fullscreen mode

Step 3: Use It in Your Controllers

public class ProductController : Controller
{
    private readonly FeatureFlagManager _featureFlagManager;

    public ProductController(FeatureFlagManager featureFlagManager)
    {
        _featureFlagManager = featureFlagManager;
    }

    public async Task<IActionResult> Details(int productId)
    {
        // Check if user should see the new product recommendations
        var userAttributes = new Dictionary<string, object>
        {
            ["country"] = GetUserCountry(),
            ["isPremium"] = User.HasClaim("plan", "premium")
        };

        bool showRecommendations = await _featureFlagManager
            .IsEnabledAsync("ai-recommendations", User.Identity.Name, userAttributes);

        var model = new ProductViewModel
        {
            Product = await GetProduct(productId),
            ShowAIRecommendations = showRecommendations
        };

        return View(model);
    }
}
Enter fullscreen mode Exit fullscreen mode

That's it. Your app now has enterprise-grade feature flag capabilities.

Real-World Scenarios (Where ToggleNet Shines)

Let me share some scenarios where ToggleNet has proven its worth in production applications:

๐Ÿš€ Scenario 1: The "Gradual Enterprise Rollout"

// Week 1: Start with beta users only
// Targeting: betaTester = true, 100% rollout

// Week 2: Add enterprise customers in North America  
// Targeting: plan = "enterprise" AND country IN ["US", "CA"], 25% rollout

// Week 3: All enterprise customers globally
// Targeting: plan = "enterprise", 75% rollout

// Week 4: Everyone gets it
// No targeting rules, 100% rollout
Enter fullscreen mode Exit fullscreen mode

Why this works: You catch issues early with your most engaged users, then gradually expand. If something breaks, you're not taking down your entire customer base.

๐ŸŒ Scenario 2: The "Regional Compliance Feature"

// GDPR compliance features only for EU users
// Targeting: country IN ["DE", "FR", "IT", "ES", "NL", ...], 100% rollout

// Different data retention policies by region
var userRegion = GetUserRegion(userId);
bool showExtendedRetention = await _featureFlagManager.IsEnabledAsync(
    "extended-data-retention", 
    userId, 
    new Dictionary<string, object> { ["region"] = userRegion }
);
Enter fullscreen mode Exit fullscreen mode

๐Ÿ“ฑ Scenario 3: The "Mobile-First Feature"

// New mobile checkout flow - only for mobile users with recent app versions
// Targeting: deviceType = "mobile" AND appVersion >= "3.2.0", 50% rollout

var userContext = new UserContext
{
    UserId = userId,
    Attributes = new Dictionary<string, object>
    {
        ["deviceType"] = Request.IsMobile() ? "mobile" : "desktop",
        ["appVersion"] = GetAppVersion(),
        ["connectionSpeed"] = GetConnectionSpeed()
    }
};
Enter fullscreen mode Exit fullscreen mode

โšก Scenario 4: The "Emergency Response"

// Black Friday disaster? Enable maintenance mode instantly
await _scheduler.ScheduleTemporaryActivationAsync(
    "maintenance-mode",
    TimeSpan.FromMinutes(30) // Buy yourself time to fix things
);

// Traffic spike overwhelming a new feature? Dial it back immediately
// Change rollout from 100% to 10% via dashboard - no deployment needed
Enter fullscreen mode Exit fullscreen mode

๐Ÿงช Scenario 5: The "A/B Test That Actually Matters"

// Test: Does the new onboarding flow improve conversion?
// Group A: Original flow (50% of new users)
// Group B: New flow (50% of new users)

bool useNewOnboarding = await _featureFlagManager.IsEnabledAsync(
    "streamlined-onboarding", 
    userId,
    new Dictionary<string, object> 
    { 
        ["isNewUser"] = true,
        ["signupDate"] = DateTime.UtcNow
    }
);

// Track the important metrics
if (onboardingCompleted)
{
    await _featureFlagManager.TrackFeatureUsageAsync(
        useNewOnboarding ? "streamlined-onboarding" : "original-onboarding",
        userId,
        "onboarding-completed"
    );
}
Enter fullscreen mode Exit fullscreen mode

The Numbers Game: ToggleNet vs. SaaS Solutions

Let's talk ROI. Here's what you're actually saving:

๐Ÿ’ฐ Cost Comparison (Annual)

Solution Small Team (5 devs) Medium Team (25 devs) Enterprise (100+ devs)
LaunchDarkly $1,200-$2,400/year $6,000-$12,000/year $25,000-$50,000+/year
Harness (Split.io) $2,000-$4,000/year $10,000-$20,000/year $40,000-$80,000+/year
Optimizely $3,000-$6,000/year $15,000-$30,000/year $60,000-$120,000+/year
ToggleNet $0 $0 $0

Pricing estimates based on typical usage patterns and publicly available information. Actual costs may vary based on usage volume, MAU, and specific requirements.

๐Ÿš€ Feature Comparison

Feature SaaS Solutions ToggleNet
Advanced Targeting โœ… ($$$) โœ… (Free)
Time-based Scheduling โœ… ($$$) โœ… (Free)
Analytics Dashboard โœ… ($$$) โœ… (Free)
Unlimited Flags โŒ (Limits) โœ… (Unlimited)
Unlimited Users โŒ (Per-seat pricing) โœ… (Unlimited)
Data Sovereignty โŒ (Their servers) โœ… (Your infrastructure)
Custom Integrations โŒ (API limits) โœ… (Full control)

Bottom line: Even a small team saves thousands per year, and you get more features and control.

Production-Ready From Day One

Don't let "open source" fool you into thinking this is a hobby project. ToggleNet is built for production:

๐Ÿ”’ Security First

  • Built-in authentication - Dashboard is secured by default
  • Environment isolation - Separate configs for dev/staging/prod
  • Audit trails - Every change is logged
  • Data encryption - Your feature flag data stays private

โšก Performance Optimized

  • Minimal overhead - Microsecond evaluation times
  • Database agnostic - PostgreSQL or SQL Server support
  • Connection pooling - Handles high-traffic scenarios
  • Async-first - Non-blocking operations throughout

๐Ÿ›ก Battle-Tested

  • Comprehensive test suite - Unit, integration, and performance tests
  • CI/CD pipeline - Automated testing before every release
  • Real-world usage - Running in production environments
  • Semantic versioning - Predictable updates and compatibility

Analytics Dashboard
Real-time analytics showing feature usage patterns and user engagement

Why Choose ToggleNet?

Compared to SaaS Solutions:

  • โœ… No monthly costs - One-time setup, forever free
  • โœ… Data sovereignty - Your data stays in your infrastructure
  • โœ… No limits - Unlimited features, users, and requests
  • โœ… Custom integrations - Extend as needed

Compared to Simple Libraries:

  • โœ… Advanced targeting - Beyond simple percentage rollouts
  • โœ… Time-based scheduling - Automated feature lifecycle
  • โœ… Built-in dashboard - No need for separate UI tools
  • โœ… Analytics included - Track usage without external tools

Compared to Building Your Own:

  • โœ… Battle-tested - Production-ready with comprehensive tests
  • โœ… Feature-complete - Advanced capabilities out of the box
  • โœ… Maintained and supported - Regular updates and improvements
  • โœ… Documentation - Comprehensive guides and examples

Getting Involved

ToggleNet is open source and welcomes contributions:

  • GitHub Repository: https://github.com/carloluisito/ToggleNet
  • NuGet Package: Available on NuGet Gallery
  • Documentation: Comprehensive guides and examples
  • Sample Application: Complete working example included

Contributing

We welcome:

  • ๐Ÿ› Bug reports and fixes
  • ๐Ÿ’ก Feature requests and implementations
  • ๐Ÿ“š Documentation improvements
  • ๐Ÿงช Additional test coverage

Try It Today

Ready to modernize your feature flag strategy? ToggleNet provides enterprise-grade functionality without the enterprise price tag.

# Quick start
dotnet new webapi -n MyToggleNetApp
cd MyToggleNetApp
dotnet add package ToggleNet.Core
dotnet add package ToggleNet.EntityFrameworkCore
dotnet add package ToggleNet.Dashboard
Enter fullscreen mode Exit fullscreen mode

Check out the complete sample application to see ToggleNet in action, or dive into the comprehensive documentation to learn more.

Final Thoughts

Feature flags are no longer optional in modern software development. The question isn't whether you need them - it's whether you want to pay hundreds or thousands per month for functionality you can get for free.

ToggleNet proves that open source doesn't mean "basic" or "enterprise features sold separately." It means a community of developers building something better together.

Try ToggleNet today. Your finance team will thank you, your developers will love the flexibility, and your customers will benefit from safer, more controlled feature rollouts.


What's your experience with feature flag solutions? Have you calculated how much you're spending on SaaS alternatives? Drop a comment below and let's discuss! For questions, contributions, or just to say hi, visit the ToggleNet GitHub repository.


Top comments (0)