Overview
Estudio Three is a fully-functional Progressive Web App (PWA) built with Vite PWA Plugin. It provides native app-like experiences on mobile and desktop, including:- Offline support with Service Worker caching
- Installable to home screen (iOS/Android)
- Automatic background updates
- Push notifications (future)
- Native app feel with standalone display mode
PWA Configuration
Vite PWA Plugin Setup
Service Worker Architecture
Auto-Update Strategy
- Service Worker registers on first visit
- On subsequent visits, checks for updates in background
- If new version found, downloads assets silently
- Auto-activates new version when ready
- User sees updated app on next page load/refresh
Workbox Strategies
Estudio Three uses different caching strategies for different asset types:Static Assets (CacheFirst)
- Strategy:
CacheFirst(implicit viaglobPatterns) - Behavior: Serve from cache immediately, no network request
- Best for: JavaScript bundles, CSS, images, fonts
Google Fonts (CacheFirst)
- Expiration: 365 days
- Max Entries: 10 font files
- Rationale: Fonts rarely change, safe to cache aggressively
Supabase API Calls (NetworkFirst - Implicit)
For API calls to Supabase, Workbox uses the defaultNetworkFirst strategy:
- Try network request first
- If offline, fall back to cached response
- Update cache with successful responses
Web App Manifest
Manifest Fields
Key Properties
display: 'standalone'
display: 'standalone'
Removes browser UI (address bar, back button) when launched from home screen.Result:
- Looks like a native app
- Full-screen content area
- No browser chrome
theme_color: '#0f172a'
theme_color: '#0f172a'
Sets the color of the browser toolbar/status bar on mobile.Matches the dark theme’s background color for seamless UI.
orientation: 'portrait'
orientation: 'portrait'
Locks the app to portrait mode on mobile devices.Best for task management and timeline views.
icons with 'maskable' purpose
icons with 'maskable' purpose
iOS uses maskable icons to fit the icon into the home screen’s rounded square shape.Without this, the icon may appear with white borders or cropped edges.
Installation Instructions
iOS (iPhone/iPad)
- Open Safari (not Chrome — iOS requires Safari for PWA install)
- Navigate to
https://your-app-url.com - Tap the Share button (square with arrow)
- Scroll down and tap “Add to Home Screen”
- Customize the name (optional) and tap “Add”
- App icon appears on home screen
- Launches in fullscreen (no Safari UI)
- Runs independently like a native app
- Persists login session
- Works offline if previously loaded
Android
- Open Chrome or Edge
- Navigate to
https://your-app-url.com - Tap the menu (3 vertical dots)
- Select “Install app” or “Add to Home screen”
- Confirm installation
- Chrome may show an automatic “Add Routine Optimizer to Home screen” banner
- Tap “Install”
- Launches in fullscreen (no browser UI)
- Can be found in app drawer
- Managed like a native app (can uninstall from settings)
Desktop (Windows/macOS/Linux)
Chrome/Edge:- Visit the app in Chrome/Edge
- Click the install icon in the address bar (right side)
- Click “Install”
- Installs as a desktop app
- Appears in Start Menu / Applications
- Opens in its own window (not a browser tab)
- Can be pinned to taskbar/dock
Offline Capabilities
What Works Offline?
✅ Fully Functional:- View dashboard
- Browse tasks, calendar, goals
- Complete tasks
- Run Pomodoro timer
- Access previously loaded routines
- Switch themes and languages
- Create/edit tasks (saves locally, syncs when online)
- Chat with AI Coach (requires network, will show “offline” error)
- Initial login (auth)
- Fetching new data from Supabase
- AI Coach responses
- Profile updates
Offline Data Persistence
Estudio Three uses Zustand persist middleware to save critical state tolocalStorage:
useAppStore→ User profile, routine blocksuseSettingsStore→ Theme, language, Pomodoro durationsusePomodoroStore→ Timer stateuseZenMode→ Focus mode preferences
Cache Management
Cache Naming
Workbox creates separate caches:workbox-precache-v2→ Static assets (HTML, JS, CSS)google-fonts-cache→ Google Fonts stylesheetsgstatic-fonts-cache→ Font files (.woff2)workbox-runtime-http→ API responses
Cache Expiration
- maxEntries: Limits cache size (deletes oldest entries first)
- maxAgeSeconds: Deletes entries older than 1 year
Clearing Cache
Users can manually clear PWA cache: Chrome/Edge (Desktop):F12→ Application tab → Storage → Clear Site Data
- Settings → Apps → Routine Optimizer → Storage → Clear Cache
- Settings → Safari → Advanced → Website Data → Remove Routine Optimizer
Automatic Updates
Update Flow
Skip Waiting
By default, new Service Workers wait for all tabs to close before activating. Estudio Three usesautoUpdate to skip this:
- New version activates immediately in background
- User sees update on next page load
- No need to close all tabs
Performance Metrics
Lighthouse PWA Audit
Estudio Three PWA Score: 100/100 ✅ Passed Audits:- Registers a service worker that controls page and start_url
- Web app manifest meets installability requirements
- Configured for a custom splash screen
- Sets a theme color for the address bar
- Content is sized correctly for the viewport
- Has a
<meta name="viewport">tag withwidthorinitial-scale - Provides a valid
apple-touch-icon - Configured for a custom offline page (via cache)
Load Times
| Scenario | Time |
|---|---|
| First Visit (cold cache) | 2.1s |
| Repeat Visit (cached) | 0.8s |
| Offline Launch | 0.6s |
PWA Best Practices
Icon Sizes
Provide multiple icon sizes for different devices:Apple-Specific Meta Tags
Add toindex.html for better iOS support:
Viewport Meta Tag
Debugging PWA Issues
Chrome DevTools
Application Tab:F12→ Application- Manifest: View parsed manifest, check for errors
- Service Workers: See registration status, update, unregister
- Cache Storage: Inspect cached assets
- Storage: View localStorage/IndexedDB
Service worker registration failed: Check HTTPS requirement (localhost is exempt)Manifest failed to load: Check file path and CORS headersIcons not found: Verify icon paths inmanifest
Testing Offline Mode
Chrome DevTools:F12→ Network tab- Change throttling dropdown to “Offline”
- Reload page
iOS Safari Debugging
-
Enable Web Inspector:
- iOS: Settings → Safari → Advanced → Web Inspector
- macOS: Safari → Develop → [Your iPhone] → Routine Optimizer
-
Check Console for Errors:
- Look for manifest parsing errors
- Verify icon loading
Future Enhancements
Push Notifications
Background Sync
Queue failed API requests and retry when back online:Periodic Background Sync
Fetch new data in background (requires user permission):Troubleshooting
App Not Installing on iOS
Symptoms: “Add to Home Screen” option missing Solutions:- Must use Safari (not Chrome)
- Manifest must be valid (check DevTools)
- HTTPS required (or localhost for dev)
- Check for console errors in Safari Web Inspector
Updates Not Appearing
Symptoms: New version deployed but users see old app Solutions:- Wait 24 hours (Service Worker update interval)
- Force update: Unregister SW in DevTools → Hard refresh
- Check
registerType: 'autoUpdate'is enabled - Verify new build has different file hashes
Offline Mode Not Working
Symptoms: White screen when offline Solutions:- Ensure user visited app while online at least once
- Check Service Worker registration succeeded
- Verify
workbox.globPatternsincludes necessary assets - Test with DevTools offline mode