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 |
|---|---|---|---|---|---|
| IsEnabled_NoRules_AOT (Baseline) | 17.34 ns | 0.026 ns | 17.39 ns | 17.38 ns | - |
| IsEnabled_With1Rule_AOT (Typical) | 22.49 ns | 0.055 ns | 22.55 ns | 22.55 ns | - |
| IsEnabled_Complex_AOT (MAB/Rollout) | 81.44 ns | 0.160 ns | 81.82 ns | 81.74 ns | - |
| IsEnabled_With10Rules_AOT (Worst-case) | 127.14 ns | 0.664 ns | 128.12 ns | 127.93 ns | - |
| Track_Event (Metrics Buffer) | 41.58 ns | 0.071 ns | 41.69 ns | 41.69 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.
- π§ 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.
- π 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. - π Multi-Tenancy & RBAC: Organization and Project-level isolation with strict Role-Based Access Control.
- π Personal Access Tokens (PATs): SHA-256 hashed PATs for secure CI/CD and CLI integrations.
- π‘οΈ SSRF-Protected Webhooks: Secure outbound webhook dispatcher with Polly-powered exponential backoff and Dead-Letter Queues (DLQ).
- π Immutable Audit Logs: EF Core
SaveChangesInterceptorscapture deep JSON diffs of every mutation. - πΎ 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.
git clone https://github.com/sdwck/ToggleMesh.git
cd ToggleMesh
cp .env.example .env # Review and customize your secrets here
docker compose up -d- Admin UI:
http://localhost:5173 - 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:
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