AlgoViz

Design an Inventory System

medium 45 min

Count 10 million products in 100 warehouses and never promise a unit twice.

Where it shows up

The same pattern appears across everyday software.

  • Named stock states

    Shopify's developer pages define on hand as the sum of states such as available, committed, reserved and damaged, with incoming kept apart.

  • Click and collect

    A shop shows which branch has the product, and holds it there until the shopper arrives or the time ends.

  • Selling on several marketplaces

    The same shelf is offered in three shops. Each sale lowers one shared count, and each shop gets a slightly smaller number to allow for delay.

  • Medicines with dates

    A hospital counts by batch and gives out the batch that ends first. The batch number becomes part of the row's key.

  • Expiring reservations in a ledger

    TigerBeetle's documentation describes the same shape for money: a pending transfer is posted, voided, or expires after a timeout.

  • Vending machines

    Each machine is a tiny warehouse that reports late. The system orders by forecast and corrects when the machine is opened.