17
Domain models
platform · 2025 · client unnamed
Online orders and in-store till sales behind one order model, with stock tracked per warehouse.
17
Domain models
2
Channels
online and in-store, one order model
2
Architecture rewrites
v1 had no inventory, audit or POS
The problem
A merchant running both an online store and physical shops had two systems that disagreed. An online sale and a counter sale are the same event to the business and completely different events to the software, which means stock is wrong by the end of every day.
The approach
Unified both channels behind one order model, so a cashier ringing up a walk-in and a customer checking out online produce the same shape of record against the same inventory. Added multi-warehouse stock so each location knows what it actually holds, plus an audit layer over stock movement. This is the second architecture: the first version had no inventory, audit or POS, and the rewrite is what made it a retail system rather than a store.
Architecture
One order collection with a channel discriminator rather than parallel online and POS order types. Inventory is per-warehouse, and movements are audited rather than inferred from order history.
Each with what it cost
A decision without a stated tradeoff is a preference.
01
Why
Reporting, refunds, stock effects and customer history are the same logic regardless of channel. Two order types means writing all of it twice and having the two drift.
What it costs
A few channel-specific fields are nullable on the shared model, a smaller cost than duplicated business logic.
02
Why
A merchant with several shops needs to know where stock is, not only how much exists. A single number cannot answer whether a customer can collect today.
What it costs
Every stock operation has to specify a location, which makes the API more verbose and the data correct.
Outcome
One order model covering both channels, stock accurate per warehouse, and an audit trail behind every movement.