Installation
Install the core package, plus an optional adapter for your framework.
Install the core first. Add an adapter only if you want framework bindings.
Core package
npm install @jopgood/pwa-core
React adapter
npm install @jopgood/pwa-core @jopgood/react-pwa
Peer deps
The React adapter declares react and react-dom ≥ 18 as peer dependencies. Both packages require Node ≥ 20 for local development.
You also need
- A service-worker file at a known URL, typically
public/sw.js. The core registers it, but doesn't generate it. Service Worker API on MDN ↗ - A VAPID public key for push subscriptions. Generate the key pair with
web-push(or any VAPID-compatible tool) and keep the private key on your backend. VAPID overview ↗