01
Separate stores for separate state
Products, users, carts and notifications each have their own database, so each domain keeps its own state.
The choices
Mock system design case study
Designing cart reminder notifications.
A mock high-level design mapping how cart state, user preferences, queue-based delivery and tracking could work together.
The exercise was a high-level architecture for cart-reminder notifications on Amazon.
The ideaA high-level design for cart reminders: cart state, user preferences, a message queue and tracking connected into one flow, from a saved cart to a delivered, tracked notification.
01
Products, users, carts and notifications each have their own database, so each domain keeps its own state.
The choices02
A cart monitoring service checks saved carts at intervals. My reading: that keeps reminder eligibility out of the request path.
The choices03
The sending service picks pending notifications using each user's notification preferences, then queues them.
The architecture04
Notifications wait in a message queue and a separate handler sends them by email, SMS or push.
The end-to-end flow05
Notification tracking follows delivery and user actions, and writes those actions back to the User Database.
The end-to-end flow06
Every design choice is labelled as visible on the diagram or as my interpretation of its structure.
The choicesEach component lists its connections; groups run roughly in the order a cart reminder travels.
Where a user enters the system.
Uses a mobile app or web interface.
Drawn as several server instances.
Search, add to cart and display saved carts.
User details, search history, saved cart details and preferences.
Finds carts to remind about and decides what is pending.
Queue-based delivery and the feedback path.
Delivers by email, SMS or push notification.
This grouping is a way of reading the diagram, not a claim about team ownership.
Takes requests from the mobile app or web interface and routes them to a front-end server.
Reads products, saves items to the cart and displays saved cart contents.
Holds user details, search history, cart details per user and notification preferences.
Checks saved carts periodically, records pending notifications and decides which to send based on user preference.
Queues notifications, then sends them by email, SMS or push notification.
Tracks delivery and user actions and writes the actions back to the User Database.
Each step is read from the original diagram.
Loads the app from mobile or web; the request goes through the load balancer to a front-end server.
Load BalancerProducts are read, search history is saved, and items added to the cart are written to the cart database.
Cart DatabaseThe cart monitoring service checks saved cart contents at periodic intervals.
Cart monitoring servicePending notification details are updated in the notification database, alongside user notification preferences.
Notification DatabaseThe sending service determines pending notifications from user preference and adds them to the message queue.
Messaging QueueThe handler reads from the queue and sends via email, SMS or push notification.
Notification HandlerNotification tracking follows delivery and user actions.
Notification TrackingUser actions on notifications are written back to the User Database.
User DatabaseThe HLD does not state why it was drawn this way, so the original diagram comes first.
Products, users, carts and notifications each have their own database.
A cart monitoring service checks saved carts at intervals and records pending notifications.
The notification sending service adds notifications to a message queue; a separate handler reads from it.
The handler sends by email, SMS or push notification.
Tracking follows delivery and user actions, and user actions are written back to the User Database.
Placing the queue between the sending service and the handler lets the two evolve and run independently.
Because monitoring runs periodically in its own service, reminder eligibility is not computed while a user is browsing.
Splitting user, cart, product and notification data keeps each domain's state separate.
Writing user actions back to the User Database gives the notification path a feedback signal.
The original diagram this page is read from, unedited.
Download the original documents (zip)High-level design