Skip to content
API Credits + Cash

Immortal

Bryan Johnson spends 3 million dollars a year to stay alive forever. Not everyone has 3 million dollars. Download Immortal.

Core trick

Computes z-score anomalies on HealthKit HRV and resting heart rate against 7, 30, and 90-day baselines, then tracks pre and post effect sizes for self-experiments.

Tags

Built with

applewatchexpo.ioreactnative

Description

Inspiration We were frustrated that wearables collect mountains of health data but do almost nothing useful with it. Your Apple Watch knows your HRV dropped 20% this week — but it won't tell you why , won't suggest what to change, and definitely won't help you run a self-experiment to figure it out. We wanted to build the "operating system" for personal longevity: something that actually closes the loop between data collection, pattern detection, and actionable behavior change — all grounded in peer-reviewed science, not vibes. What it does Immortal is a closed-loop personal health intelligence system. It syncs wearable data from Apple HealthKit (HRV, sleep, resting heart rate, steps, workouts), learns your individual baselines over 7/30/90-day windows, and detects anomalies using z-score analysis. When it spots something — like a sustained HRV dip or creeping resting heart rate — it generates evidence-based recommendations ranked by confidence, with citations to the underlying research. The standout feature is self-experiments : you can propose hypotheses (e.g., "does cutting caffeine after 2pm improve my HRV?"), and the system automatically tracks pre/post metrics, computes effect sizes, and evaluates whether the intervention actually worked. An adaptive check-in system asks different questions based on what anomalies are detected — no generic surveys. An LLM-powered coach (Gemini 2.5 Flash) synthesizes all of this into personalized, conversational guidance. How we built it Backend: FastAPI + SQLAlchemy with a modular intelligence engine — seven distinct modules handling baselines, daily state aggregation, pattern detection, recommendations, adaptive check-ins, experiments, and insights. Every clinical threshold is documented with peer-reviewed citations in our EVIDENCE.md file. Mobile: Expo 54 + React Native with TypeScript, using React Query for server state, Zustand for local state, and a custom HealthKit integration via @kingstinct/react-native-healthkit for native iOS data access with anchored incremental sync. AI Layer: Hybrid approach — deterministic rule engines handle pattern detection and anomaly scoring, while an LLM coach provides nuanced contextual guidance. The rules ensure reliability; the LLM adds personalization. Data: SQLite for dev with a Postgres/TimescaleDB-ready schema (single env var flip). Time-series hypertable support built in for production scale. Challenges we ran into HealthKit rate limits and complexity. Apple's HealthKit API is powerful but unforgiving — anchored queries, background delivery permissions, and entitlement signing all had to work perfectly on a real device. Simulator testing only gets you so far; we had to set up EAS Build for actual iOS testing. Balancing rules vs. LLM. We wanted recommendations to be scientifically grounded, not hallucinated. Getting the hybrid architecture right — where deterministic engines provide the facts and the LLM just synthesizes them — took several iterations. We switched from Claude to Gemini 2.5 Flash mid-project for the coach layer after evaluating latency and cost tradeoffs. Baseline cold-start. The system needs historical data to compute meaningful baselines. We built a 30-day synthetic seed script to demo the full pipeline, but designing graceful degradation for new users with sparse data was tricky. Accomplishments that we're proud of Evidence-first engineering. Every threshold in the system maps to a cited paper. We wrote EVIDENCE.md as a living document with quarterly review cadence — this isn't a "trust me bro" health app. Self-experiments actually work. Users can propose, run, and auto-evaluate personal health experiments with real effect-size computation. We haven't seen this in consumer health apps. The adaptive check-in system. Questions change based on detected patterns — if you're showing signs of overreaching, it asks about training load and recovery, not generic mood questions. Clean modular engine. Seven independent intelligence modules that compose through a single assembler. Each one is testable and replaceable in isolation. What we learned Health data is deeply personal and noisy. Population norms are nearly useless — individual baselines are everything. Hybrid AI architectures (rules + LLM) are underrated. Rules give you reliability and auditability; LLMs give you natural language and personalization. You need both. Building for iOS wearable data is a whole different beast from web development. Entitlements, provisioning profiles, background delivery — the platform complexity is real. Evidence-based software engineering is worth the upfront cost. Documenting why every threshold exists made debugging and iteration dramatically faster. What's next for Immortal Multi-source integration: Fitbit and Oura Ring OAuth support to reach beyond the Apple ecosystem. Per-user correlation learning: Move beyond population-level rules to discover individual-specific patterns (e.g., "for you , alcohol correlates with a 15% HRV drop"). Causal inference on experiments: Upgrade from simple pre/post comparison to proper causal methods that account for confounders. Predictive trajectories: Forecast readiness scores 3-7 days out based on current trends and planned activities. Push notifications: Proactive alerts when the system detects emerging patterns, not just passive dashboard updates. Auto-experiment proposals: System suggests experiments based on detected patterns, closing the loop entirely.

Team