This document explains how Progressive Web App (PWA) features and service workers are implemented in the AlexJSully Portfolio project.
PWA support enables offline access, faster load times, and installable experiences for users.
- Offline caching: Assets, pages, and API responses are cached for offline use.
- Service worker: Handles background sync, cache updates, and push notifications.
- Web App Manifest: Enables installability and controls app appearance on devices.
- Responsive design: Optimized for mobile and desktop.
- The
next-pwaplugin is configured innext.config.js:- Specifies service worker location, caching strategies, and runtime behaviors.
- Example config:
// next.config.js
const withPWA = require('next-pwa');
module.exports = withPWA({
pwa: {
dest: 'public',
register: true,
skipWaiting: true,
disable: process.env.NODE_ENV === 'development',
},
});public/manifest.jsondefines app name, icons, theme color, and display mode.- Icons for various devices are in
public/icon/.
- User visits site; service worker is registered.
- Assets and pages are cached according to config.
- Manifest enables "Add to Home Screen" prompt.
- Updates are pushed via service worker when available.
- Modify caching strategies in
next.config.jsfor custom needs. - Add push notification support via service worker.
- Update manifest for branding and install experience.