0
0
LLDsystem_design~12 mins

Order tracking state machine in LLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - Order tracking state machine

This system manages the states of an order as it moves through different stages like placed, processed, shipped, delivered, or cancelled. It ensures that the order transitions follow valid paths and updates are consistent and reliable.

Architecture Diagram
User
  |
  v
Order Tracking Service
  |
  v
State Machine Engine
  |
  v
Order Database
  |
  v
Notification Service
Components
User
actor
Initiates order status requests and receives updates
Order Tracking Service
service
Receives user requests and interacts with the state machine
State Machine Engine
service
Manages order states and enforces valid state transitions
Order Database
database
Stores current order states and history
Notification Service
service
Sends updates to users about order state changes
Request Flow - 5 Hops
UserOrder Tracking Service
Order Tracking ServiceState Machine Engine
State Machine EngineOrder Database
State Machine EngineNotification Service
Notification ServiceUser
Failure Scenario
Component Fails:Order Database
Impact:State changes cannot be saved or read, causing stale or lost order status information
Mitigation:Use database replication and fallback to read-only mode from replicas; queue state changes for retry
Architecture Quiz - 3 Questions
Test your understanding
Which component ensures that order states change only through valid transitions?
AOrder Database
BOrder Tracking Service
CState Machine Engine
DNotification Service
Design Principle
This design uses a dedicated state machine service to enforce valid order state transitions, ensuring data consistency and clear separation of concerns. Notifications are decoupled to improve user experience without blocking state updates.