๐
Technical Overview
How Pill Tracker is built.
Pill Tracker (PillCam) is a local-first medication tracker for iOS and Android. It reminds you at each dose time and lets you record a short video of yourself taking each dose โ with adherence stats, streaks, missed-dose escalation reminders, and CSV/PDF export to share with a provider. There is no account and no server: everything stays on-device.
Stack at a glance
- Expo SDK 54
- React Native 0.81
- React 19
- TypeScript 5.9
- expo-router 6
- SQLite (expo-sqlite)
- Drizzle ORM
- TanStack Query
- Zustand
- Jest + jest-expo
- EAS builds
Local-first data layer
- SQLite + Drizzle ORM โ records live in an on-device database; migrations
are generated with
drizzle-kitand applied automatically on app launch. - FHIR-aligned model โ entities map to
MedicationRequest/MedicationAdministration/Media, so provider sync or EHR integration can be added later without a rewrite. - Repository interfaces โ all storage sits behind interfaces; UUID keys,
soft deletes, and
updated_ateverywhere keep the data model sync-ready. - Private media โ dose videos are written to app-private storage, never the camera roll, with automatic cleanup policies.
Scheduling engine
- Pure functions โ occurrence generation is a standalone engine, anchored to local wall-clock time and DST-safe (the Jest suite runs with a pinned timezone to prove it).
- Rolling materialization โ dose events are materialized over a rolling 14-day window and reconciled by a background task.
- Notification budgeting โ a planner keeps scheduled notifications under iOS's ~64 pending-notification cap; primary reminders within 48 hours always win over far-future escalations.
App layer
- expo-router โ file-based routes handle layout and navigation only;
logic lives in a separate
src/layer. - Camera capture โ short dose videos via
expo-camera, with generated thumbnails for the history timeline. - Provider exports โ adherence history exports as CSV or a printable PDF
(
expo-print+expo-sharing). - Quality gates โ Jest unit tests,
tsc --noEmittypechecking, and ESLint; device builds via EAS.