Most systems rot at the seams โ the hard-wired connections between components that made sense on day one and become a cage by day thirty. The fix I keep reaching for is almost boringly simple: don't let components talk to each other directly. Let them talk to a bus.
That decision is what held Netra together as it grew from a single camera into a multi-node system.
The problem with direct connections
When your detector calls your servo controller which calls your dashboard, every component has to know about every other one. Change how the servos work and the detector breaks. Add a second listener and you're editing three files. The system becomes a web of dependencies where nothing can move without something else moving with it.
Netra spans firmware, a YOLOv8 inference server, a servo controller, and a React dashboard. Wire those together directly and you get a tangle no one can safely touch.
Pub/sub as the backbone
Instead, every component communicates over MQTT โ a lightweight publish/subscribe protocol. The detector publishes where the target is; anything that cares subscribes. The detector has no idea how many things are listening. The dashboard needs no direct socket to the camera. Each piece knows only the topics, not the other components.
The payoff is huge:
- Independent development. I built firmware, inference, and UI separately and let them find each other through topics โ no lockstep coordination.
- Free scalability. Adding a new consumer (a logger, a second dashboard, an alerting service) means subscribing to a topic. Nothing upstream changes. This is exactly how Netra scales to tracking a target across up to 8 camera nodes.
- Resilience. A component can drop and reconnect without taking the rest of the system down with it.
The principle
Decoupling isn't a fancy technique โ it's the difference between a system you can evolve and one you can only rewrite. A message bus turns rigid point-to-point dependencies into a flexible mesh where components are replaceable and the system can grow without a rewrite.
I reach for pub/sub early now, on almost anything with more than two moving parts, because the cost is small and the flexibility compounds. Netra is the clearest proof I've built of how much a message bus buys you. The full architecture is on the project page.
๐ See the system: www.divyakush.com/projects/netra
Divyakush Punjabi โ Full-Stack & AI Systems Engineer
๐ https://www.divyakush.com ยท ๐ผ LinkedIn ยท ๐ป GitHub
Top comments (0)