Skip to content
hieuck edited this page Jul 5, 2026 · 1 revision

PWA / Offline

Smart ERP Next's web app is a Next.js Progressive Web App (PWA).

Offline support

  • manifest.json enables add-to-home-screen on mobile and desktop.
  • service-worker.js caches static assets for offline access.
  • localStorage / IndexedDB wrappers cache API responses and pending mutations.

Conflict resolution

When the device comes back online, local changes may conflict with server data. The app uses a predefined conflict UX matrix:

Scenario Resolution
Local create + server create Show diff modal; user chooses keep local / server / merge
Local update + server update Timestamp + user decision
Local delete + server update Prompt: restore or keep deleted
Offline batch sync Retry with exponential backoff, surface failures in notification center

See docs/pwa/conflict-ux-matrix.md for the full matrix and test cases.

Useful files

  • apps/web/public/manifest.json
  • apps/web/public/sw.js
  • apps/web/src/lib/offline-db.ts
  • apps/web/src/lib/sync-service.ts
  • apps/web/src/components/SyncConflictModal.tsx

Clone this wiki locally