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.
- Weekly check-ins start after 14 days of data.
- If fewer than 10 of the last 14 days have food logged, it changes nothing.
- A change is at most 150 kcal per check-in, never goes below a safe calorie floor, and only happens if you accept it.
Burn is measured in your own logged calories, so consistent under-logging cancels out.
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.
| Scenario | Optimal | Standard formula |
|---|---|---|
| Base population | 106 | 392 |
| Noisy scale and big water swings | 144 | 392 |
| Heavy, inconsistent under-logging | 221 | 698 |
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.
- Calorie targets never go below a safe floor: 1,200 kcal for women and 1,500 for men.
- A target never changes on its own. The app suggests a change, shows the math and waits for your yes.
- Screening comes before any test with real users. Answering yes to the eating-disorder question turns off calorie targets, weigh-in prompts and all fat math.
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.