Project at a glance
| Role | Design and engineering, solo. I use it every day. |
| Scope | One page with 14 views; 74 database tables; 1,012 tests in 98 files; 9 runtime dependencies and no chart library; 145 commits in seven weeks |
| Stack | TypeScript, Next.js, React, Postgres, object storage, hand-drawn SVG charts |
| Status | In daily use, and private: it holds real health records and nobody else can open it. Every screen on this page shows invented data for a made-up person, drawn by the app's real components. |
Why I built it
Health data ends up scattered across a scale app, a food log, a watch and a training notebook, and none of them can answer a question that crosses two of the others. I wanted one private ledger that I own, quick enough to use on a phone every day, and open to an AI assistant only within tight limits.
What it does
Runs the day from one screen
Today holds the day's standard as a short checklist, the energy left against the target, the meals, the training session and the day's activity. Logging a meal or a weigh-in takes a few taps, and an AI assistant on the phone can log a meal for me.
Three parts of the Today view: the day's checklist, energy and macros against the target, and the meal log. The real app is private, so every figure on these screens is invented.
Reads nutrition as a pattern
The Nutrition view averages over the days that were logged and says so: a day without a food log is left out, never counted as zero. It also estimates maintenance from logged food and the scale trend, and gives that estimate as a range.
The Nutrition view on invented data: a 30-day summary, daily calories against the target, and the macro split above a logging calendar.
Follows training and weight as trends
Each lift has its own history, with an estimated one-repetition maximum and a mark on every session that beat the previous best. Scale weight is drawn with a seven-entry average, and its weekly rate is set against the pace planned for the current phase.
Training and body trends on invented data: one lift's estimated one-repetition maximum with its personal records, and scale weight against its seven-entry average.
The app's other views are not shown here.
How it is built
The rest of this page is for the engineer who wants the detail. Because the app is private, it stays at the level of design.
Architecture
MyHealth is one Next.js application over Postgres, with object storage for photos. There are two ways in. My browser reaches the web app once I have signed in. An AI assistant on my phone reaches a separate, smaller interface that lets it do a few named things.
Architecture: on the phone, a browser and an AI assistant fed by Apple Health. The browser reaches the web app; the assistant reaches a separate API with a few named permissions. Both write to one store of Postgres and object storage, and schema changes are rehearsed before release.
How a day's data moves:
- The server reads the day's snapshot and sends it with the page, so the first view paints without a second request.
- Each view is its own chunk of code. The phone downloads the workout logger only when Training opens.
- A write carries a key for that attempt. A retry reuses the key, so a flaky connection cannot save a meal twice.
- Every record carries a revision. An edit made from an old copy is refused with a plain message, so two devices cannot silently overwrite each other.
- A correction keeps what the record said before and after.
One page, fourteen views
Apart from sign-in, the whole app is one route. The view, the date and the tab live in the query string and change through the browser's History API, with no round trip to the server. The sign-in check therefore guards a single path, and a test pins the list of routes so that a second one cannot be added by accident.
An assistant with narrow permissions
The assistant does not use the web app. It has its own interface, and every call names the permission it needs: logging food and importing the day's Apple Health data are two of them. A call outside the assistant's permissions is refused. Foods logged with low confidence are flagged on the Today screen for review.
An interface built by hand
There is no chart library, icon package or component kit. A small chart kit draws SVG at the pixel width the browser measures, so strokes and text never scale. Colour comes from one set of design tokens, used for light and dark themes alike. The app has nine runtime dependencies.
Tone is tested too. Tests read the copy on the body-tracking screens and fail on words such as "overdue", "missed" and "should".
Numbers that say how they were made
- Averages count logged days only. An unlogged day is excluded and the screen says how many were.
- The weight line joins real weigh-ins. Days without one are not filled in or estimated.
- Today's activity is provisional. A day is marked provisional until it is closed out, with the time its data was last read.
- Estimates come as ranges. The maintenance estimate shows a likely range and the inputs it was worked from.
- "Today" is one calendar date. It is fixed to a single time zone and rolls over while the app stays open.
Releases
Schema changes are additive, in 19 numbered steps so far. Each can be rehearsed first: the pending steps run inside one transaction, which is then rolled back. Development uses its own database and its own photo store, and says so in a banner on every page. A hook runs lint, type checks and the tests before every push.
Testing
There are 1,012 tests in 98 files. Views are rendered on the server with their data handed in, so a test reads what a person would read. Contract tests pin the schema and the interface rules. Further suites, off by default, run against a real database and over HTTP.
Limits and what is next
MyHealth is built for one person, and nothing in it is multi-user. The screens on this page are stand-ins, because the real ones cannot be shown.
What the project demonstrates
MyHealth shows how I build something I depend on every day: a small, tested core, numbers that say how they were worked out, and an AI assistant allowed to do a few named things and nothing else.
