← スキル一覧に戻る

sync
by bentefay
A web app to help you understand where your money is going.
⭐ 2🍴 0📅 2026年1月10日
SKILL.md
name: sync description: Real-time sync with Supabase, Loro CRDT, and IndexedDB. Use when working on files in src/lib/sync/.
Sync Guidelines
Core Principles
- Server is source of truth - IndexedDB is a cache
- All ops kept forever - no pruning, enables full audit trail
- Shallow snapshots for fast start - performance only, not compaction
- Encryption at rest - server sees encrypted blobs + plaintext version metadata
Persistence Flow
| Event | IndexedDB | Server |
|---|---|---|
| Local change | Immediate | Throttled (~2s) |
| Tab hidden/close | Immediate | Flush pending |
| Cold start | Load snapshot → usable | Background sync |
Critical Rules
- IndexedDB writes immediate - crash safety
- Server pushes throttled - use
lodash-esthrottle, ~2s - Encrypt before storage - never plaintext in IndexedDB or server
- Version vector plaintext - enables server filtering without decryption
has_unpushedflag critical - server must send ops (not snapshot) if client has local changes- Flush on visibility change - don't lose data on tab switch
Key Details
- loro-mirror auto-commits on
setState()- no manual debouncing subscribeLocalUpdatesfires after each commit with binary update- Snapshot refresh: ops > 1000 OR bytes > 1MB (not time-based)
Conflict Resolution
Loro handles automatically: last-write-wins per field, set union for arrays.
UI States
- Saved - all pushed
- Saving... - pending in buffer
- Offline - can't reach server
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓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
レビュー
💬
レビュー機能は近日公開予定です