Skip to main content

Progressive Web App (PWA)

An Azure reference architecture for a progressive web app using service workers, IndexedDB, and background sync for offline-capable, installable mobile-web experiences. It unifies platforms in one codebase with strong resilience to poor connectivity.

Cloud Provider
AZURE
Components
7
Use Cases
4
Standards
5

Progressive Web App (PWA)

A progressive web app (PWA) is a website that behaves like an installed app: it works offline, loads instantly, can be added to the home screen, and receives push notifications. The enabling technology is the service worker, a script that intercepts network requests and serves cached responses. Choose a PWA for mobile-web experiences, field tools, and audiences on slow or intermittent connections, when you want one codebase across platforms without an app store. This design hosts on Azure.

Components

  • Service worker: a background script that caches assets and data and serves them offline.
  • App shell: the minimal HTML, CSS, and JavaScript cached for instant first load.
  • CDN: distributes the shell and assets globally with low latency.
  • IndexedDB: on-device structured storage for offline data.
  • Web Push: re-engages users with notifications even when the app is closed.
  • Azure Static Web Apps: hosts the front end with integrated CI/CD and APIs.
  • Background sync: queues writes made offline and replays them when connectivity returns.

Data Flow

On first visit the service worker installs and caches the app shell. Subsequent loads serve the shell instantly from cache, then fetch fresh data with a cache-first or stale-while-revalidate strategy. Offline, the app reads from IndexedDB and queues writes through background sync. When the network returns, queued operations replay to the backend. Push messages arrive via the service worker regardless of app state.

Scaling and Resilience

The service worker shifts load off the server: cached assets and data mean fewer requests. Offline support makes the app resilient to flaky networks by design. Version the service worker carefully and use a skip-waiting strategy to avoid serving stale caches after a deploy. Static hosting on a CDN scales effortlessly for the front end. Track Core Web Vitals and cache hit ratio.

Security

Service workers require HTTPS, which raises the baseline. Scope caches and clear stale ones on update to avoid serving outdated or sensitive data. Do not cache authenticated responses without care. Apply a Content Security Policy. Encrypt sensitive on-device data and avoid storing secrets in IndexedDB. Validate replayed offline writes server-side, since they may be stale or tampered with.

Trade-offs and Alternatives

PWAs avoid app-store friction and unify codebases, but have less access to device capabilities than native apps and weaker support for some push and background features on certain platforms. For deep hardware integration or store distribution, native or a cross-platform framework like Flutter is a better target. For purely online content, a standard responsive site without a service worker is simpler.