Contents
Expense Tracker is a personal-finance app that works entirely on the phone: no sign-up, no server. Finance data is sensitive, so "no server" can't mean "no security". This post walks through how the app keeps data private while staying fast and fully offline.
Offline-first, for real
The app is built on Expo and TypeScript, with SQLite for storage and Zustand for in-memory state. The rule I followed: every screen reads from and writes to SQLite first. There is no network call in the critical path, so the app behaves the same on a plane as it does on Wi-Fi.
Keep state thin
Zustand stores only what the current screen needs: the selected month, filters, and a cached summary. The database is the source of truth, and the store is rebuilt from it on launch. That keeps state bugs from turning into data bugs.
Choosing the cipher
I used AES-256-GCM for anything written outside the app sandbox, such as exports and backups, and for sensitive fields at rest.
- AES-256 is widely supported and hardware-accelerated on modern phones.
- GCM is an authenticated mode: it produces a tag that's checked on decrypt. If even one byte of the ciphertext changes, decryption fails instead of silently returning corrupted numbers.
A stored record looks like this:
{
"v": 1,
"nonce": "base64…",
"ciphertext": "base64…",
"tag": "base64…"
}The v field is a format version, so the scheme can change later without breaking old backups.
Where the key lives
The encryption key is generated on first launch and stored with the platform's secure storage: Keychain on iOS and the Keystore-backed store on Android, via Expo SecureStore. It never touches AsyncStorage, logs or exports.
Biometric lock
When biometric lock is on, reading the key requires Face ID, Touch ID or the Android fingerprint prompt. If the user cancels, the app shows a lock screen instead of falling back to a weaker PIN path.
Exports are the weak spot
Reports and backups leave the sandbox, which is exactly where data leaks happen: shared to the wrong chat, synced to a cloud drive. Encrypted backups use a key derived from a passphrase the user chooses, so they can be restored on a new phone without any account system.
Checklist
- SQLite as the source of truth, with UI state rebuilt from it.
- AES-256-GCM with a fresh nonce per write.
- Key in Keychain/Keystore, optionally behind biometrics.
- Versioned ciphertext format.
- Encrypted, passphrase-protected exports.
None of this needs a backend, which is the point: the most private server is the one you never run.
Found this useful? Share it with your team.