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
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);
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
);
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
);
}
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:
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
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
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);
}
}
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
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 }
);
๐ฑ 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()
}
};
โก 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
๐งช 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"
);
}
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
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
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)