← Back to list

offline-first-pwa-patterns
by kjibba
⭐ 0🍴 0📅 Jan 25, 2026
SKILL.md
name: offline-first-pwa-patterns description: Strategies for building robust offline-first Progressive Web Apps for field technicians.
Offline-First PWA Patterns
Field technicians often work in locations with poor or no internet connectivity (basements, remote areas). This skill ensures Digital Befaring remains functional without a network.
Core Strategy
1. Persistent Storage (IndexedDB/WOP)
- Use IndexedDB for large data sets (customer lists, previous surveys).
- For Next.js/React, consider libraries like
Dexie.jsorZustandwith persistent middleware.
2. Service Workers (Next-PWA)
- Cache-first strategy: For static assets (icons, UI components).
- Stale-while-revalidate: For dynamic but non-critical data.
- Network-only (with fallback): For critical submissions.
Data Synchronization
The Outbox Pattern
- User saves a form while offline.
- Form is stored in local IndexedDB "Outbox".
- Service Worker listens for
onlineevent. - Background sync process pushes pending items to the API.
Conflict Resolution
- Last Write Wins (LWW): Simple, but risky.
- Version Tracking: Check
updatedAtbefore overwriting. - User Intervention: If a conflict occurs, mark status as "Conflict" and ask the technician to choose which version to keep.
UI/UX for Offline State
- Visual Indicators: Always show a subtle indicator when the app is offline.
- Status Badges: "Venter på nett" (Waiting for network) for pending uploads.
- Optimistic UI: Update local state immediately, then sync in background.
Next.js Implementation Note
- Use
next-pwaplugin innext.config.js. - Ensure
manifest.jsonand icons are correctly configured. - Handle "Add to Home Screen" (A2HS) prompts to make it feel like a native app.
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon