Flipkart Order Delivery
Difficulty: MEDIUMCategory: HLDFrequency: 1Asked On 2024-04-08
Problem Statement
Design a Flipkart Order Delivery System that handles the entire lifecycle of an order from placement to delivery at the customer’s doorstep. The system should manage order management, inventory checks, logistics, delivery partner assignment, tracking, and notifications efficiently at scale.
Functional Requirements (FR)
1.User & Order Management
•Users can place, update, or cancel orders.
•Orders contain multiple items with quantity, seller, and price details.
•Track order status: Placed → Confirmed → Packed → Shipped → Out for Delivery → Delivered → Returned.
2.Inventory & Fulfillment
•Check product availability across warehouses.
•Reserve inventory upon order placement.
•Support multi-warehouse fulfillment and split orders if items are in different locations.
3.Logistics & Delivery Partner Management
•Assign delivery partners based on proximity, availability, and delivery capacity.
•Support multiple shipping modes: standard, express, same-day delivery.
•Handle partial deliveries if order contains items from multiple warehouses.
4.Real-Time Tracking
•Track delivery partner location in real-time.
•Provide estimated delivery time (ETD) to the user.
5.Notifications & Alerts
•Notify users about order confirmation, dispatch, and delivery.
•Alert delivery partners for new assignments or updates.
6.Payment & Refunds
•Support multiple payment methods (cards, wallets, COD).
•Handle payment confirmation, refunds, and cancellations.
7.Analytics & Reporting
•Monitor delivery KPIs: time, distance, success rate.
•Provide insights for warehouse stocking, route optimization, and partner performance.
Non-Functional Requirements (NFR)
•Scalability – Handle thousands of concurrent users, orders, and deliveries.
•High Availability – System must be available 24/7 for order placement and tracking.
•Low Latency – Fast order placement, inventory checks, and real-time tracking.
•Reliability – Accurate order status, inventory tracking, and delivery assignments.
•Extensibility – Ability to add new delivery modes, warehouses, or fulfillment strategies.
Core Components
1.Client Applications
•User App: Place orders, track delivery, and receive notifications.
•Seller App: Update product inventory, confirm order processing.
•Delivery Partner App: Receive assignments, update status, and navigation.
2.Order Management Service
•Handles order creation, updates, cancellations, and status tracking.
3.Inventory & Fulfillment Service
•Checks product availability and reserves stock.
•Determines warehouse allocation and handles multi-warehouse orders.
4.Delivery Assignment & Route Planning Service
•Assigns delivery partners based on proximity, capacity, and workload.
•Optimizes delivery routes using mapping services.
5.Location Tracking Service
•Updates and stores real-time location of delivery partners.
•Provides location and ETD to users.
6.Payment Service
•Handles payment processing, refunds, and verification.
7.Notification Service
•Sends push notifications, SMS, or emails to users, sellers, and delivery partners.
8.Analytics & Reporting Service
•Collects data on orders, deliveries, partner performance, and customer experience.
Data Flow
1.User places order → Order Management Service.
2.Inventory Service checks product availability → reserves stock.
3.Delivery Assignment Service allocates delivery partner → updates status.
4.Delivery Partner App receives assignment → picks up order.
5.Location Tracking Service updates ETD → User App receives live updates.
6.Payment Service confirms transaction → Notification Service alerts stakeholders.
7.Analytics Service collects data for reporting and optimization.
Design Considerations
1.Scalability
•Partition databases by region/warehouse.
•Use message queues for delivery assignments, notifications, and updates.
2.Consistency & Reliability
•Ensure order status, inventory, and delivery updates are consistent across services.
•Handle failures in assignment, payment, or tracking gracefully.
3.Real-Time Tracking
•Efficiently process frequent location updates from delivery partners.
•Use geo-indexing (Redis Geo, PostGIS) for proximity calculations.
4.Trade-offs
•Real-time tracking vs network/data usage for delivery partners.
•Optimal route computation vs computational cost.
•Strong consistency vs high availability for delivery assignment and inventory updates.
✅ This HLD problem tests:
•Design of large-scale order and delivery systems
•Service orchestration and data flow management
•Real-time location tracking and route optimization
•Handling concurrency, notifications, and fault tolerance