MFcore
Multi Folder Core — a way of building software as self-contained module "legos" that communicate over a message backbone, so any single module can be deleted and rewritten without breaking anything else.
The problem it solves
The long-standing problem with software isn't the software — it's the development process itself. Codebases grow into tangled monoliths, a change in one area breaks another, and the whole system slowly degrades. Every large project I've inherited or maintained has had some version of this disease.
MFcore (short for Multi Folder Core) is my answer: an architecture where the only hard requirement is a small CORE layer, and everything else is an independent folder — a module — that plugs in, does one job, and can be ripped out and replaced at any time without touching a single line of the rest of the system.
MFcore is less a product and more a discipline. The rules — one folder per module, no cross-folder dependencies, message-only communication, identity-verified connections — are the product. The C# implementation is just the first proof.
How the layers fit together
The system is split into four tiers. Modules in different tiers never talk directly — every message flows through a NATS JetStream backbone, which acts as both post office and firewall.
| Tier | Job | Examples |
|---|---|---|
| CORE | Identity, registry, and health — the only mandatory layer | MF.Core.IAM, MF.Core.Registrar, MF.Core.Contracts |
| ACT | Active execution workers — database reads/writes, commands, integrations | CommandCenter, DBRead, DBWrite, EmailSender, GpsReceiver, Tailscale, ModHunter |
| LA | Logic assistance — background automation and data manipulation | Weather, NewsIngester, SecAdvisories, LiquidityScanner, the MarketScan scanner family |
| APP | Visual & interactive — serves websites, dashboards, and portals | ServiceMonitor, ThreatPortal, DbViewer, GeoFence, ComsCenter, MarketScan UI, RemoteViewer |
Modules identify themselves
Every module declares an immutable SacDefinition at boot: who it is, which tier it belongs to, exactly which message subjects it publishes and subscribes to, and what it depends on. The Registrar verifies those declarations and maps them into NATS KV stores under a sac.{ModuleId} registry key. A module can't accidentally reach into conversations it wasn't built for — its surface area is declared up front and enforced cryptographically.
Zero-trust isolation
No module has direct network access to another — not even by accident. Every connection is authenticated with NATS decentralized NKeys and JWTs: each module carries an encrypted private seed, proves its identity at boot, and receives scoped publish/subscribe permissions. An ACT-tier worker is cryptographically blocked from subscribing to MF.CORE.> administrative subjects, no matter what its code tries to do.
Tokens expire and refresh automatically — a TokenStore requests a fresh JWT at 80% of token lifetime, and reconnect callbacks always present the freshest credentials. The practical result: compromising one component leaves the rest of the system isolated and untouched.
Self-monitoring by default
Modules register status in KV keys with a 90-second TTL, so a crashed module stops being "online" within seconds — no polling, no manual health checks. Dependency watching is reactive: modules subscribe to their dependencies' status keys and react to changes the moment they happen.
What the modules actually do
The tier structure isn't theoretical — the fleet runs real work:
- MarketScan Orchestrator — an algorithmic trade scanner whose scoring scanners (relative strength, opening range, accumulation, growth, value) each run as their own LA-tier module, publishing candidates to a shared pipeline.
- ThreatPortal — a canonical security feed aggregating CVEs, CISA KEV alerts, and advisories into one searchable portal.
- ServiceMonitor & Ecosystem Monitor — the system watching itself: per-module CPU, memory, network, and status across the whole fleet.
- GeoFence + GpsReceiver — location-triggered automation with rules and telemetry stores.
- WrenAI — an AI integration module, dropped in like any other folder.
- Weather, NewsIngester, SecAdvisories, CommunitySignal — always-on background collectors feeding the canonical data stores.
The fleet's own interfaces
Every APP-tier module serves its own UI — same pattern, different job. These are all live, captured from a running fleet:
Why folders beat monoliths
The whole design optimizes for one metric: how cheap is it to change in five years?
- Hot-swappable — delete an entire module folder and replace it with a new implementation, in any language, without changing a line elsewhere. Because communication is message-based, the replacement just needs to speak the same subjects.
- Debuggable in isolation — a module folder is a couple thousand lines, not a warehouse. Turn off everything else, send it test messages, watch it behave. No live database or production network required — a local NATS Docker container is the whole test rig.
- Crash shielding — a background service that runs out of memory takes itself down, not the system. The backbone holds queued data and registers the offline status until it's back.
- Environment-agnostic — no cloud lock-in. The same fleet runs on a local machine, a WSL2/Docker host, or a dedicated server, and moves wherever the hardware economics make sense.
| Health metric | Design target |
|---|---|
| Cross-folder dependencies | Zero — enforced, not encouraged |
| Hot-swap a module | Under 15 seconds, no recompile of the rest |
| Crash detection | Within one 90-second status TTL |
| Failed message handling | Dead-letter queue, 3 delivery attempts before termination |
Audited, not assumed
A formal verification audit was run against the first phase, and the findings drove a fix roadmap before any production use: real cryptographic JWT signing in IAM (replacing a stub), genuine database connection pooling (replacing simulated delays), TTL enforcement on status keys, dynamic reconnect auth callbacks, and true JetStream queue-group load balancing. The architecture is treated as a living thing that gets verified, not a diagram that gets trusted.
Status
MFcore is under active development and running locally as a live fleet — 36 of 50 registered modules online with the Command Center, Ecosystem Monitor, DbViewer, MarketScan, and ThreatPortal all operational. It's the platform my next generation of shop-floor and data tools is being built on: the module that auto-draws plate pipe supports, the BOM-vs-CAD verification agent, and the rest of the pipeline all plug into this same spine.