This article walks through the layered architecture of Talliofi, a local-first personal finance app where user data stays on-device by default with optional cloud sync.
•Layer 1 uses Dexie (IndexedDB wrapper) as the source of truth across 11 tables with versioned schema migrations and compound indexes for performance
•Layer 2 uses TanStack Query as an in-memory cache on top of IndexedDB, not a network layer, enabling deduplication and stale-time management without API calls
•Layer 3 introduces a repo router that returns either a Dexie or Supabase implementation based on the user's chosen storage mode: local, cloud, or encrypted
•Layer 4 implements a changelog-based sync engine that pushes only new entries since the last watermark, using last-writer-wins conflict resolution
•
Layer 5 adds client-side AES-256-GCM encryption using the native Web Crypto API with PBKDF2 key derivation, so Supabase stores only opaque ciphertext
This summary was automatically generated by AI based on the original article and may not be fully accurate.