About the Project — Arterial IQ

Inspiration

Two years ago I had a serious cardiac wake-up call. I started tracking everything—HRV, resting HR, sleep, activity—but bouncing between WHOOP, Apple Health, Fitbit, and Oura made it hard to see patterns or take action. Arterial IQ is the tool I wish I’d had: one place that turns raw signals into simple, heart-smart decisions.

What it does

  • Unifies data from WHOOP, Apple Health via iOS bridge, Fitbit, and Oura into a single dashboard
  • Highlights trends in HRV, resting HR, sleep, and activity strain
  • Turns insights into action with short “do this next” suggestions for recovery, training, and sleep hygiene
  • Respects privacy with encrypted tokens and one-click disconnect

How I built it

  • Frontend: Next.js App Router with TypeScript, Tailwind for rapid UI
  • Backend: API routes for OAuth Authorization Code with PKCE for WHOOP, token refresh, sync jobs, and a WHOOP webhook receiver
  • Data model: normalized tables for sleep_sessions, recovery_scores, activity_daily, and biometrics
  • Providers

    • WHOOP v2 OAuth plus webhooks
    • Fitbit Web API OAuth plus backfill
    • Oura Cloud v2 OAuth plus backfill
    • Apple Health via a lightweight iOS companion app that pushes HealthKit data to the backend
  • Security: AES-GCM encryption for tokens, least-scope permissions, explicit revoke

The signal math with LaTeX

HRV RMSSD [ \mathrm{RMSSD}=\sqrt{\frac{1}{N-1}\sum_{i=1}^{N-1}(RR_{i+1}-RR_i)^2} ]

Z-score trend against a 30-day baseline [ z_t=\frac{x_t-\mu_{30}}{\sigma_{30}} ] A rising RHR z_t with a falling HRV z_t is a recovery red flag.

Sleep debt daily shortfall vs target T [ \mathrm{SleepDebt}_t=\max\bigl(0,;T-\text{sleep}_t\bigr),\quad T=7.5\ \text{hours} ]

EWMA smoothing to reduce noise [ \mathrm{EWMA}t=\alpha x_t+(1-\alpha)\mathrm{EWMA}{t-1},\ \ 0<\alpha\le 1 ]

Simple readiness proxy with normalized inputs [ R=w_1\tilde{\mathrm{HRV}}-w_2\tilde{\mathrm{RHR}}-w_3\tilde{\mathrm{SleepDebt}} ] Weights w_i are tuned from personal history and can be user-specific.

What I learned

  • Design for action, not dashboards
  • OAuth done right exact redirect_uri, PKCE, refresh hygiene prevents hours of debugging
  • Normalization matters across providers and time zones
  • Privacy is a feature users notice

Challenges I faced

  • Redirect_uri mismatches fixed by one canonical env per provider used in both authorize and token
  • Time zones and DST normalized all timestamps to UTC, display in local time at the edge
  • Rate limits and pagination handled with backoff and idempotent upserts
  • Apple Health on the web solved with an iOS bridge that reads HealthKit with consent and posts to the API
  • Merging semantics for activity load across providers

Why this matters to me

Arterial IQ began as a survival tool for clarity, not fear. It helps me notice early whispers rising RHR, dropping HRV, growing sleep debt and choose smarter recovery today, so I can protect my heart for years.

What’s next

  • Personalized weight tuning w_i via on-device learning
  • Coach and clinician export read-only summaries
  • More nudges that feel like a friend, not an alarm

Wellness disclaimer Arterial IQ provides wellness insights only and does not diagnose, treat, cure, or prevent disease. Always consult a qualified healthcare professional for medical advice.

Built With

  • built-with-**languages**-*-typescript
  • easy-revoke-**integrations-/-apis**-*-whoop-v2-api-+-webhooks-*-fitbit-web-api-*-oura-cloud-api-v2-*-apple-health-via-ios-healthkit-bridge-(companion-app-?-backend)-**platform-/-devops**-*-base44-(build/deploy-preview-host)-*-environment-based-config
  • idempotent
  • javascript-**frontend**-*-next.js-14-(app-router)
  • postgres-(prod)-**security**-*-aes-gcm-token-encryption-*-scoped-permissions
  • rate-limit-aware-fetchers
  • react-*-tailwind-css-(ui-styling)-**backend**-*-next.js-api-routes-(node)-*-oauth-2.0-(auth-code;-pkce-for-whoop)-*-webhooks-(whoop)-**data-&-storage**-*-prisma-orm-*-sqlite-(dev)
Share this project:

Updates