Skip to main content

Progressive Web App

WEFA is installable as a PWA with offline support.

Manifest

{
"name": "WEFA",
"short_name": "WEFA",
"display": "standalone",
"start_url": "/",
"scope": "/",
"theme_color": "#...",
"background_color": "#...",
"icons": [
{ "src": "/icons/icon-192x192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/icons/icon-512x512.png", "sizes": "512x512", "type": "image/png" }
]
}

Service Worker

Configured via vite-plugin-pwa with Workbox in vite.config.ts.

Caching Strategy

ResourceStrategyRationale
App shellPrecacheAlways available offline
Seed creature thumbnailsPrecacheOffline deck/detail fallback without 3D install cost
IconsPrecachePWA requirement
Creature thumbnails requested at runtimeCacheFirstCheap and stable
Creature GLBsCacheFirstOn-demand 3D with bounded runtime storage

Registration

Service worker is registered in src/main.tsx with registerSW({ immediate: true }).

The production build also runs scripts/check-sw-precache.cjs, which fails if .glb files, raw PBR sidecars, or creatures/manifest.json leak into the precache manifest.

Web APIs Used

APIPurpose
Background SyncFlush job queue when reconnected
Push / NotificationsCare reminders (configurable, default daily)
Badging APIPending creature/badge notification count
Screen Wake LockKeep screen on during active game
Screen OrientationLock portrait during gameplay
VibrationHaptic feedback on key interactions
Web AudioSound effects (optional)

iOS Considerations

  • Browser storage quotas vary and may be evicted under pressure
  • Default install keeps creature 3D out of the precache to protect mobile storage
  • Optional offline 3D pins are stored in Cache Storage with Dexie metadata
  • No Push Notifications on iOS < 16.4
  • No Badging API on iOS
  • Service worker support varies by iOS version
  • standalone display mode hides Safari chrome