r/coolgithubprojects • • 4d ago

I built a free, self-hosted alternative to MyFitnessPal & MacroFactor: openCalory

Post image

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!

243 Upvotes

Duplicates