Progressive Web App (PWA)
Open Tarteel is a fully installable Progressive Web App with offline audio caching, providing a native app-like experience.PWA Features
Installable
Add to home screen on mobile and desktop with custom icon and splash screen
Offline-First
Audio files cached for offline playback, service worker handles network failures
Fast Loading
Precached static assets, instant subsequent page loads
Native Experience
Fullscreen mode, standalone display, no browser UI
Service Worker Setup
Open Tarteel uses Serwist for service worker generation and management.Next.js Configuration
The service worker is disabled in development to avoid caching issues during local development. It only activates in production builds.
Service Worker Implementation
Cache Strategy Explained
- Audio Caching
- Static Assets
- API Responses
Strategy: Cache First
- Check cache for audio file
- If found, return cached version instantly
- If not found, fetch from network
- Cache the response for future requests
Maximum 20 audio files cached. LRU (Least Recently Used) eviction when limit exceeded.
Cache duration: 7 days (604,800 seconds)
Web App Manifest
Manifest Properties
Display Modes
Display Modes
Icons Requirements
Icons Requirements
Required Sizes:
- 192x192px: Minimum size for Android
- 512x512px: High-resolution displays
- 144x144px: Windows tiles
- 96x96px: App shortcuts
- 72x72px, 48x48px: Older devices
Screenshots for App Stores
Screenshots for App Stores
Screenshots appear in:
- Chrome Web Store
- Microsoft Store
- Installation prompts
- Wide (desktop): 1280x720 minimum
- Narrow (mobile): 320x640 minimum
- PNG or JPEG format
- Descriptive labels
Installation
Browser Install Prompts
Engagement Heuristics Met
Browser shows install prompt after:
- User visits twice
- 5 minutes elapsed between visits
- User engages with page (clicks, scrolls)
Install Prompt Appears
User can:
- Click “Install” in browser menu
- Use A2HS (Add to Home Screen) banner
- Desktop: Install from address bar icon
Platform-Specific Installation
- Android
- iOS
- Desktop (Chrome/Edge)
- Desktop (Other Browsers)
- Open in Chrome or Edge
- Tap menu → “Add to Home screen”
- Or tap install banner when it appears
- App appears in app drawer
- WebAPK generated by browser
- Appears in app settings
- Can be uninstalled like native apps
Offline Functionality
What Works Offline
UI Navigation
- Home page
- About page
- Contact page
- Settings
Audio Playback
- Previously played surahs (up to 20)
- Cached within last 7 days
- Full player controls
User Preferences
- Favorite reciters
- Volume settings
- Playback speed
- Language preference
Cached Reciters
- Previously fetched reciter lists
- Last selected reciter
- Moshaf information
What Requires Network
New Content
- Fetching new reciters
- Loading unplayed surahs
- Updated reciter lists
External Features
- Contact form submission
- Feedback sending
- Analytics
Testing PWA
Chrome DevTools Audit
Run PWA Audit
- Select “Progressive Web App” category
- Choose “Mobile” or “Desktop”
- Click “Analyze page load”
Service Worker Debugging
- Chrome DevTools
- Cache Inspection
- Offline Simulation
- Open DevTools → Application tab
- Click “Service Workers” in sidebar
- View status: Installing / Activated / Redundant
- Test:
- Update on reload
- Bypass for network
- Unregister
Build and Test
Best Practices
Cache Size Management
Cache Size Management
- Limit
maxEntriesto prevent excessive storage usage - Set reasonable
maxAgeSecondsfor audio files - Clear old caches on service worker updates
Service Worker Updates
Service Worker Updates
skipWaiting: trueactivates new SW immediately- Notify users of updates with toast/banner
- Implement update check on page visibility
HTTPS Requirement
HTTPS Requirement
Service workers only work on HTTPS (or localhost):
- Use Vercel/Netlify for automatic HTTPS
- Or Cloudflare for custom domains
- Development: localhost works without HTTPS
Storage Quota
Storage Quota
Check and request persistent storage:
Open Tarteel’s PWA configuration provides a robust offline-first experience with intelligent audio caching for uninterrupted Quran listening.