Data Layer medium complexity mobile
0
Dependencies
0
Dependents
2
Entities
0
Integrations

Description

Provides the encrypted local SQLite store that holds all offline copies of features, contacts, and activity records. It wraps SQLCipher to enforce at-rest encryption and exposes a typed repository interface used by both the outbox service and the rest of the application layer.

Feature: Offline Data Support

offline-drift-database

Sources & reasoning

Lines 302-303 explicitly define the offline-first architecture including SQLCipher, mutation outbox, conflict resolver, and optimistic mutations. The mobile app architecture section lists this as a core shared capability with no toggle, confirming MVP scope. The blueprint assigns this feature [MVP], consistent with Phase 1 foundational requirements.

  • Offline-first persistence (Drift + SQLCipher encrypted local DB, mutation outbox, sync queue with retry/backoff, ID mapping for offline-created entities, conflict resolver)
  • Optimistic mutations with automatic rollback on failure (contact edits and paginated list updates)

Responsibilities

  • Initialise and migrate the local SQLite schema on first launch and on version upgrades
  • Expose typed CRUD repositories for contacts, activities, and outbox entries
  • Coordinate read and write transactions to prevent partial state during sync replays
  • Store and retrieve serialised entity snapshots used for conflict detection
  • Provide a query interface for filtering and paginating offline records without network access

Interfaces

open(key: string): Promise<void>
getRepository<T>(entity: string): Repository<T>
runTransaction(fn: (tx: Transaction) => Promise<void>): Promise<void>
close(): Promise<void>
migrateToVersion(version: number): Promise<void>

Related Data Entities (2)

Data entities managed by this component