System DesignLLD (Low-Level Design)

Build Zepto | 10-Mins Quick Commerce | Inventory Management

M

Mostakin Mondal

February 21, 2026•4 min read·0% completed

Quick commerce makes it possible to order groceries or snacks and get them delivered in under 10 minutes. Behind this speed is a system that manages inventory, locations, and deliveries in real time.

Here’s how you can think about designing such a system, focusing on inventory management and order fulfillment.

Inventory Management

Inventory management is the process of keeping track of products in a store. It makes sure that items are available when customers order them and helps plan when to restock. In a quick commerce system like Zepto, inventory management also involves:

  • Tracking stock in multiple dark stores in real time.

  • Automatically updating inventory when orders are placed.

  • Scheduling replenishments when stock is low.

  • Ensuring that orders can be split across stores if a single store cannot fulfill everything.

Good inventory management is what allows Zepto to deliver products quickly and reliably, even during busy times.

Core Functional Requirements

Before coding, you need to know what the system should do:

  • Manage Inventory: Add, update, or remove items.

  • Replenishment Strategies: Restock items automatically when they run low or on a schedule.

  • Scalable Inventory Stores: Support multiple storage types, like databases or in-memory stores.

  • Nearby Store Lookup: Show available items from all dark stores within a 5 km radius.

  • Order Splitting: If one store can’t fulfill the full order, split it across multiple stores and delivery agents.

These are the key features that make a reliable and fast quick commerce system possible.

UML Diagram

Key Components and Design Patterns

1. ProductFactory (Factory Pattern)
This creates product objects dynamically. For example, in an admin panel, sellers can add new products without changing code. The Factory pattern makes it easy to introduce new product categories.

2. InventoryStore and DbInventoryStore
These act as storage interfaces.

  • InventoryStore defines how stock is checked and updated.

  • DbInventoryStore uses a database to store items.
    Later, you could add other types of storage, like in-memory or NoSQL, without changing the rest of the system.

3. InventoryManager (Facade Pattern)
This is a single entry point to manage stock operations—adding, removing, querying, and replenishing items. Instead of every module interacting directly with storage, they use this manager, keeping the system simple and clean.

4. ReplenishmentStrategy (Strategy Pattern)
Stock replenishment can follow different rules:

  • Threshold strategy: Refill items when the count goes below a set level.

  • Weekly strategy: Refill items automatically every week.
    The Strategy pattern allows new replenishment methods to be added without changing main logic.

5. DarkStoreManager (Singleton)
Keeps track of all dark stores and their locations.

  • Ensures only one global instance exists to avoid conflicts.

  • Determines which stores are closest to a customer.

6. Cart and Order Fulfillment
Handles user carts and splits orders when one store doesn’t have all items. Delivery agents pick up and deliver from multiple stores as needed.

7. Zepto Class (Coordinator)
This ties everything together. It manages products, inventory checks, store selection, order splitting, and delivery planning to ensure the system works smoothly.

How It Works Step by Step

  1. A user adds items, like bread and milk, to their cart.

  2. The system checks which dark stores are nearby.

  3. It finds bread at Store A and milk at Store B.

  4. Inventory levels are updated and replenishment is scheduled if stock is low.

  5. Delivery agents are assigned to pick up items from each store and deliver them to the user.

To the user, it feels like a fast and smooth 10-minute delivery. Behind the scenes, inventory management, store selection, order splitting, and delivery planning all work together.

Summary

A quick commerce system like Zepto delivers products fast by managing inventory, stores, and orders efficiently. It keeps track of stock across multiple stores, updates inventory in real time, and replenishes items when needed. The system finds nearby stores, splits orders if one store can’t fulfill everything, and assigns delivery agents. Using patterns like Factory, Facade, Strategy, and Singleton keeps the design modular, making it easy to add new products, stores, or restocking methods while ensuring fast and reliable delivery.

Code

By Coder Army

Related Articles

Build Zepto | 10-Mins Quick Commerce | Inventory Management | Coder Army