PWA (Progressive Web App) Setup
Configure Ever Gauzy as a Progressive Web App.
Overviewβ
A PWA provides:
- Offline access to cached pages
- Install to home screen
- Push notifications
- Background sync
Angular PWA Setupβ
1. Add Service Workerβ
ng add @angular/pwa --project=gauzy
This generates:
manifest.webmanifestngsw-config.json- Service worker registration in
app.module.ts
2. Configure Manifestβ
{
"name": "Ever Gauzy",
"short_name": "Gauzy",
"theme_color": "#3366FF",
"background_color": "#FFFFFF",
"display": "standalone",
"scope": "/",
"start_url": "/",
"icons": [
{
"src": "assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
3. Cache Strategyβ
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": ["/favicon.ico", "/index.html", "/*.css", "/*.js"]
}
},
{
"name": "assets",
"installMode": "lazy",
"resources": {
"files": ["/assets/**"]
}
}
],
"dataGroups": [
{
"name": "api",
"urls": ["/api/**"],
"cacheConfig": {
"maxSize": 100,
"maxAge": "5m",
"strategy": "freshness"
}
}
]
}
4. Build for Productionβ
yarn build --configuration production
Testingβ
# Serve built app (service workers only work over HTTPS or localhost)
npx http-server dist/apps/gauzy -p 8080
Related Pagesβ
- Frontend Architecture β architecture
- Production Deployment β deployment