Warehouse and Inventory Management System

Stock accuracy and fulfillment

Design a warehouse management system that tracks every unit from receiving to shipping, reserves stock so no order is promised units that are not there, picks efficiently and chooses which warehouse ships each order.

Overview

A warehouse management system (WMS) is the software that runs a fulfillment center. It knows which bin holds which product, tells workers where to put incoming stock and what to pick next, and records every movement. An order management layer above it decides which warehouse ships each order.

The problem is hard for two reasons. First, the database must match the shelves. Stock changes only when a person or machine scans it, scans arrive late or twice, and a count can show that a bin holds fewer units than the system thinks. Second, stock is shared: many orders compete for the same units, and checkout must never promise a unit that is already promised to someone else.

The rest (slotting, pick paths, waves) is about labor: pickers spend much of their shift walking, and the software decides how far.

Questions to ask first

Before drawing anything, settle the scope with the interviewer. Each question below comes with the answer this design assumes.

  • One warehouse or a network? A network of 50 warehouses, with one database cluster per region.
  • How many orders? About 1 million a day, 3 lines each, with the peak hour at 3 times the average.
  • Is stock tracked by bin or only by warehouse? By bin, with lots and expiry dates where the product needs them.
  • Can checkout oversell and fix it later? No. A reservation is a promise, and it must be exact.
  • Does the warehouse keep working if the link to the cloud drops? Yes. Scanning and picking must not stop.
  • What about robots and conveyors? They are out of scope. The WMS sends them tasks through an adapter.

The design at a glance

Checkout on the storefront calls the order router, which proposes a plan from an availability cache a few seconds old and asks the inventory service to reserve it in the stock and ledger database of that warehouse's region. On the floor, handheld scanners talk to the warehouse service, which plans tasks, waves and pick paths, records every move through the same inventory service, and hands packed parcels to the carrier systems. Each stock change also writes an outbox event, and a relay sends it on to the availability cache and the analytics store. The Visual Explanation below draws this architecture.

What you will be able to do

  • Keep on hand, reserved and available stock correct with a ledger, and explain why counts are never simply overwritten.
  • Reserve several lines of an order all or nothing, in SQL that is safe under concurrency and cannot deadlock.
  • Route an order to a warehouse by cost, and say when to split it.
  • Explain slotting, waves and pick paths, and why a heuristic is enough for pick routes.
  • Keep scanning when the network drops, without counting any scan twice.

Key concepts

  • On hand, reserved, available
  • Append-only stock ledger
  • All-or-nothing reservation
  • Idempotent scans
  • Order routing and split shipments
  • Velocity slotting (ABC)
  • Pick path heuristics (2-opt)
  • Waves and batch picking
  • Cycle counting

Functional requirements

  • Receive inbound shipments against an advance ship notice and put units away into bins
  • Track stock per warehouse, bin, SKU and lot: on hand, reserved and available
  • Reserve stock for an order all or nothing, and release it on cancel
  • Choose the warehouse (or two) that ships each order
  • Create pick tasks grouped into waves or batches, with a walking route
  • Record pack and ship scans; shipped units leave the stock
  • Schedule cycle counts and record differences as adjustments

Non-functional requirements

  • Never reserve more units than are on hand (strict correctness)
  • Each scan changes stock exactly once, even when a handheld retries
  • Routing plus reservation answers checkout in under 200 ms at p99 (a target we chose)
  • Availability shown on the storefront may lag by a few seconds; the reservation may not
  • Each warehouse keeps receiving, picking and shipping through a network outage
  • Every stock change is explainable from the ledger for audits

Interview questions

  • How do you make sure two orders never get the same last unit?
  • Why keep a ledger when you already have balances?
  • How do you choose which warehouse ships an order?
  • How do you compute the pick route, and why not the optimal one?
  • A handheld loses its connection mid-scan. What happens?
  • What is slotting and how do you decide when to re-slot?
  • How does a cycle count fix a wrong balance?
  • How do you shard, and what about a flash sale on one SKU?

Sign up free to read the full topic

More System Design topics

Start free on Cariara · Coding problems · System design studio