Design an On-Demand Delivery Platform
MetaSoftware Engineer · OnsiteLast updated
This question evaluates skills in designing scalable, reliable distributed systems with emphasis on state management (shopping cart persistence), real-time telemetry (courier location updates), workflow orchestration (order lifecycle and dispatch), and operational concerns like scalability and reliability.
Design an on-demand local delivery marketplace for restaurants or grocery stores.
The platform should support customers browsing merchants, building shopping carts, placing orders, merchants preparing orders, couriers accepting assignments, real-time courier tracking, and customer notifications.
Focus especially on the following areas:
- Shopping cart persistence
- A customer may add items from web or mobile, close the app, switch devices, or lose network connectivity.
- The cart should be recoverable later.
- Discuss consistency, expiration, anonymous carts, logged-in carts, and conflict resolution.
- Courier location updates
- Couriers continuously send GPS updates while online and during deliveries.
- Customers and internal dispatch systems need near-real-time location.
- Discuss ingestion, storage, fanout, rate limiting, and privacy.
- Order lifecycle and dispatch
- Orders move through states such as cart, placed, accepted by merchant, ready, courier assigned, picked up, delivered, or canceled.
- Discuss how services communicate and how you prevent invalid state transitions.
- Scalability and reliability
- The system should handle high traffic during meal-time peaks.
- Discuss APIs, data models, core services, queues or streams, caching, failure handling, observability, and trade-offs.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.