vite-plugin-pwa, which generates a service worker and a Web App Manifest at build time.
Vite configuration
The PWA plugin is configured invite.config.js:
Key configuration choices
App manifest
The Web App Manifest is generated from themanifest key in vite.config.js and served from /build/manifest.webmanifest. Browsers use it to populate the install prompt and home screen icon.
The maskable icon variant allows Android to apply adaptive icon shaping (circles, squircles, etc.) without clipping your logo. Make sure
/icon-512x512.png has sufficient safe-zone padding.Service worker
vite-plugin-pwa generates a Workbox-powered service worker during npm run build. It is registered automatically with registerType: 'autoUpdate'.
What the service worker caches
Offline capability
With the current configuration, the app shell (JS, CSS, fonts, icons) loads offline after the first visit. Dynamic content (orders, products, catalog data) requires a network connection because API responses are intentionally not cached. This design is a deliberate security trade-off: tenant data must never be stored in the browser cache where it could be accessed by another user on a shared device.Installing the app
- Android (Chrome)
- iOS (Safari)
- Desktop (Chrome / Edge)
1
Open the site in Chrome
Navigate to the app URL in Chrome on Android.
2
Accept the install prompt
Chrome shows an “Add to Home screen” banner or an install icon in the address bar. Tap it and confirm.
3
Launch from home screen
The app opens in standalone mode — no browser address bar or navigation chrome.
Integration with Web Push
The service worker is the delivery point for background push notifications. When the Laravel backend sends a push via VAPID, the browser vendor’s push service wakes the service worker even if the browser tab is closed. The service worker listens for thepush event and displays the notification using the Notifications API. Tapping the notification triggers the notificationclick event, which opens the relevant URL from the notification payload.
See the push notifications page for the full frontend subscription flow and service worker event handler code.
Build output
After runningnpm run build, the following files are emitted to public/build/:
The manifest is referenced automatically in the HTML
<head> by the Vite plugin.