Design an On-Demand Delivery Platform
Company: Meta
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Onsite
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:
1. **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.
2. **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.
3. **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.
4. **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.
Quick Answer: 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.