What is a PWA?
A Progressive Web App combines the best of web and native apps:- Installable: Add to home screen like a native app
- Offline-capable: Access cached pages and data without internet
- Fast: Assets are cached for instant loading
- Responsive: Works on any device size
- Safe: Served over HTTPS for security
Home Account uses Serwist (the successor to Workbox) for advanced service worker management and caching strategies.
Installing on iOS (iPhone/iPad)
iOS Limitation: Service workers and offline caching are limited on iOS. The app will still work, but offline functionality may be reduced compared to Android.
Installing on Android
Tap Install Prompt
A banner will appear at the bottom: “Add Home Account to Home screen”Alternatively, tap the three-dot menu → “Install app” or “Add to Home screen”
Android provides the best PWA experience with full offline support, background sync, and push notifications (when implemented).
Installing on Desktop
Chrome/Edge/Brave (Chromium-based)
Click Install Button
Look for the install icon in the address bar (⊕ or computer icon)Or go to menu → “Install Home Account”
Firefox
Firefox does not fully support PWA installation on desktop. However, you can:
- Bookmark the page for quick access
- Pin the tab for always-on access
- Use the offline caching features (service worker still works)
Manifest Configuration
The PWA manifest defines how the app appears when installed:Key Manifest Properties
- display: “standalone”: App opens without browser UI
- start_url: ”/”: Where the app starts when launched
- scope: ”/”: URLs within scope are part of the PWA
- theme_color: Affects system UI (status bar, task switcher)
- maskable icon: Adapts to different device shapes (Android)
Service Worker Configuration
Home Account uses Serwist for sophisticated caching strategies:Caching Strategies
Home Account uses different strategies for different asset types:NetworkFirst (Navigation)
For HTML pages, the service worker tries the network first, falling back to cache if offline.- Always shows the latest content when online
- Falls back to cached version when offline
- Ideal for pages that change frequently
CacheFirst (Static Assets)
For CSS, JavaScript, and images, the service worker checks the cache first.- Instant loading from cache
- Reduces bandwidth usage
- Perfect for immutable assets (hashed filenames)
- Updates automatically when new versions are deployed
Not Cached: API Calls
Next.js Integration
Serwist is integrated into the Next.js build process:Build Process
- Development: Service worker is disabled for faster hot reload
- Production: Service worker is compiled and precache manifest is generated
- Deployment: sw.js is served from /public/sw.js
The service worker automatically registers itself when the app loads. No manual registration needed.
Offline Capabilities
What Works Offline
✅ Available offline:- All HTML pages (dashboard, transactions, settings)
- All JavaScript and CSS assets
- All images and icons
- Google Fonts
- Application UI
- Loading transaction data
- Creating/editing transactions
- Importing files
- Authentication
- Real-time sync
Offline User Experience
When offline, users can:- Open the app and view the UI
- See previously loaded transaction data (from React Query cache)
- Navigate between cached pages
- View cached images
- React Query will show the request as pending
- Data will sync automatically when connection is restored
- User sees clear “offline” indicators
Cache Management
Automatic Cache Expiration
Cache Versioning
Caches are versioned (home-account-v1-*) to allow breaking changes:
When you increment the version (e.g., to
v2), old caches are automatically cleaned up by Serwist.Manual Cache Clearing
Users can clear the cache in their browser: Chrome/Edge:- Settings → Privacy and security → Site settings
- Find Home Account
- Click “Clear data”
- Settings → Safari → Advanced → Website Data
- Find Home Account
- Swipe left and delete
Update Strategy
Service Worker Updates
- User visits the app
- Browser checks for new service worker
- If found, downloads in background
- New service worker waits for old one to finish
- User refreshes or closes all tabs
- New service worker activates
Force Update on Message
Troubleshooting
App not installing
App not installing
- Ensure you’re using HTTPS (required for PWA)
- Check that manifest.json is accessible
- Verify service worker is registering (check DevTools → Application → Service Workers)
- Try a different browser (Chromium-based browsers have best support)
Offline mode not working
Offline mode not working
- Check service worker status in DevTools → Application → Service Workers
- Verify cache storage in DevTools → Application → Cache Storage
- Ensure you loaded the pages while online first
- API calls intentionally do NOT work offline (by design)
Updates not appearing
Updates not appearing
- Close all tabs running Home Account
- Open a new tab and navigate to the app
- Check DevTools → Application → Service Workers for update status
- Try hard refresh (Ctrl+Shift+R or Cmd+Shift+R)
Icon not appearing (iOS)
Icon not appearing (iOS)
- Ensure all icon sizes are present in /public/
- Check apple-touch-icon.png is accessible
- Icons must be square and properly sized
- Try clearing Safari cache and re-installing
Cache taking up too much space
Cache taking up too much space
- Caches automatically expire after set time periods
purgeOnQuotaError: trueclears cache if storage is full- Users can manually clear cache in browser settings
- Consider reducing
maxEntriesvalues in ExpirationPlugin
Best Practices
For End Users
For End Users
- Install the PWA for the best experience
- Keep the app updated by closing and reopening periodically
- Load pages while online to cache them for offline use
- Remember that transaction data requires internet
For Developers
For Developers
- Test PWA installation on real devices, not just emulators
- Use Lighthouse to audit PWA readiness
- Version your caches when making breaking changes
- Don’t cache API responses (keep data fresh)
- Test offline scenarios thoroughly
Performance Optimization
Performance Optimization
- Use CacheFirst for immutable assets (hashed filenames)
- Use NetworkFirst for pages that change frequently
- Set appropriate
maxAgeSecondsfor each asset type - Enable
navigationPreloadto speed up first paint - Precache critical assets using
__SW_MANIFEST
