[All writing](/work?type=writing)

# Putting my Apple Health data in one place

I brought my nutrition and activity data out of Apple Health and into Postgres, so I could compare the daily and weekly trends.

20 January 2026 · 1 min read

[Data pipelines](/tags/data-pipelines) [AI](/tags/ai) [Architecture](/tags/architecture)

![The HealthAgent status view: daily trends and projections built from Apple Health exports.](https://cdn.sanity.io/images/qnuj1c4o/production/365882c62fb0fc9e80ce5527094863cf43b3d6c1-2446x1394.png?w=1800\&q=80\&auto=format)

I was tracking nutrition in MacroFactor and workouts, heart rate and activity on my Apple Watch. I could see each set of stats separately, though I wanted to compare them and work out which signals actually mattered to me. That became HealthAgent.

## Why I built it

Macrofactor automatically writes nutrition data to Apple Health, and Watch workouts go there too, which made it the natural hub. I set up a daily export to my own service using Health Auto Export, an iOS app that can POST selected data to a REST API.

## What it does

HealthAgent keeps the raw Health Auto Export JSON locally in development or in GCS in production, then normalises it into Postgres and rolls it up into daily metrics for the Next.js UI. There’s an optional weekly insights pass behind `INSIGHTS_ENABLED`. GitHub sign-in uses NextAuth, with an ingest token for each user and data scoped to their account.

## What I'm working on now

With everything normalised in the database, the next step is asking an LLM to surface correlations automatically: "Your sleep was down this week and sugar was up," or "Training volume increased while recovery dipped." Finding those patterns without having to go looking for them is the focus of the current iteration. I use Neon for the database since it's cheap and doesn't need to be always on.

## Infrastructure

Cloud Build runs Prisma migrations, builds and pushes the Fastify API Docker image, and deploys to Cloud Run. Secrets live in Secret Manager, raw files in a GCS bucket. Cloud Scheduler triggers `/api/pipeline/run` daily with `X-PIPELINE-TOKEN` and `X-USER-ID`. The frontend is on Vercel.

The code is on [GitHub](https://github.com/Slaymish/HealthAgent). If you try it and find a bug, open an issue.

## Related

- [Article · 2026 Splitting GPUShare into two services](/posts/splitting-the-stack-and-making-setup-actually-work)
- [Article · 2026 Sharing my GPU with friends](/posts/building-a-private-ai-server-for-friends)
- [Report · 2025 Home Lab Architectural Study](/reports/home-lab-architectural-study)
