LLD Inventory Management System for Blinkit/Dunzo/Zepto

Photo by Petrebels on Unsplash

LLD Inventory Management System for Blinkit/Dunzo/Zepto

ยท

2 min read

Problem Statement

In the following blog post, we will discuss low Level Design architecture of an Inventory Management System used by Blinkit/Dunzo/Zepto for groceries delivery

Let us start by identifying the objects and encapsulating their attributes and operations into classes

Identification of all Objects and Classes

ProductUnit

  • Represents an individual entity of a Product

    • It has its expiry date , serialNumber manufactured from the factory

Product

  • Has a list of all ProductUnits which are all the same product, this can also be seen as a ProductUnitsController

Inventory

  • Inventory has a list of all products

    • I can add new Products, new units for this product and other similar CRUD operations

Warehouse

  • Has a single instance of inventory and manages the inventory

WareHouseController

  • As our system can have many warehouses, we need a warehouse controller for their management, our assumption being at a time only one warehouse delivers to the customer

    • The WareHouseController selects a single warehouse using a WarehouseSelectionStrategy

  • WarehouseSelectionStrategy and NearestWarehouseSelectionStrategy and so on ...

    • We use the Strategy pattern to pick the strategy that controller uses to select warehouse at runtime

User

  • Has a Cart and a list of Order IDs representing order history

UserController

  • There can be many users so we have to maintain a user controller

Cart

  • Maintains a list of Products and their quantity

Order

  • Fetches the user's cart and converts that into an order with Invoice and Payment

OrderController

  • Since there can be many Orders, they need to be controlled by an OrderController

InventoryManagementSystem /App / Main

User Flow

  • The InventoryManagementSystem takes in a list of registered users and warehouses present in the system for system initialisation

  • We create a function `runDeliveryFlow` to test the entire flow of the application

  • The initialisation for users and warehouses can be done as follows:

UML DIAGRAM

ย