Skip to content

feat(network): engineer robust offline-first transaction queue #30

Description

@0dillon

Summary

Our merchants operate in environments with highly volatile internet connectivity. Currently, if a merchant attempts to finalize a transaction while the network drops, the POST request fails and the data is lost. This results in unacceptable friction at the point of sale and requires the merchant to manually restart the flow.

We must transition the PWA to a strict offline-first architecture. All outgoing API requests should be intercepted and queued locally using IndexedDB (idb). A background synchronization manager must be implemented to monitor the navigator.onLine status and automatically flush the queue to the backend when connectivity is restored, ensuring absolute data integrity.

Acceptance Criteria

  • Integrate idb to manage a local, persistent transaction queue.
  • Intercept failed network requests and serialize them into the local queue.
  • Implement a robust background sync loop to flush the queue upon reconnection.
  • Provide clear UI feedback showing pending offline transactions.

Tech Stack

Next.js 14, React, IndexedDB, Service Workers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions