Catalog ›Personal life ›Wellbeing
Food Diary & Calorie Counter — with private history
Keeping a food diary is the first step to really understanding your eating habits, but the most popular calorie-counting apps require an account and sync everything to a server. Here every meal stays saved **only on your device**: log what you ate meal by meal and the app works out each day's calorie total on its own.
What it records
- Meal...
- What you ate, e.g. Tomato pasta
- Calories (kcal)
How it works
This is a Reactive app: a plain text document that your browser turns into a working app — forms, live data, tables, statistics and even charts, with nothing to install or configure.
- Use it right away. Hit “Use this app”: it opens right in your browser, ready to go, with data saved only on your device.
- Your data stays yours. Everything is stored locally on your device, kept separate for each app: no account, no server, nothing to set up.
- Make it your own. The text below is the entire app: copy it, tweak fields, views and words, and your changes become interactive instantly.
- Share it as a file. An app is a simple file: save it, export it or share it with a link; and with encrypted collaboration several people edit the same data in real time.
The app’s source
# 🍽️ Food Diary & Calorie Counter
Keeping a food diary is the first step to really understanding your eating
habits, but the most popular calorie-counting apps require an account and
sync everything to a server. Here every meal stays saved **only on your
device**: log what you ate meal by meal and the app works out each day's
calorie total on its own.
::::form{path="meals" id="fpa"}
::input{form="fpa" field="date" type="date" legend="Date"}
:::select{form="fpa" field="meal" placeholder="Meal..." required="true"}
- Breakfast
- Lunch
- Dinner
- Snack
:::
::input{form="fpa" field="food" placeholder="What you ate, e.g. Tomato pasta" required="true"}
::input{form="fpa" field="calories" type="number" placeholder="Calories (kcal)" required="true"}
::add-form{form="fpa" path="meals" label="Log meal"}
::::
## Meal history
:::table{path="meals" headers="Date,Meal,Food,Calories" deletable="true" editform="fpa"}
{date} | {meal} | {food} | {calories}
:::
## Daily calorie total
:::python{data="meals"}
```
rows = data["meals"]
totals = {}
for r in rows:
d = r.get("date")
cal = r.get("calories")
if d and cal:
totals[d] = totals.get(d, 0) + float(cal)
if totals:
for d in sorted(totals):
print(f"{d}: {totals[d]:.0f} kcal")
else:
print("Log at least one meal to see each day's calorie total.")
```
:::
Keep the diary going for a few weeks to get a real picture of your habits:
the app doesn't judge portion sizes, that's on you — it just gives you the
numbers, in order, and they never leave your phone.