List Sorter is now configured as a Progressive Web App (PWA) with offline-first capabilities.
- Location:
src/app/app.config.ts - Strategy: Registers when the app is stable (after 30 seconds)
- Environment: Only enabled in production builds (not in dev mode)
- PouchDB: Local database that works offline by default
- Service Worker: Caches app shell and assets
- Data Persistence: All user data stored locally in IndexedDB via PouchDB
- Location:
public/manifest.webmanifest - Features:
- App name and description
- Theme color:
#667eea(purple gradient) - Icons for all device sizes (72x72 to 512x512)
- Standalone display mode
- Installable on mobile and desktop
- Location:
ngsw-config.json - Asset Groups:
- app: Prefetches core app files (HTML, CSS, JS)
- assets: Lazy loads images and fonts
- Data Groups: Configured for API caching (if needed in future)
- Service:
src/app/services/pwa.service.ts - Features:
- Automatic update checks every 6 hours
- User prompt when new version is available
- Seamless update activation
- User visits the app in a browser
- Browser detects the manifest and service worker
- "Add to Home Screen" prompt appears (on supported devices)
- App installs like a native app
- First Visit: App downloads and caches all assets
- Subsequent Visits: Loads instantly from cache
- Offline Mode: Full functionality available without internet
- Data Sync: PouchDB stores all data locally (can sync to CouchDB if configured)
- Service worker checks for updates every 6 hours
- When update found, user is prompted
- User accepts → app reloads with new version
- Seamless update without data loss
npm start
# Service worker is DISABLED in dev modenpm run build
# Service worker is ENABLED
# Output in dist/ folder# Build for local testing (without GitHub Pages baseHref)
npm run build:local
# Serve with a simple HTTP server
npm run serve:local
# Open http://localhost:8080
# Check DevTools > Application > Service WorkersNote: Use build:local for local testing. The default build command uses /ListSorter/ baseHref for GitHub Pages deployment.
✅ Service Worker: Registered and caching assets ✅ Manifest: Configured with icons and metadata ✅ HTTPS: Required for PWA (works on localhost for testing) ✅ Offline: App works without internet connection ✅ Installable: Can be added to home screen ✅ Fast: Instant loading from cache ✅ Responsive: Works on all screen sizes ✅ Update Strategy: Automatic checks with user prompts
- Open DevTools (F12)
- Go to Application tab
- Check:
- Manifest: Verify app name, icons, theme color
- Service Workers: Should show "activated and running"
- Cache Storage: Should show cached assets
- IndexedDB: Should show PouchDB database
- Open DevTools
- Go to Lighthouse tab
- Select Progressive Web App
- Click Generate report
- Should score 90+ for PWA
- Open app in browser
- Open DevTools > Network tab
- Check "Offline" checkbox
- Reload page
- App should still work fully
- ✅ Chrome/Edge (Desktop & Mobile)
- ✅ Firefox (Desktop & Mobile)
- ✅ Safari (iOS 11.3+)
- ✅ Samsung Internet
⚠️ IE11: Not supported (modern browsers only)
- Background Sync: Sync data when connection restored
- Push Notifications: Notify users of updates
- Share Target: Allow sharing lists to the app
- CouchDB Sync: Optional cloud backup
- Offline Analytics: Track usage patterns
- Check browser console for errors
- Ensure running on HTTPS or localhost
- Clear browser cache and reload
- Check
isDevMode()returns false in production
- Verify manifest.webmanifest is accessible
- Check all required manifest fields are present
- Ensure at least one icon is 192x192 or larger
- Must be served over HTTPS
- Check service worker is registered
- Verify ngsw-config.json is valid
- Clear service worker in DevTools
- Hard reload (Ctrl+Shift+R)