Skip to content

October 2026 · POS · React · IndexedDB · Architecture

Building a POS That Keeps Selling When the Internet Drops

How local storage, sync queues and idempotent APIs let a web-based POS keep billing customers during an internet outage.

Building a POS That Keeps Selling When the Internet Drops

The Counter Cannot Stop

When a queue forms at a shop counter, “the server is down” is not an acceptable answer. A web-based POS should treat the network as optional during billing. That means loading products, prices and customers into the browser ahead of time, usually in IndexedDB, so that searching and scanning stay instant whether or not the connection is available.

Saving Sales Locally First

Every completed sale should be written to local storage before anything else, then added to a sync queue. Generate the ID on the device, using a UUID instead of waiting for the database, so a receipt can be printed immediately. A background process sends queued sales when the connection returns. The API must be idempotent: if the same sale arrives twice after a dropped connection, the server should recognize its ID and ignore the duplicate.

Handling Stock Conflicts

Offline tills cannot know about each other’s sales, so stock can briefly become inaccurate. Accept this and design for it. Treat sales as events that subtract from stock, rather than overwriting a stock number, and flag negative results for a manager to review. Show a clear online or offline indicator with a count of unsynced sales, so staff know when it is safe to close a shift.

Decide who wins a conflict

Offline work means two devices can disagree. Sales are easy, because they are new records that simply get added. Stock is harder, since two counters may both sell the last item. My approach is to always accept the sale, because the customer already has the goods, and flag the stock difference for a person to review. A system that refuses a completed sale is wrong, whatever the data says.

Md. Fawjul Azim

Focusing on building high-performance web applications with modern tech stacks.