r/coolgithubprojects • u/DealerEnough7389 • 3d ago
I built a free, self-hosted alternative to MyFitnessPal & MacroFactor: openCalory
I built this for myself because I wanted a fast nutrition tracker without subscriptions, account lock-in, or sluggish network requests every time I log a meal. Figured I'd clean it up, MIT-license it, and share it here in case anyone else wants to self-host it or contribute.
How it's built:
- Offline-first: Reads and writes hit browser IndexedDB (Dexie.js) locally so logging feels instant, even with zero connection.
- Optional self-hosted sync: Runs on SQLite locally (docker compose up -d) or Turso libSQL if deployed serverlessly, using 90-day tombstones for conflict-safe deletes across devices.
- BYOK AI (optional): Hooks into any OpenAI-compatible vision endpoint (OpenRouter, Gemini, OpenAI, or local Ollama) for meal photo estimation and nutrition label OCR, with sliders to adjust gram weights before saving.
- Adaptive TDEE & no-nonsense UI: Calculates weight trend smoothing and estimated adaptive TDEE without turning everything angry red when you go slightly over your calories.
- Bundled food data: Includes ~2,500 offline whole-food staples alongside live USDA/Open Food Facts search, browser barcode scanning, and full JSON/CSV export.
Repo: https://github.com/NathanP278/openCalory
It's still evolving, so if you self-host it and run into edge cases or want to help improve the sync engine, regional food datasets, or UI, issues and PRs are super welcome!
228
Upvotes
14
u/Fine_League311 2d ago
Devlopers & Fitness? Thats good, no time for it 😂
5
u/Ok_Carry_8711 2d ago
Thank you! I need to remember to try to get this to work when I'm not busy.
3
u/ericthahalfabee 2d ago
Does the barcode scanning access some network of calorie and nutrition data?
I always assumed the reason to be paying for a big networked fitness app (at least now that vibe coding exists) is to access the network of food data.
2
u/green_stone 2d ago
This is awesome, thanks for building this! I just deployed it and I'm using it now.
Curious why you left out the weight goal feature of MacroFactor? Right now you can pick the calorie deficit rate, but there's no way to set a target weight. For beginners, it's hard to know what deficit to pick, most of us naturally think in terms of how many kg/lbs we want to lose, not how many calories.
2
u/CleverDaddy24 1d ago
Hi! I Like it! Been thinking to make my own, but probably it's better fork yours and make some adjustment. Thank's!
1
u/thebig_lebowskii 1d ago
Just ripped the entire UI element from MacroFactor, did not even try doing something different. GG
3
u/AmuRAA 2d ago
could someone compare this to sparkyfitness?
1
u/ExaminationSerious67 1d ago
Looks interesting. I might check it out later
1
u/the-lazy-platypus 21h ago
Ive been debating building this myself.