The problem
Hatoba's retail system was built in 2021. Since March 2024 its stock sync had stopped working — and nobody knew for more than two years.
The numbers at the till, in the warehouse, and in the online store slowly drifted apart. No error message, no warning. Just stock that no longer matched, and one new habit in the store: counting by hand before trusting the screen.
We read the code first
Before proposing anything, we went through the existing system. It turned up 14 faults visible in the code, and 7 more that only surfaced once it was running.
The conclusion was not a pleasant one to deliver: this was not one bug that could be patched. The way that system stored stock made drift impossible to detect. The owner decided to rebuild. Three days later the first version was running on the server.
Stock is never overwritten
The old system kept stock as a single number, overwritten on every change. The moment one write failed, the number was wrong for good, with no trail to show when it started going astray.
Now every movement is recorded as a new row, and the database refuses update and delete on those rows — refused at the database layer, not merely a rule in code that can be worked around. The stock balance is not a stored number; it is the sum of its rows. If a figure looks wrong, the rows can be opened one by one: when, at which location, for what reason, and by whom.
One system, three channels
The till and the warehouse run as a desktop application that keeps working when the internet is down, then catches up on its own once the network returns. Customers shop on the web from their phones.
All three are served by the same program reading the same ledger. There are no longer two places that can disagree about stock, because there is only one place.
Two small things that save a lot
Every operation that changes stock must carry an idempotency key. If a cashier taps twice because the network feels slow, the second one is rejected — not recorded twice.
The till's basket is also cleared only after the server has actually answered with success. In the old system the basket was cleared first; if the answer never came, the sale vanished without trace and only turned up at closing.
About the results
This page deliberately carries no “Results” section full of numbers yet. The system has been running since August 2026, but we do not yet have before-and-after measurements we can stand behind — how long closing the books used to take against now, what the latest stock discrepancy is. Once those numbers exist and the owner is happy for us to publish them, those are what will go here.
Screenshots were taken from a test installation with invented data. No real customer names, prices, or receipt numbers appear on this page.
RUNS ON
- Go
- PostgreSQL
- Wails desktop app
- Flutter
- Docker on a VPS
- Cloudflare Tunnel


