Designing point-of-sale software that keeps selling when the internet drops

A shop does not stop serving customers because the internet is slow. For a point-of-sale system, that means a lost connection must never mean a blocked sale. Offline-first design treats the network as something that may be missing, instead of something that is always there.
The core idea is simple: every action is saved on the device first, and sent to the server afterwards. When a cashier completes a sale, the sale is written to local storage on the device, the receipt is printed, and the record joins a queue of changes waiting to be uploaded. The cashier never sees a spinner waiting for the server.
The hard part is the sync. When the connection returns, queued sales have to be sent without being counted twice. The usual solution is to give every transaction a unique identifier on the device and make the server ignore any identifier it has already stored. That way a retry after a dropped request is harmless.
Receipt and invoice numbers need a plan as well. If two devices each assume they are issuing the next number, you end up with duplicates. Common approaches are to give each device or branch its own number series, or to assign the final number on the server and show a temporary reference until the sync completes.
Stock levels deserve honesty about what is known. While a device is offline, it only knows about its own sales, so the stock count it shows is an estimate. Good systems apply the queued sales to the central stock when they arrive and flag any item that went negative, so someone can review it instead of the system silently hiding the problem.
Finally, test the failure modes on purpose. Turn the network off in the middle of a sale, close the app, restart the device, and bring the connection back while a sync is half finished. A POS that behaves correctly in all of these cases is one a shop owner can trust on a busy day.
More Insights
How biometric attendance works, and how to manage many devices in one place
From a fingerprint scan to a monthly report: how attendance devices, shifts and timetables fit together, and why central device management saves time.
BusinessWhat to look for in billing and inventory software for a growing business
Spreadsheets and handwritten bills work until they do not. A practical checklist for choosing billing and stock software your team will actually use.
ArchitectureOne system, many branches: the data model behind multi-branch software
Running several locations from one application is mostly a data modelling question. Here is how to scope data per branch while keeping central reporting simple.
