Developer Notes
Mobile & PWA — Developer Notes
This page collects developer-focused notes for working with CJH’s PWA and native mobile apps.
Tech stack & key libraries
- Frontend: Vite + React + TypeScript + Tailwind.
- UI: shadcn-ui components.
- PWA:
vite-plugin-pwais included for PWA support. - Offline storage: IndexedDB is used to maintain an offline queue for job updates, photos and other operations. :contentReference[oaicite:19]{index=19} :contentReference[oaicite:20]{index=20} :contentReference[oaicite:21]{index=21}
Capacitor & native plugins
- Capacitor is used for native features. Capacitor-related packages are included in
package.jsonand the repo uses@capacitor/*plugins such as@capacitor/camera,@capacitor/geolocation,@capacitor/push-notifications, and@capacitor/filesystem. Confirm plugin versions inpackage.jsonbefore adding platforms. :contentReference[oaicite:22]{index=22}
Live reload during native development
- Capacitor can be configured to use a Lovable or local preview URL for live reload. Typical flow:
- Run the web dev server (
npm run devor use the Lovable preview URL). - Configure Capacitor to point to the dev server.
- Sync:
npx cap sync. - Open the native project (
npx cap open iosor use Android Studio). The repo README has a short live-reload section and recommended steps for native development. :contentReference[oaicite:23]{index=23}
Offline queue & IndexedDB
- The client stores queued operations in IndexedDB so the app works offline and syncs on reconnect. Queued operations include photo uploads, job updates, payment records and client notes; the system reconciles and syncs automatically when connectivity returns. Testing in offline mode is essential to ensure conflicts and edge cases are handled properly. :contentReference[oaicite:24]{index=24}
Build & CI considerations
- Use
npm run buildto create the production site bundle. For native builds, runnpx cap syncand then build/submit from Xcode/Android Studio. When switching to a custom domain or production, update the Capacitor server URL and rebuild/sync. See README for the domain and deployment instructions. :contentReference[oaicite:25]{index=25}
Troubleshooting — common dev issues
- Plugin mismatch: If Capacitor plugins fail at runtime, confirm matching major versions across
@capacitor/core, platform packages and plugin packages. - Geolocation or Camera failures: Ensure native permissions are declared in
Info.plist/AndroidManifest.xmland that runtime permission requests are implemented. - PWA cache issues: When changing service worker behavior, clear site data or use an incognito window during iterative testing to avoid cached service-worker assets interfering with dev iterations.
Related articles: Mobile App Setup; PWA Install; Offline & Sync.
Updated on: 10/01/2026
Thank you!
