Version: 2.1.0Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Last Updated: 2026-03-30
Status: ✅ Fully Configured Complete guide to Progressive Web App (PWA) setup, configuration, and optimization for the Encore Health OS Platform.
Table of Contents
- Overview
- Current Configuration
- Icon Setup
- Service Worker Configuration
- Performance Optimization
- Mobile Safe Area Support
- Testing Checklist
- Troubleshooting
- References
Overview
Encore Health OS is built as a Progressive Web App (PWA) with mobile-first responsive design, advanced caching strategies, and optimized build configuration for maximum performance. Key Features:- ✅ Auto-updating service worker
- ✅ Comprehensive Workbox caching strategies
- ✅ Raster icons generated from
public/favicon.svg(Sharp +png-to-ico) - ✅ Update notifications and offline support
- ✅ Mobile-first PWA features
- ✅ Unified icon system (Encore hex mark — aligned with
public/brand/encore-primary-dark.svg)
- Mobile Navigation Guide - Mobile navigation patterns
- Development Documentation Index - Complete development guide index
- Environment Variables - Environment variable configuration for PWA
Current Configuration
Setup Status ✅
PWA setup is fully configured with icons generated frompublic/favicon.svg via Sharp and committed to public/.
- ✅ Auto-updating service worker
- ✅ Comprehensive Workbox caching strategies
- ✅ PNG + ICO outputs for favicon and install surfaces
- ✅ Update notifications and offline support
- ✅ Mobile-first PWA features
- ✅ Unified icon system (Encore hex mark — aligned with
public/brand/encore-primary-dark.svg)
Configuration Files
vite.config.ts- VitePWA plugin configurationindex.html- Viewport meta tag, apple-touch-icon linkssrc/index.css- Safe area CSS custom propertiessrc/platform/pwa/PwaUpdatePrompt.tsx- Update notification component
Icon Setup
Current icon set
| File | Size | Purpose |
|---|---|---|
favicon.svg | 512×512 (vector) | Master artwork; matches encore-primary-dark geometry |
favicon.png | 32×32 | PNG favicon (index.html) |
favicon.ico | 16, 32, 48 | Multi-size ICO for browsers |
pwa-64x64.png … pwa-512x512.png | various | Manifest + index.html |
pwa-128x128.png, pwa-256x256.png | 128, 256 | Manifest (vite.config.ts) |
maskable-icon-512x512.png | 512×512 | Android adaptive (purpose: maskable); logo drawn at ~410×410 centered (~20% edge safe zone) |
apple-touch-icon-180x180.png | 180×180 | iOS home screen |
Source asset
public/favicon.svg— Master Encore hex mark (512×512 viewBox, rounded square). Design source:public/brand/encore-primary-dark.svg(scale and rounding applied for app-icon use).
Icon generation
From the repository root:public/ after changing favicon.svg. Bump the ?v= query on favicon links in index.html if browsers cache aggressively.
Maskable icon: maskable-icon-512x512.png uses a 512×512 canvas with the SVG rasterized at 410×410 and composited centered, reserving roughly a 20% edge safe zone for Android adaptive icon masks (see Adaptive icons).
Manifest Configuration
The PWA manifest is configured invite.config.ts using VitePWA plugin:
See vite.config.ts for the live VitePWA block. It includes favicon.ico, favicon.png, apple-touch-icon-180x180.png, and manifest icons (pwa-64x64 through pwa-512x512, plus maskable-icon-512x512.png). theme_color / background_color use Encore navy (#0D2140).
Key Points:
registerType: "autoUpdate"- Service worker updates automatically- Separate
anyandmaskableicons for best platform compatibility - iOS home screen icon specified in
index.htmlwith<link rel="apple-touch-icon"> background_colormatchestheme_colorfor consistent branding
HTML References
Updateindex.html:
index.html links favicon.svg, favicon.ico, favicon.png, PWA PNG sizes, and apple-touch-icon-180x180.png with a cache-bust query (e.g. ?v=5). Keep those in sync when regenerating assets.
Icon regeneration
public/ (and bump ?v= in index.html when needed).
Service Worker Configuration
Auto-Registration (VitePWA)
Encore Health OS uses VitePWA for automatic service worker registration. No manual registration code needed. Current approach:- VitePWA handles registration automatically
- Service worker updates via
useRegisterSW()hook fromvirtual:pwa-register/react
Update Notifications
Component:src/platform/pwa/PwaUpdatePrompt.tsx
Uses useRegisterSW() hook to detect when a new service worker is available and shows a toast notification:
src/App.tsx for app-wide update detection.
Performance Optimization
Vite Build Configuration
The project uses manual chunk splitting for optimal caching and load performance: Vendor Chunks:vendor-react: React, ReactDOM, React Router (~150KB)vendor-radix: Radix UI components (~100KB)vendor-query: TanStack Query (~40KB)vendor-supabase: Supabase client (~80KB)vendor-charts: Recharts, D3 (~200KB)vendor-forms: React Hook Form, Zod (~50KB)vendor-pdf: PDF.js libraries (~400KB)vendor-dnd: DnD Kit (~50KB)vendor-flow: XY Flow (~150KB)
core-hr: HR modulecore-fa: Finance modulecore-fw: Forms/Workflow modulecore-rh: Recovery Housing modulecore-gr: Governance modulecore-fm: Facilities modulecore-cl: Clinical module
platform-documents: Document managementplatform-reports: Reporting engineplatform-forms: Form builderplatform-notifications: Notification system
- Users only download chunks they need
- Vendor chunks cached long-term (rarely change)
- Core modules cached per-domain
- Better cache invalidation (only changed chunks re-downloaded)
- Initial bundle size reduced by 60-70%
Workbox Caching Strategies
CacheFirst (Long-lived assets):- Google Fonts API cache (1 year, 10 entries)
- Google Fonts webfonts (1 year, 20 entries)
- Images (30 days, 100 entries) -
.png,.jpg,.jpeg,.svg,.gif,.webp
- Supabase API calls (5 minute cache, 10s timeout, 50 entries)
- Enabled for faster page loads
- Preloads navigation requests while service worker starts
Bundle Analysis
To analyze bundle size and chunk distribution:Mobile Safe Area Support
CSS Custom Properties
Safe area insets are defined insrc/index.css using env() function:
Utility Classes
Convenience classes for applying safe area padding:Component Implementation
MobileHeader.tsx:padding-top on mobile main must match whether the second header row is rendered. The app uses shouldShowMobileHeaderContextRow so main adds var(--mobile-header-context-height) only when that row is visible (see source for the exact calc(...) classes).
Viewport Meta Tag
Required for safe area insets to work:viewport-fit=cover tells the browser to extend content into safe areas.
PWA Shortcuts and Categories
The PWA manifest includes shortcuts for quick access to key features:App Categories
The manifest specifies categories for better app store classification:businessproductivitymedical
Key Features
Offline Capability
- Service worker caches forms and submissions for offline access
- Background sync queues form submissions when offline
- Graceful degradation for features requiring connectivity
Mobile Optimization
- Touch-friendly UI (44×44px minimum touch targets)
- Safe area support for devices with notches, Dynamic Island, home indicators
- Responsive breakpoints: Mobile (320px) → Tablet (768px, 1024px) → Desktop (1280px+)
- Native-like interactions (swipe gestures, bottom navigation)
- Optimized for portrait orientation with landscape support
Installation
- Installable as standalone app on iOS, Android, and desktop
- Real PWA icons (not placeholders)
- Custom install prompt for better UX (planned)
- App update notifications with auto-refresh option
Technical Stack
- Vite Plugin PWA: Build-time service worker generation
- Workbox: Runtime caching strategies
- Service Worker: Background sync, push notifications (future)
- React Hook:
virtual:pwa-register/reactfor update detection
Testing Checklist
PWA Functionality
- Service worker registers correctly
- Offline mode works
- Update prompt appears when new version available
- Icons display correctly on home screen
- Manifest validates (use Lighthouse)
Icon Testing
- Icons appear in browser tab
- Icons appear in PWA install prompt
- Icons appear on iOS home screen
- Maskable icons work on Android
- Icons scale correctly at all sizes
Mobile Testing
Device Emulation:- Use browser DevTools device emulation
- Select devices with notches (iPhone 14 Pro, Pixel 7) to test safe areas
- Test both portrait and landscape orientations
- Test on actual mobile devices via network URL
- Verify safe area rendering on notched devices
- Test install-to-home-screen flow
- DevTools → Network → Offline
- Verify forms still render and submissions queue
- Go back online and verify sync
Performance Testing
- Lighthouse PWA score: 90+
- First Contentful Paint: <2s
- Time to Interactive: <3.5s on 3G
- Offline forms fully functional
- Safe area CSS uses hardware-optimized env() (no JS overhead)
Performance Targets
- Lighthouse PWA score: 90+
- First Contentful Paint: <2s
- Time to Interactive: <3.5s on 3G
- Offline forms fully functional
- Safe area CSS uses hardware-optimized env() (no JS overhead)
Troubleshooting
Icons Not Displaying
Problem: Icons don’t appear in browser tab or PWA install prompt Solutions:- Verify icon files exist in
public/directory - Check
vite.config.tsicon paths are correct - Clear browser cache and service worker
- Regenerate icons using the process above
- Check browser console for 404 errors
Service Worker Not Registering
Problem: Service worker doesn’t register or update Solutions:- Check browser console for errors
- Verify VitePWA plugin is configured in
vite.config.ts - Clear service worker cache in DevTools → Application → Service Workers
- Check
registerTypeis set to"autoUpdate"
Safe Area Insets Not Working
Problem: Content hidden behind notch or home indicator Solutions:- Verify viewport meta tag includes
viewport-fit=cover - Check CSS uses
env(safe-area-inset-*)correctly - Test on actual device (emulation may not show correctly)
- Verify safe area classes are applied to correct elements
Offline Mode Not Working
Problem: App doesn’t work offline Solutions:- Verify service worker is registered
- Check Workbox caching strategies are configured
- Test in DevTools → Network → Offline
- Check service worker cache in DevTools → Application → Cache Storage
Update Notification Not Showing
Problem: Users don’t see update notifications Solutions:- Verify
PwaUpdatePromptcomponent is inApp.tsx - Check
useRegisterSW()hook is working - Test by making a code change and rebuilding
- Check browser console for errors
References
- vite-plugin-pwa Documentation
- PWA Assets Generator
- Web App Manifest Spec
- Workbox Documentation
- Safe Area Insets
- Mobile Navigation Guide
Maintained By: Platform Team
Status: ✅ Ready for Production | ✅ Unified Icon System Active (Gold Compass on Dark Blue)