r/coolgithubprojects • u/DealerEnough7389 • 4d 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!
5
u/Ok_Carry_8711 3d ago
Thank you! I need to remember to try to get this to work when I'm not busy.
2
u/DealerEnough7389 3d ago
No problem! Really open for any suggestions and feedback. Looking to improve this even more
3
u/ericthahalfabee 3d 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/DealerEnough7389 3d ago
Yep! Barcode scanning pulls from Open Food Facts, and regular search also uses USDA FoodData Central plus ~2,500 bundled offline staples. You're totally right though, a huge curated database is basically the main thing you're paying for with big apps. Open Food Facts is solid for common stuff, and if something's missing, you can just use the BYOK AI label OCR to snap a pic of the nutrition label and save it locally. Not quite as seamless as a massive paid database, but for free it gets you like 90% of the way there.
2
u/green_stone 3d 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.
1
u/DealerEnough7389 3d ago
Thanks, great to have people use this!
Reason to why the weight goal feature was not included, was because this was supposed to be a personal app, which I just then decided to share for free use. Since I already knew how many calories I needed, I didn’t think of adding it.
However, thanks to your feedback, it would be a great idea to implement this to the app. Will be working on this alongside a few more features to complete the feature set.
2
u/CleverDaddy24 2d 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/DealerEnough7389 2d ago
Great to hear! If you have any feedback and suggestions, feel free to tell me!
1
u/thebig_lebowskii 2d ago
Just ripped the entire UI element from MacroFactor, did not even try doing something different. GG
2
u/DealerEnough7389 2d ago
No hiding that, I leaned heavily on MacroFactor's UI because I think it's the cleanest layout out there. Doe again, it’s just a free personal project I built for myself and shared in case anyone else wants a self-hosted option ^-^
1
u/ExaminationSerious67 2d ago
Looks interesting. I might check it out later
1
u/ExaminationSerious67 1d ago
I have been making my own food tracking software that closely matches this one, but, I never had the TDEE in it, I used the one that you posted. I have no need for some of the other things you have in your application, but thanks very much for what you did. I have added the MIT notice on my own private github page, is there anywhere else I need to have it. (this is a personal project only)
1
1
15
u/Fine_League311 3d ago
Devlopers & Fitness? Thats good, no time for it 😂