# Device-first archive, account optional

The repository's architectural decision, rationale and consequences.

# Device-first archive, account optional

The Athlete's Archive (Belt Ranks, Stripes, Results, Trips, Breaks) lives in an encrypted SQLite database on the phone (`expo-sqlite` built with SQLCipher, key in `expo-secure-store`). The mobile app opens, onboards and shows the timeline without a User or network; Better Auth is used only for the optional backup and the web dashboard. This reverses the template's signed-in-first mobile shell.

Chosen over server-first (Neon as system of record) because athletes use the app at venues without signal, because the product promise is that the Archive belongs to them (product ADR-01, RNF02) and because health-adjacent data (Breaks, weight) must never reach a server.

## Consequences [#consequences]

- The mobile root layout no longer guards the tabs with `Stack.Protected` on a session.
- Sync (S7) is push/pull of changes from the device; conflicts are resolved on the device.

