Disclaimer: The bot is an assistant, not a doctor. All calculations are transparent but serve as estimates. It does not replace professional medical advice.
The simplified version. The real system has 6 layers — background job runners, a terminal admin panel, FSM state management, dual-source vision pipeline (OpenAI → Gemini fallback), dual-source nutrition pipeline (USDA → Nutritionix fallback), LLM observability via Langfuse, and Cloudflare Zero Trust routing. The diagram below doesn't do it justice.
flowchart TD
User([Telegram Client]) --> Webhook[FastAPI Webhook]
Webhook --> Core[aiogram Dispatcher]
Core --> Pipeline[Analysis Pipeline]
Core --> Jobs[Background Jobs<br>daily_report, retention, broadcast]
Core --> TUI[Admin TUI<br>Textual]
Pipeline --> Vision[GPT-4o Vision<br>identify dish]
Pipeline --> Nutrition[USDA REST API<br>calculate macros]
Vision --> DB[(PostgreSQL<br>users, meals)]
Nutrition --> DB
Redis[(Redis<br>FSM state, rate limits)] -.-> DB
Nobody expects a full terminal dashboard in a food tracker.
FoodShot ships with an interactive TUI (powered by Textual) to manage the entire system locally or over SSH — grant/revoke Premium access, browse meal history, resolve FSM state conflicts, all without touching SQL.
The fastest way — just open Telegram and try it:
Want to run it locally or self-host:
git clone git@github.com:soroqn1/FoodShot.git && cd foodshot
cp .env.example .env
# fill in your keys, then:
task install && task dev # start webhook & services→ Full setup guide — webhook mode, Cloudflare tunnel, migrations, all commands.
Issues and PRs are welcome. For significant changes — open an issue first to discuss what you'd like to change. Tests for medical math are strictly required.
Business Source License 1.1 (BUSL-1.1)
You are completely free to clone, run, and modify this project for personal use, education. Commercial or production use is strictly prohibited without explicit permission.
Commercial use — contact me directly.




