I built NFlux after years of struggling with boilerplate event code in trading platforms. My goal is to help others avoid the same pitfalls and accelerate their journey into event-driven architectures.
What is Nflux?
Designing real-time systems is one of the hardest challenges in modern software engineering.
Whether you’re building trading platforms, IoT applications, or high-throughput APIs, you need low-latency, fault-tolerant, event-driven architectures that can scale.
That’s exactly what NFlux was created for.
NFlux is an open-source framework built on .NET 9 that makes it easier to design, orchestrate, and observe event-driven domains. Instead of writing endless boilerplate code, you can focus on your business logic, while NFlux handles orchestration, lifecycle management, observability, and integration patterns.
Why NFlux?
Let’s face it:
Writing event publishers and consumers by hand is repetitive.
Keeping track of domain cycles, retries, and orchestration timers is tricky.
Adding metrics, logs, and tracing on top of that often becomes an afterthought.
NFlux removes that friction. It gives you a structured way to:
✅ Define domains that react to events and commands
✅ Orchestrate tenant cycles with built-in timers (inactivity, recycle, retry)
✅ Normalize and process data in real-time pipelines
✅ Expose endpoints with automatic discovery
✅ Collect metrics out of the box using OpenTelemetry
Core Concepts
- Domains
In NFlux, a domain represents a self-contained business capability.
Each domain reacts to events and executes commands.
This maps naturally to DDD (Domain-Driven Design): your trading engine, your symbol watcher, or your risk manager can all become independent domains.
- Events & Commands
Events describe what happened.
Commands describe what should happen next.
NFlux makes publishing and handling these objects trivial, while providing in-memory event stores for testing and QA.
- Orchestrators
Every real-time system needs orchestration.
NFlux provides BaseSocketOrchestratorHostedService, which manages:
- Start/stop lifecycle
- Inactivity timers
- Recycling cycles
- Triggered cycles (via events)
This ensures domains keep running without manual babysitting.
- Observability First
NFlux integrates with IMeterFactory and OpenTelemetry.
Every endpoint call, event handling, and cycle is tracked with metrics.
That means you get latency histograms, error counters, and symbol metrics without writing a single line of plumbing code.
Example Use Case: Real-Time Symbol Monitoring
Imagine you need to monitor crypto trading pairs in real-time.
With NFlux, you:
- Define a DownloadSymbols domain that fetches raw market data.
- Normalize symbols into consistent business objects (close price, volume, sparkline, technical indicators).
- Orchestrate real-time tickers via a RealtimeSymbolsOrchestrator.
Expose QA endpoints:
- /qa/metrics → view system health and counts
- /qa/registry/{TenantId} → view current registry state
- /qa/watcher/publish → inject fake tickers for E2E testing
Your devs can test the full pipeline by publishing fake tickers and observing the updates flow through the system.
Developer Experience
- One of the biggest strengths of NFlux is developer productivity.
- Integration tests validate domains in isolation
- End-to-End tests (E2E) run against Aspire environments with QA endpoints
- In-memory registries and event stores simplify local testing
- Auto-discovery of endpoints keeps controllers minimal
This means faster iteration cycles, less boilerplate, and more confidence in production deployments.
Benefits at a Glance
🔹 Strongly-typed events and commands (no weakly typed messaging)
🔹 Event-driven orchestration with tenant awareness
🔹 Plug-and-play observability with OpenTelemetry metrics
🔹 Built-in support for QA and testing endpoints
🔹 Works seamlessly with .NET 9 and Aspire
Next steps for NFlux
- Publish stable builds on NuGet.org
- Expand documentation with case studies
- Provide ready-to-use templates for Aspire projects
- Grow the community with contributions and plugins
Github: https://github.com/startpointcorporate/Nflux?tab=readme-ov-file
Conclusion
NFlux is not just another .NET library.
It’s a framework for building reliable, event-driven systems where domains, orchestration, and observability come together.
If you’ve ever struggled with boilerplate event code, missing metrics, or orchestration hacks, NFlux is here to change that.
👉 Explore the repo on GitHub
👉 Install from NuGet (coming soon)
👉 Join the community and contribute
Have you already built event-driven systems in .NET? What were the biggest challenges you faced? Leave a comment — I’d love to hear your experiences and start a discussion
Top comments (0)