Every guide on this site tells you how to build a PWA. Here is how this site does it, so you can judge whether we follow our own advice. You can read the live worker at /sw.js.
One generated file
Our pages come from a small PHP engine, so the service worker is generated by the server too. At the top is a configuration object with a version, the precache list and the offline page for each language. The version is a hash of our CSS and JavaScript files, our content index and the PWA settings, so any change to the site produces a new worker and browsers notice it on the next visit.
The script is served with Cache-Control: no-cache.
Install: the app shell
On install we fetch the home page, the offline pages in four languages, the manifest, our CSS and JavaScript, icons and a few key pages: the learn and tools hubs, two popular guides and the support table. We do not call skipWaiting() here.
Pages: network first, with a timeout
Every navigation goes to the network first, using navigation preload so the request starts while the worker boots. If no answer arrives within four seconds, or the network fails, we serve the cached copy of that page, and if there is none, the offline page in the right language. Successful pages are stored, keeping the 80 most recent.
Files: cache first
Our CSS and JavaScript have a version in their URL (?v=...), so they never change at the same address: cache first is safe and fast. Other same-origin files use stale-while-revalidate. Google Fonts are cached with stale-while-revalidate too.
What we never touch
Anything that is not a GET request, and everything under /admin, /api/, /forms/ and the checker's endpoint. Those always go to the network.
Save for offline
The Save for offline button on each guide sends the page's URL to the worker with postMessage. The worker fetches it and stores it in a separate cache that is never trimmed. The learn page can save every guide at once.
Updates
When a new worker has installed and is waiting, our page shows a small message with a Reload button. Clicking it sends SKIP_WAITING; when the new worker takes control, the page reloads once. People are never interrupted mid-sentence.
Push
There is no marketing push on PWA.live. The worker has push and notificationclick handlers so the notification tester can show you a real notification on your device.
The manifest
Our manifest has an id, a tagged start_url, maskable icons, display_override with window controls overlay, four shortcuts, real screenshots for the richer install dialog, and a share_target that sends shared links to the PWA checker.
If you spot something we could do better, tell us.