Description
Convert the InvoFi frontend into a Progressive Web App (PWA) that works offline, caches critical data, and syncs invoice changes when connectivity returns. This enables business users in low-connectivity environments (common in emerging markets where invoice financing is most needed) to draft invoices, review offers, and prepare repayments offline.
Current state
The app is a standard Next.js SPA with no offline capability. Losing connectivity means losing access to all invoice data and functionality.
Proposed implementation
Service Worker
- Workbox-based service worker for asset caching
- Cache-first strategy for static assets (fonts, icons, CSS)
- Network-first strategy for API calls with offline fallback
- Background sync for deferred invoice submissions
Offline Storage
- IndexedDB via idb-keyval for invoice drafts and cached responses
- Conflict resolution for concurrent edits
- Storage quota management with LRU eviction
PWA Manifest
- Web app manifest with app icons, theme color, display mode
- Install prompt handling with custom UI
- Splash screen and loading states
Background Sync
- Queue invoice submissions when offline
- Auto-sync when connectivity returns
- Retry logic with exponential backoff
- User notification when sync completes/fails
Data Layer
- SWR/React Query cache configuration for offline-first
- Optimistic updates with rollback on sync failure
- Cache invalidation strategy for real-time data
Acceptance criteria
Dependencies
Complexity
High — Service worker lifecycle, IndexedDB schema design, background sync, conflict resolution, and cross-platform PWA compatibility.
Description
Convert the InvoFi frontend into a Progressive Web App (PWA) that works offline, caches critical data, and syncs invoice changes when connectivity returns. This enables business users in low-connectivity environments (common in emerging markets where invoice financing is most needed) to draft invoices, review offers, and prepare repayments offline.
Current state
The app is a standard Next.js SPA with no offline capability. Losing connectivity means losing access to all invoice data and functionality.
Proposed implementation
Service Worker
Offline Storage
PWA Manifest
Background Sync
Data Layer
Acceptance criteria
Dependencies
Complexity
High — Service worker lifecycle, IndexedDB schema design, background sync, conflict resolution, and cross-platform PWA compatibility.