SaaS Architecture & Offline-First POS· Multi-Store Retail & Supermarket Networks (Kenya & East Africa)

DazzPOS: Retail POS

How we architected a resilient, offline-first Point of Sale application capable of processing high-volume barcode transactions with zero downtime during internet outages, syncing automatically to PostgreSQL via M-Pesa automated webhooks.

99.99%Terminal Sync Reliability
<120msBarcode Scan Latency
45,000+Daily Transactions Processed
0 secDowntime during Outages
01 · The Problem

The Challenge: Internet Volatility in Fast-Paced Retail

Retail checkout lines cannot stop because an ISP fiber line drops or mobile connectivity fluctuates. The client was operating across multiple retail locations in Nairobi and surrounding East African commercial centers where legacy cloud-only POS systems froze during outages, creating massive customer queues and lost revenue.

✕Legacy cloud POS required constant internet connectivity; network drops halted cashiers completely.
✕Slow scan-to-cart latency (800ms+) created bottlenecks at high-volume retail checkout counters.
✕Manual M-Pesa payment verification caused cashier fraud and delayed sales reconciliation.
✕Multi-store inventory synchronization was out-of-sync by up to 24 hours, leading to stockouts.
02 · Architectural Decision

Architectural Strategy: Local-First Storage with Event-Driven Sync

Rather than forcing every barcode scan to ping a remote cloud database, we designed a local-first architecture. The browser terminal writes immediately to an in-memory IndexedDB / SQLite transaction ledger and generates instant receipts, while a background sync engine handles conflict resolution and pushes batches to the central PostgreSQL cluster once connectivity is established.

Local-First IndexedDB state engine for sub-millisecond local checkout execution
Deterministic Event Sourcing sync queue with UUID transaction idempotency keys
Direct Daraja M-Pesa STK Push integration with automated webhook reconciliation
Harden Linux VPS with Docker Compose and Redis for high-concurrency cloud ingestion
03 · The Build

The Build: Engineering the Solution

We built the cashier interface using Next.js, React, and Tailwind CSS with custom keyboard shortcut hooks for high-speed cashier entry. The backend was structured with Node.js and PostgreSQL, utilizing BullMQ queues for high-volume invoice processing and M-Pesa webhook verification.

Technologies Utilized
Next.js App Router & TypeScriptIndexedDB / WatermelonDB local storagePostgreSQL with connection pooling (PgBouncer)Redis & BullMQ sync workersSafaricom M-Pesa Daraja 2.0 APIDocker on Ubuntu Linux VPS
100% Offline Transaction Queue: Cashiers process sales continuously during total internet blackouts.
Instant M-Pesa STK Push: Automated prompt sent to customer's phone with zero manual receipt typing.
Real-Time Multi-Warehouse Inventory: Central ledger syncs stock levels across branches immediately.
Automated End-of-Day Z-Report Reconciliation: Financial summaries generated in seconds.
04 · The Result

The Result: Flawless Retail Operations at Scale

DazzPOS rolled out to more than 50 active retail terminals. During routine local internet disruptions, terminals continued processing sales seamlessly, eliminating checkout wait times and saving hundreds of lost sales hours.

Zero checkout interruptions across 50+ checkout lanes during network drops.
M-Pesa payment confirmation speed accelerated from 45 seconds manual to under 4 seconds automated.
Inventory shrinkage and manual reconciliation discrepancies reduced by 85% in the first quarter.
System easily handled peak December holiday sales volumes exceeding 45,000 daily transactions.

Key Engineering Lessons Learned

  • →Building offline-first requires strict transaction idempotency to prevent duplicate inventory deductions during reconnection.
  • →Local barcode scanning must bypass React DOM re-render cycles for instant high-frequency scanner input.
  • →Automating M-Pesa validation eliminates the primary source of retail checkout cashier error.

Need Similar Architecture for Your Business?

Book a strategy discussion with Dazzcode's lead software engineers.