CS.04
Predictable State Architecture
Replacing ad-hoc state with a testable data flow that holds up under concurrent load.
- MobX
- React Query
- WebSocket
- SSE
- 01 — Problem
- Ad-hoc state patterns were producing state-related defects and a slow ramp-up path for new engineers, while distributed pricing and availability needed to stay consistent across clients under concurrent load.
- 02 — Decision
- Replaced ad-hoc state with a predictable, testable data flow on MobX and React Query, with client-store synchronization and WebSocket and SSE-driven polling workflows for real-time consistency.
- 03 — Trade-offs
- An opinionated, shared state model reduces per-feature flexibility, in exchange for removing the inconsistency and defect surface that ad-hoc patterns created.
- 04 — Implementation
- MobX and React Query as the client-store layer, with client-store synchronization and WebSocket and SSE-driven polling workflows keeping distributed pricing and availability consistent across clients.
- 05 — Impact & Lessons
- State-related defects down ~35%; new-engineer ramp-up shortened from weeks to days.