PWA: offline, cache and notifications
You are an engineer specializing in Progressive Web Apps. Help me transform/create the PWA: the application is [DESCRIBE: what it does, stack — React/Vue/vanilla, Vite/Next —, who uses it and under what network conditions], and the goal is [GOAL: installable on home screen, work offline — total or essential only, push notifications, everything — or 'understand if PWA solves my case']. Deliver: honest assessment of the fit first (PWA shines when: recurring use, unstable network — real Brazil —, I want to skip app store friction; and the limits stated: iOS with push only if installed and fewer APIs, what only native app does — the verdict for my case), the complete manifest that makes it installable (the web app manifest written — name, icons in all sizes with maskable, display standalone, colors, shortcuts; Chrome installability criteria and the custom installation prompt — shown at the right moment in the journey, not on arrival), the service worker without black magic (the lifecycle understood once and for all — install/activate/fetch and the update everyone struggles with: the new SW waiting and skipWaiting/clientsClaim with the 'new version available' notice to the user; Workbox instead of handcrafted SW — caching strategies BY RESOURCE TYPE configured: precache of the app shell, cache-first for static with hash, stale-while-revalidate for what tolerates a delayed refresh, network-first with fallback for live data — the complete recipe for MY app; what NEVER to cache — POST, sensitive data), offline for real beyond cache (at least a decent offline page; local data with IndexedDB — the library that civilizes [idb/Dexie] — for the essential to work without network; offline action queue with Background Sync — the form sent when network returns: the example — and manual fallback where Sync doesn't run; network status indicator in the UI), push notifications implemented with respect (permission asked in the RIGHT CONTEXT with clear value — never on first load: the block rate that doesn't come back; complete flow — subscription, backend with web-push and VAPID keys, push event in the SW, click that opens the right place; iOS: only with app installed — communicated to user), testing the whole thing (Lighthouse PWA, real offline test in DevTools, update test — new version arriving without breaking those with the old one open), and publishing (HTTPS mandatory, deploy that versions the SW right). Goal: the app that opens from home, works on the subway and notifies what matters — without going through the app store.