Skip to content

P-02 / HALFLIFE

Half-Life

What remains?

Local-first iOS app that helps make sense of the relationship between caffeine intake and sleep — built on Expo and React Native, reading Apple HealthKit data and modelling caffeine as first-order exponential decay.

Status
Release candidate — 1.0.4 (6)
Domain
Health / kinetics
Stack
Expo / React Native / HealthKit / Supabase

Decay, drawn.

A(t) = 200·e−0.693t/5

First-order decay — the mechanic the whole app is built on. Illustrative model (caffeine, 200mg dose, t½ = 5h), not a measurement — drag the control below to move through time.

T+2.0h152mg remaining (76%)
[P-02]HALFLIFE
LIVE SYSTEM

Technical record

Half-Life is a local-first iOS app built with Expo and React Native that helps make sense of caffeine intake against sleep timing, modelled as first-order decay: A(t) = A₀ · e^(−0.693t / t½).

HealthKit access is user-triggered and only feeds suggestions — it never silently overwrites a manually-set sleep or wake time, and raw sleep samples are never persisted or synced to the cloud. Supabase is optional account/sync only; the core logging flow works fully local-first.

The architecture deliberately runs on the stable React Native core — Skia, Reanimated, and Worklets were removed after they proved to be a recurring source of build fragility, and stability now takes priority over animation ceiling. The decay model itself is exposed through a Python service, and the simulator below calls that live endpoint. A signed 1.0.4 (6) release archive is built and locally exported; device acceptance and TestFlight remain open.

TECH STACK

ExpoReact NativeHealthKitSupabaseTypeScriptPythonFastAPI

SYSTEM SPECS

PLATFORMiOS — Expo / React Native
HEALTH DATAApple HealthKit
BACKENDSupabase
MODELA(t) = A₀ · e^(−λt)
ARCH CHOICEStable core — no Skia/Reanimated
DECAY APIPython · live endpoint
BUILD1.0.4 (6) — signed archive exported

SYSTEM ARCHITECTURE

HALF-LIFE — DECAY ENGINE
01
HEALTHKIT INGESTIONNative iOS permissions · workout, sleep, and vitals reads
02
SUPABASE SYNCPersistence and cross-session state
03
SUBSTANCE CONFIGt½ per compound · dosage · unit-of-measure
04
HALF-LIFE KINETICSA(t) = A₀ · e^(−0.693t / t½) — first-order decay
05
DOSE SCHEDULERMulti-dose accumulation · replenishment timing
06
DECAY APIPython / FastAPI — /api/decay · powers the simulator below
07
VISUALIZERConcentration curve · peak and trough markers

DECAY SIMULATOR — LIVE ENDPOINT

The curve higher up the page is drawn from fixed numbers to show the mechanic. This one posts to the Python service and plots the response — the same /api/decay the app calls.

IOS ·REACT NATIVE ·EXPO ·HEALTHKIT ·SUPABASE ·PHARMACOKINETICS ·HALF LIFE MODELING