PWA

Your website, wearing an app costume.

▶ the lesson · narrated sketch video · tap for sound

the intro

A Progressive Web App is a website with three additions: a manifest (name and icons), a service worker (offline + notifications), and HTTPS. Users install it from the browser straight to their home screen — no app store in the way.

fun fact ✦

A PWA can work fully offline — the service worker serves cached pages while the network is gone.

the docs

the deep dive

the ideas behind the video — concepts, diagrams, a walkthrough and the traps to avoid

Every tap in a normal web app is a small prayer to the network. A service worker is a script the browser keeps running that stands between your app and that network, so pages, styles, and data can be answered from the device itself. The manifest is just the business card that lets the browser put an icon on the home screen and open you fullscreen. Install without a store, update without a review queue.

a proxy that answers without the network

installed appservice workernetwork
the service worker sits between your app and the network, and can answer without it

key terms

manifest

A JSON file describing your app: name, icons, colors, start URL, and how it should open.

"display": "standalone"

service worker

A background script that can intercept every network request and answer it from cache.

navigator.serviceWorker.register

app shell

The minimal frame of the UI — layout, fonts, code — cached so the app opens instantly, offline or not.

HTML + CSS + JS skeleton

stale-while-revalidate

Serve the cached copy immediately, refresh it in the background for next time.

fast today, fresh tomorrow

how it works

  1. 1
    Serve over HTTPS

    The browser only grants service workers on secure origins. Localhost counts for development.

  2. 2
    Add the manifest

    Name, icons at 192 and 512 pixels, a start URL, and display: standalone so it opens without browser chrome.

  3. 3
    Register the worker

    One line of JS asks the browser to install your service worker. It then lives between app and network.

  4. 4
    Cache the app shell

    On install, prefetch the HTML, CSS, and JS frame so the app opens even with zero connectivity.

  5. 5
    Design the offline story

    Decide what each screen shows without fresh data. Network-first for data, a cached fallback page for the rest.

the code, explained

the heart of a PWA: every request passes through your worker

1// every request passes through here
2self.addEventListener('fetch', (e) => {
3 e.respondWith(
4 caches.match(e.request)
cache first — instant if we have it
5 .then((hit) => hit || fetch(e.request))
miss: the network is the fallback
6 )
7})

side by side

PWA

  • install straight from the site
  • no review gate, updates are instant
  • one codebase runs everywhere
  • iOS holds back some APIs
VS

store app

  • discovered via store search
  • full native API surface
  • each update passes review
  • users trust the store badge
🪤 gotcha

A service worker is stubborn: deploy a new version and users may keep seeing the old cached app until the updated worker finishes installing and takes control. Bump your cache names, call clients.claim(), and test updates on a real deployed site — localhost hides this.

quick answers

Do PWAs work on iPhone?

Yes, with limits: Safari supports Add to Home Screen and, since iOS 16.4, push notifications for installed apps. There is no Chrome-style automatic install prompt.

Is a responsive site already a PWA?

No. Until you add HTTPS, a manifest, and a service worker, it is just a website. The three ingredients are the difference.

How much can I cache?

Chrome lets Cache Storage and IndexedDB grow with free disk space — easily hundreds of megabytes. Safari is stricter and may clear unused data, so treat offline data as expendable.

quick hits about PWA

short answers · interviews, tips, trivia & hidden gems

🎤 interview

What makes a PWA?watch ↗

📚 tutorial

The manifest fields that matterwatch ↗

🔧 useful

Is my PWA installable?watch ↗

💎 deep

What do you serve offline?watch ↗

💎 deep

Detect your PWA is installedwatch ↗

🧠 trivia

Your PWA works in airplane modewatch ↗