Enterprise Feature Flag & Contextual Experimentation Engine
A high-performance, data-private, self-hosted alternative to LaunchDarkly and Statsig. Powered by .NET Core, featuring native SDKs for C#, Python, Go, Node.js, and C++.

Manage environments, targeting rules, and A/B tests from a unified, modern interface.
ToggleMesh is a self-hosted feature management and experimentation platform designed for teams that require strict data privacy, enterprise-grade RBAC, and ultra-low latency.
Unlike SaaS providers that charge by MAU or require your application to make network calls for flag evaluation, ToggleMesh pushes configurations directly to your servers. Your SDKs evaluate rules locally in memory, ensuring zero network overhead and keeping 100% of your user context within your private infrastructure.
| Feature | ToggleMesh | LaunchDarkly | Statsig | Unleash |
|---|---|---|---|---|
| Full Self-Hosting | β | β (Relay only) | β | β |
| Data Privacy (No PII leaves network) | β | β | β | β |
| Zero-Allocation Eval (.NET) | β | β | β | β |
| Built-in MAB A/B Tests | β | β | β | β |
| Real-Time Push | β (SSE) | β | β | |
| Pricing | Free (MIT) | Per-seat | Per-MAU | Freemium |
flowchart TD
classDef ui fill:#18181b,stroke:#3f3f46,stroke-width:2px,color:#f4f4f5;
classDef api fill:#0f172a,stroke:#6366f1,stroke-width:2px,color:#f4f4f5;
classDef db fill:#312e81,stroke:#818cf8,stroke-width:2px,color:#f4f4f5;
classDef cache fill:#7f1d1d,stroke:#f87171,stroke-width:2px,color:#f4f4f5;
classDef sdk fill:#064e3b,stroke:#10b981,stroke-width:2px,color:#f4f4f5;
classDef worker fill:#4c1d95,stroke:#a5b4fc,stroke-width:2px,color:#f4f4f5;
UI[React Admin UI]:::ui -- REST / JWT --> API["ToggleMesh.API<br/>(Management & SSE)"]:::api
API -- Read / Write --> PG[(PostgreSQL)]:::db
API -- EF Interceptor Publish --> REDIS[(Redis Pub/Sub)]:::cache
REDIS -. Fan-out Invalidate .-> API
API == SSE Push ==> SDK["Client & Server SDKs<br/>(Zero-Alloc Eval)"]:::sdk
SDK -- Async Batch Events --> INGEST["ToggleMesh.API<br/>(Ingest Endpoint)"]:::api
subgraph Analytics Pipeline
direction LR
INGEST -- Stream --> KAFKA[(Kafka / Channels)]:::db
KAFKA -- Consume --> CH[(ClickHouse OLAP)]:::db
CH -- Bayesian Query --> WORKER[MAB Rollup Worker]:::worker
end
WORKER -. Auto-adjust traffic .-> PG
Control Plane mutates state -> Interceptor triggers Redis Pub/Sub -> API fans out SSE to connected SDKs.
Prerequisite: A running ToggleMesh server instance. See Self-Hosting & Deployment to spin one up locally in under a minute.
Install the C# SDK and the Global CLI tool:
dotnet add package ToggleMesh.SDK
dotnet tool install --global ToggleMesh.CLIRegister the SDK in your DI container. ToggleMesh can automatically hook into your ambient HttpContext to extract user identity, emails, and roles without manual context passing.
// Program.cs
builder.Services.AddToggleMeshClient(options =>
{
options.BaseUrl = "https://api.togglemesh.dev"; // Your self-hosted Control Plane
options.ApiKey = "tm_server_xxxxxxxx";
}).AddToggleMeshHttpContext(); Sync your flags to generate type-safe constants, then evaluate them in your business logic.
$ togglemesh config
$ togglemesh sync
β Success! Auto-detected C# project. Generated ToggleMeshFlags.g.cs// CheckoutService.cs
public void ProcessOrder(IToggleMeshClient toggleMesh)
{
// Evaluates instantly from in-memory cache. Zero HTTP requests made.
if (toggleMesh.IsEnabled(Flags.NewCheckoutFlow))
{
ExecuteNextGenGateway();
}
}ToggleMesh is engineered for ultra-low-latency microservices where Garbage Collection (GC) pauses are unacceptable.
By leveraging compiled Expression Trees, pre-computed rule groups, C# Source Generators, and readonly ref struct contexts, the ToggleMesh SDK achieves zero-allocation evaluation.
We benchmarked various scenarios: from a simple global toggle to a worst-case scenario evaluating 10 nested AND/OR targeting rules.
| Method | Mean | StdDev | Max | P95 | Allocated |
|---|---|---|---|---|---|
| Evaluate_NoRules_AOT (Baseline) | 6.73 ns | 0.02 ns | 6.76 ns | 6.76 ns | - |
| Evaluate_1Rule_AOT (Typical) | 28.13 ns | 0.08 ns | 28.29 ns | 28.24 ns | - |
| Evaluate_ComplexRule_AOT (MAB/Rollout) | 92.75 ns | 0.35 ns | 93.19 ns | 93.15 ns | - |
| Evaluate_10Rules_AOT (Worst-case) | 120.21 ns | 0.37 ns | 120.75 ns | 120.57 ns | - |
| TrackEvent_10Rules_AOT (Metrics Buffer) | 45.52 ns | 0.15 ns | 45.77 ns | 45.77 ns | - |
Hardware Specs: Intel Core i7-14700K, 20 Physical Cores, Windows 11 x64, .NET 10.0 Release Build.
ToggleMesh decouples heavy I/O operations from the HTTP request-response cycle using bounded in-memory channels (System.Threading.Channels) with DropOldest backpressure.
Local load testing via k6 on a single developer workstation demonstrates the massive throughput capabilities of the Data Plane API.
| Endpoint | Type | Target VUs | Max RPS | p(99) Tail Latency | Error Rate |
|---|---|---|---|---|---|
POST /api/v1/sdk/metrics |
Fire & Forget (Channel) | 2,000 | 115,248/s | 18.59 ms | 0.00% |
POST /api/v1/sdk/evaluate |
Synchronous (Compute) | 2,000 | 112,503/s | 19.22 ms | 0.00% |
POST /api/v1/sdk/events |
Buffered + Livetail (SSE) | 2,000 | 68,301/s | 34.58 ms | 0.00% |
GET /api/v1/sdk/flags |
Synchronous (I/O Cache) | 2,000 | 68,463/s | 36.06 ms | 0.00% |
Test Environment: Intel Core i7-14700K,
k6running locally against Kestrel (Release mode, HTTP). All tests maintained a flawless 0.00% failure rate under sustained load. Data payload bandwidth maxed out at ~179 MB/s during sync.
ToggleMesh provides native SDKs and tooling for your entire microservice fleet.
| Language / Platform | SDK Type | Real-Time Sync | Targeting Evaluation | Maturity |
|---|---|---|---|---|
| .NET (C#) | Server | β (SSE) | Local (Zero-Alloc) | Stable |
| Node.js | Server | β (SSE) | Local | Beta |
| Browser JS / React | Client | β (SSE) | Remote (Secure) | Beta |
| Python | Server | β (SSE) | Local | Beta |
| Go | Server | β (SSE) | Local | MVP |
| Unreal Engine (C++) | Game Client | π (Polling) | Remote | MVP |
- π‘ Push, Not Pull (SSE + Redis): Real-time cache invalidation using Server-Sent Events. No wasteful HTTP polling.
- π― Advanced Targeting Engine: Individual user overrides, Contextual Percentage Rollouts, and Semantic Versioning (SemVer) operators synchronized across all supported SDKs.
- ποΈ Multivariate Flags & Remote Config: Move beyond simple booleans. Serve strongly-typed JSON, strings, or numeric payloads dynamically to your clients, enabling complex UI theming, game balancing, and multi-variant A/B/C testing without deploying new code.
- π§ Contextual Multi-Armed Bandits (MAB): Built-in Bayesian inference engine (Monte Carlo simulations via Beta distributions). Autonomously shifts traffic toward winning variants based on conversion or revenue metrics.
- π¬ Sample Ratio Mismatch (SRM) Detection: Automated background statistical checks (Chi-Square) to detect tracking bugs or critical assignment skews in your A/B tests before they ruin your data.
- π High-Throughput Analytics Ingestion: SDKs buffer metrics client-side. The API ingests telemetry into bounded
System.Threading.ChannelswithDropOldestbackpressure, flushing to PostgreSQL or horizontally scalable Kafka + ClickHouse clusters. - π Integrations & Webhooks: Native Slack and MS Teams notifications, plus SSRF-Protected outbound webhook dispatcher with Polly-powered exponential backoff and Dead-Letter Queues (DLQ).
- π Multi-Tenancy & Security: Organization and Project-level isolation with strict Role-Based Access Control and Two-Factor Authentication.
- π GDPR-Ready by Design: Identity pseudonymization, automatic data retention, PII property redaction, and one-click user data erasure.
- π Personal Access Tokens (PATs): SHA-256 hashed PATs for secure CI/CD and CLI integrations.
- π Immutable Audit Logs: Every configuration change is captured with deep before/after JSON diffs.
- πΎ Offline Resilience: SDKs persist the latest synchronized state to a local JSON fallback file, ensuring safe boot-ups during complete network partitions.
Deploying the core ToggleMesh stack takes under a minute.
curl -o docker-compose.yml https://raw.githubusercontent.com/sdwck/ToggleMesh/main/docker-compose.yml
curl -o .env https://raw.githubusercontent.com/sdwck/ToggleMesh/main/.env.example
docker compose up -d- Admin UI & API:
http://localhost:5264 - API Docs (Scalar):
http://localhost:5264/docs
For production deployments requiring high-throughput analytics and horizontal OLAP scaling, boot the stack using the enterprise override:
curl -o docker-compose.enterprise.yml https://raw.githubusercontent.com/sdwck/ToggleMesh/main/docker-compose.enterprise.yml
docker compose -f docker-compose.yml -f docker-compose.enterprise.yml up -dToggleMesh is released under the MIT License.
Contributions are welcome β please read our Contributing Guidelines before opening a PR.
β If ToggleMesh looks useful, star this repo β it helps others discover it.
Report a Bug Β·
Request a Feature