Creating a PWA
1
Create the web app manifest
Create Use a favicon generator to create icon sets and place them in
app/manifest.ts to define your app’s metadata:public/.2
Implement push notifications
Create the main page component with push notification management:
3
Create Server Actions for notifications
4
Generate VAPID keys
Install Add the output to your
web-push globally and generate keys:.env file:5
Create the service worker
6
Add security headers
Configure security headers in
next.config.js, especially for the service worker:Home screen installation
For a PWA to be installable, you need:- A valid web app manifest (created in step 1)
- The site served over HTTPS
Testing locally
To test push notifications locally:- Accept notification permissions when prompted
- Ensure browser notifications are not globally disabled
Offline support
For offline functionality, use Serwist with Next.js. See their documentation for integration steps.The Serwist plugin currently requires webpack configuration.
