Deep diveJune 23, 2026·7 min read

Multi-branch inventory: the data model that keeps stock honest

Storing a quantity-on-hand per item per branch feels obvious and goes wrong quickly. Model the movements and derive the quantity — the arithmetic stops lying.

By NaxiumTech Team

Multi-branch inventory: the data model that keeps stock honest

The intuitive design for inventory is a table of (item, branch, quantity) that you increment and decrement. It works in a demo and then slowly falls apart: a sync fails halfway, two processes update the same row, someone asks "why is this negative" and there's no way to answer.

Stock is a ledger, not a number

Borrow the idea from accounting. Don't store the balance — store the movements, and compute the balance from them.

Every change to stock becomes an immutable row:

FieldExample
itemSKU-4471
branchDowntown
quantity-3
reasonsale
referenceINV-10293
timestamp2026-06-20 14:02

Quantity on hand for an item at a branch is just SUM(quantity) over its movements. It is always explainable, because every unit is accounted for by a row you can point at.

Every movement has a reason code

Constrain the reasons to a known set — purchase_receipt, sale, sale_return, transfer_out, transfer_in, adjustment, stock_count. This makes movement history readable and lets you answer operational questions directly: shrinkage is the sum of adjustment rows; returns rate is sale_return over sale.

Transfers are two movements

Moving stock between branches is not an update to two balances. It's a transfer_out at the source and a transfer_in at the destination, linked by a shared reference, each with its own timestamp. If goods are in a van overnight, the model can represent that honestly — out of one branch, not yet into the other.

Valuation lives with the movement

Record the unit cost on each inbound movement. Cost of goods sold for a period is then a query over outbound movements, and you can switch between FIFO and moving-average without restating the quantity ledger.

Reconciling to a physical count

A stock count produces stock_count movements equal to the difference between counted and computed quantity. You never overwrite the ledger — you post the correction into it, with a reference to the count sheet. The discrepancy becomes a number someone can investigate, not a mystery the system quietly absorbed.

The cost

This design writes more rows and needs a cached balance (a materialised view, or a periodically snapshotted total) so reads stay fast. That's a small price. What you get back is an inventory system that can always explain itself — which, the first time stock goes missing, is worth far more than the storage you saved.

Ready to build something exceptional?

Tell us what you're building. We'll come back within one business day with a plan — not a sales script.