Overview
The PWA features are powered by Angular’s Service Worker (@angular/service-worker), which handles caching strategies, update management, and offline functionality.
Service Worker Configuration
The service worker is registered insrc/app/app.config.ts:54:
The service worker is only enabled in production mode and registers after the app becomes stable or after 30 seconds, whichever comes first.
Cache Configuration
The caching strategy is defined inngsw-config.json:
Asset Groups
Install Mode:
prefetchCritical application files that are downloaded and cached immediately:- HTML files (index.html, index.csr.html)
- JavaScript bundles
- CSS stylesheets
- Web manifest
- Default English translations
- Favicon
Install Mode:
Update Mode:
lazyUpdate Mode:
prefetchMedia and font files that are cached on-demand:- Images (svg, jpg, png, webp, avif, gif)
- Fonts (otf, ttf, woff, woff2)
- Cursors (cur)
Web App Manifest
The PWA manifest defines how the app appears when installed (public/manifest.webmanifest):
The
"purpose": "maskable any" ensures icons display correctly on all platforms, including Android adaptive icons.Service Worker Service
Jet includes a comprehensive service for managing updates (src/app/services/service-worker/service-worker.service.ts:20):Automatic Update Detection
The service monitors for new versions and notifies users:Manual Update Check
Users can manually check for updates from the Settings page (src/app/components/settings-page/settings-page.component.ts:68):Update Flow
Download Updates
The new version is downloaded in the background while the user continues using the app
Service Initialization
The service worker service is initialized automatically at app startup:Offline Support
With the configured caching strategies:- Core app files are cached on first visit
- API responses can be cached with custom strategies
- Media assets are cached as they’re requested
- Translations (English) are prefetched for offline use
Update Tracking
The service tracks the last update check timestamp in localStorage:Analytics Integration
Update events are tracked for analytics:no_new_version_detected- Update check found no updatesversion_detected- New version detected and downloadingversion_ready- New version ready to activateversion_installation_failed- Update installation failed
Testing PWA Features
Local Testing
Service workers only run in production mode. Use
ng build (not ng serve) to test PWA features.Chrome DevTools
- Open Chrome DevTools
- Navigate to Application > Service Workers
- Check the service worker status
- Test offline mode with the Offline checkbox
- View cached resources in Cache Storage
Installability
The app can be installed on:- Desktop: Chrome, Edge (“Install App” in address bar)
- Android: Chrome, Firefox, Samsung Internet (“Add to Home Screen”)
- iOS/iPadOS: Safari (“Add to Home Screen”)
Installation Prompt
Browsers will show an install prompt when:- The app has a valid manifest
- It’s served over HTTPS (or localhost)
- It has registered a service worker
- The user has engaged with the site
Safe Area Support
Jet handles device safe areas (notches, home indicators) automatically:Best Practices
Version your API calls
Version your API calls
Use API versioning to prevent breaking changes between app updates
Handle failed updates gracefully
Handle failed updates gracefully
Always provide user feedback when updates fail
Test offline scenarios
Test offline scenarios
Verify critical user flows work without network connectivity
Monitor update analytics
Monitor update analytics
Track update success/failure rates to identify deployment issues
Keep manifest updated
Keep manifest updated
Update app icons and metadata when rebranding
Troubleshooting
Service worker not registering
Service worker not registering
- Ensure you’re testing a production build
- Check the app is served over HTTPS or localhost
- Verify
ngsw-worker.jsis accessible
Updates not detected
Updates not detected
- Clear the service worker in DevTools
- Check network requests for
ngsw.json - Verify the build hash changed in
ngsw.json
App not installable
App not installable
- Validate your
manifest.webmanifestformat - Ensure all required manifest fields are present
- Check icons exist at the specified paths
Next Steps
Theming
Configure Material Design themes
Deployment
Deploy your PWA to production