better-pwa

better-pwa is to PWAs what React Query is to server state — but for the entire app lifecycle.

npm install @better-pwa/core

What you get

never loses data

Offline mutations queue and replay automatically. IDB-backed durability guarantees.

never breaks on update

Background service worker swaps with zero session interruption.

never desyncs across tabs

Single source of truth via BroadcastChannel. Leader election, deduplication.

never silently fails permissions

Batched, retried, with fallback UI hooks. Exponential backoff.

One line. Everything works.

import { createPwa } from "@better-pwa/core"

createPwa({ preset: "saas" })

That one line sets up a service worker, manifest, state engine, offline queue, update lifecycle, multi-tab sync, and permission system. The preset made 100 configuration decisions for you.

Presets: 100 decisions → 1 decision

saas

Dashboards, CRMs, admin panels.

updateStrategy: "soft"

ecommerce

Cart persistence, checkout sync.

updateStrategy: "on-reload"

offline-first

Field apps, spotty connectivity.

conflictResolution: "merge"

content

Blogs, media, reading apps.

permissionBehavior: "manual"

Runtime Guarantees

These aren't best practices. They are enforced invariants with runtime violation detection.

GuaranteeWhat it means
Data DurabilityUser actions are never lost — offline or online
Update SafetyNo broken sessions during deployments
Cross-Tab ConsistencyOne state everywhere, no stale tabs
Permission ResilienceEvery denial has a recovery path
Cold Start IntegrityDeterministic boot regardless of cache state
Schema EvolutionState migrations prevent data loss on version upgrades
Resource PrioritizationCritical resources always synced before non-critical

ready to build?

Quick Start →