2026-08-10
Haj — local-first encrypted HRT adherence
Privacy-first medication adherence app—Expo prototype then Flutter rewrite—with on-device crypto, BIP39 recovery, threat-aware UX, and CI gated at 60% diff coverage.
Problem
Someone close to me was missing estrogen doses. The need was practical: schedules, reminders, and dose history that actually get used—and that treat HRT data as sensitive, not as something that should live in a convenience cloud by default.
Haj is the portfolio/academic response to that constraint: a local-first adherence app for HRT regimens, built to demonstrate mobile architecture and on-device security. It is not a medical product and must not be used to manage real treatment.
Constraints
- Adherence is the product — missed doses are the failure mode; reminders and logging have to survive timezone changes and Android reboots.
- Local-first, encrypted — health data stays on device; keys derived from a user PIN (optional biometrics); recovery via BIP39—not “trust the server.”
- Threat-aware privacy — shared phones and coercive environments are in scope: discrete UI/notifications, panic exit, failed-PIN wipe.
- Portfolio honesty — demonstrate real crypto and UX patterns without claiming clinical safety or encouraging medical use.
- Two stacks — prove the idea in Expo/React Native, then harden and rewrite in Flutter without losing user ciphertext.
What I built
v1 — Expo / React Native — Shipped a full app surface (~23 screens): medications, dose logging, supply tracking, timezone-aware push reminders, notes, and the first security layer (encrypted local store, PIN + biometric unlock, BIP39 recovery, discrete/quick-exit/self-destruct patterns). Optional Firebase only ever held an encrypted backup blob, never plaintext health records. On-device ML Kit OCR kept prescription imagery off the network.
v2 — Flutter rewrite — Rebuilt as a native Flutter app (~20 routes) on a layered features / domain / data / core architecture. Hardened crypto to AES-GCM with PBKDF2 (600k iterations); PIN-derived key wrapping, biometric unlock, encrypted export/import. Migrated v1 → v2 with zero data loss.
Domain features — Multi-medication schedules, dose log, supply tracking; Android boot-aware reminder rescheduling; insights (adherence %, streaks, heatmaps, blood-level charts, lab scheduling, level-to-dose correlation).
Threat-aware UX — Discrete mode, gyroscope panic exit, self-destruct after failed PIN attempts.
Quality bar — ~80 test files / ~300 cases; CI/CD with a 60% diff-coverage gate and automated Android/iOS builds.
Result
Haj shows what “privacy-first adherence” looks like as engineering: two full mobile stacks, real on-device cryptography and recovery, safety UX for hostile environments, and a test/CI bar that treats health-adjacent data like it matters. The origin was personal; the delivery is a systems and security portfolio piece—not a clinic.
Disclaimer: Haj is for demonstration only. Do not use it to track or manage real medical treatments. Always consult a qualified clinician for care decisions.