Nodes & the hub
How the watcher, hub, and web client divide the work.
A OneSVD node is three cooperating processes. Keeping them separate keeps each one simple and lets the watcher stay the single source of truth.
The watcher#
A Go process that watches ONESVD_ROOT, computes the Merkle tree, and reacts to filesystem events. It owns the truth: when something changes it recomputes the affected hashes and publishes a snapshot or patch to the hub over a loopback connection. A periodic reconcile pass catches anything the event stream missed.
The hub#
A Node process that holds a mirror of the watcher's tree and serves everything browsers talk to: the WebSocket feed, file viewing and downloads, uploads, folder zips, sharing/auth, and the Git runner system. It never writes into the watched tree on its own except through runners and uploads.
The web client#
A single-page app the hub serves. It derives the hub's address from the page's own location, so the same build works on localhost or a domain. It renders the tree, the Merkle graph, uploads, and the runner UI.
The flow#
disk change → watcher hashes → publishes to hub (loopback :4001)
→ hub mirrors + broadcasts (WebSocket :4000)
→ client updates live
The watcher only talks to the hub on loopback, so it's never exposed. Only the hub and client listen on network-facing ports.