Optimal: a fitness app that adjusts your calories from your own data

Optimal estimates what you really burn from your own food logs and weight trend, then suggests a new calorie target at a weekly check-in. I designed the engine and validated it in a simulator.

Where it stands: still in build. It runs on my iPhone and in the browser with demo data. It isn't in any app store and has no real users, so I can't say yet whether it actually keeps people going.

The calorie engine

The engine works over a rolling 21-day window of food logs and weight trend. It starts from a standard formula (Mifflin-St Jeor) and trusts your data more as it builds up.

Burn is measured in your own logged calories, so consistent under-logging cancels out.

Weekly check-in screen. A line shows what you burned over two weeks, with one mark per day for what you ate, above a row of day coins. You ate 2,158 kcal a day and burned 2,506, measured. The suggested change is −150, from 2,300 to 2,150.
The weekly check-in: 2,158 a day eaten, 2,506 burned (measured), target suggested from 2,300 to 2,150. Demo data.
Progress screen with daily weigh-ins as dots and a smoothed trend line running through them.
Daily weigh-ins as dots, with the smoothed trend line. Demo data.

Testing the math when you don't have users

With no real users, the hard part was knowing if the estimate was any good. So I tested it in a simulator: 300 virtual people per scenario, each with a known true burn and 100 days of messy data. That includes scale noise, water swings, missed days, a holiday and under-logging.

The simulator's settings were locked before I tuned the engine, so I couldn't adjust the test to fit the result. The comparison is the standard formula (Mifflin-St Jeor), even updated with each person's true weight every day.

Median error at day 60, in kcal per day. Lower is better.
Scenario Optimal Standard formula
Base population106392
Noisy scale and big water swings144392
Heavy, inconsistent under-logging221698

It isn't magic. At day 100, the estimate had settled within 100 kcal for 74% of the base group and only 36% of the heavy under-loggers. The simulator proves the math, not the product. Only real people can show whether the app works.

The engine and the rest of the app logic are covered by 228 automated tests, all passing.

Also in the app: the Reality Check

When the scale jumps, say +2.4 lb after a good week, Optimal works out the most fat you could have gained from what you ate. It adds a 500 kcal cushion in case you under-logged. In that example, the answer is 0.27 lb at most. Then it uses your own logs to explain the rest: extra carbs, sodium, a hard workout or a late dinner.

It also knows when not to reassure you. The strong "that's not fat" message only appears for jumps of 1.5 lb or more. It won't appear for a reading the trend doesn't believe, or when the scale has been climbing all week. A 15 lb overnight "jump" gets questioned as a likely typo.

Rules the app won't break

Health numbers can hurt people, so some limits are built into the app.

Where it came from

I've always been into lifting and the science behind it. My first version was a Python desktop app in 2024 that I built to track my own calories, macros, steps and sleep. This version uses React Native, Expo and TypeScript.

What's next

A test with real people. The pass and fail targets are written down before launch, so I can't move them after I see the results.

The code is in a private repository. Email me if you'd like to see it.