capacitor-offline-first
Guide to building offline-first Capacitor apps with data synchronization, caching strategies, and conflict resolution. Covers Fast SQL, service workers, and network detection. Use this skill when users need their app to work without internet.
By cap-go · 896 installs
npx skills add cap-go/capgo-skills --skill capacitor-offline-first
Source repository · Upstream listing
Offline First Capacitor Apps
Build apps that work seamlessly with or without internet connectivity.
When to Use This Skill
User needs offline support
User asks about data sync
User wants caching
User needs local database
User has connectivity issues
Offline First Architecture
Network Detection
Using Capacitor Network Plugin
Network Aware Service
Local Database with Fast SQL
Installation
Before using Fast SQL in production, complete the required platform setup:
iOS: allow localhost networking for the plugin transport.
Android: add the localhost cleartext exception required by the plugin.
Web: install sql.js if the app needs the web fallback.
Use the dedicated sqlite to fast sql skill when you need the full platform checklist.
Database Setup
Offline Data Repository
Sync Manager
Service Worker Caching
Register Service Worker
Service Worker with Workbox
Optimistic UI Updates
Queue Failed Requests
Best Practices
1. Show Sync Status
2. Handle Conflicts Gracefully
3. Validate Before Sync
Resources
Capacitor Network: https://capacitorjs.com/docs/apis/network
Workbox: https://developer.chrome.com/docs/workbox
IndexedDB: https://developer.mozilla.org/docs/Web/API/IndexedDB API
Offline First Manifesto: http://offlinefirst.org