Feature Pack 005: Messaging Layer Replacement with NATS
Status: Implemented
Track: architecture
Previous state: 004-postgres-database-replacement
Motivationβ
State 004 uses a Socket.IO trade-feed service for both inter-service events and browser streaming.
This pack introduces NATS as the messaging backbone to improve protocol clarity, multi-language interoperability, and operational robustness while keeping behavior compatible for existing flows.
The core direction is:
- replace
trade-feedSocket.IO bus with anats-brokercomponent, - standardize backend pub/sub on NATS subjects,
- expose browser-compatible real-time streaming using NATS WebSocket support through ingress,
- keep migration incremental and reversible through explicit spec deltas.
Why NATSβ
- lightweight single-binary broker, easy local and containerized startup,
- strong client support across Java, .NET, Node.js, and Python,
- clean subject-based routing with wildcard subscriptions,
- built-in request/reply and optional JetStream durability for future states,
- browser support through
nats.wsover WebSocket.
Scope In This Stateβ
- Runtime base remains Docker Compose and NGINX ingress from
004. - Functional behavior for baseline trade/account/position flows remains unchanged.
- Messaging transport and event topology are replaced.
- Old Socket.IO trade-feed runtime is removed from the target architecture.
Artifactsβ
spec.mdrequirements/functional-delta.mdrequirements/nonfunctional-delta.mdcontracts/contract-delta.mdfidelity-profile.mdcomponents/nats-broker.mdcomponents/messaging-migration.mdconformance/nats-broker.mdsystem/architecture.model.jsonsystem/runtime-topology.mdsystem/migration-guidance.mdsystem/messaging-subject-map.mdsystem/docker-compose.nats.snippet.yamlsystem/ingress-nginx.nats-ws.snippet.confgeneration/generation-hook.mdtests/smoke/README.md