~/projects/godfather-fitness-agent
GodFather — Self-Hosted AI Fitness Coach
Zero-cost Telegram fitness bot with 4 food-logging modes and AI-driven personalization
- $0/month running cost
- 4 food-logging modes
- 5 scheduled workflows
n8n · Supabase (PostgreSQL) · Telegram Bot API · Gemini 2.0 Flash · Cloudflare Tunnel · Docker Compose
Problem
I wanted personal fitness tracking without subscription bloat. Apps like MyFitnessPal and Fitbit cost money, lock data, and fail catastrophically at Indian cuisine—they don’t know Mangalorean spiced vegetables or Amul ice cream macros. I needed something that understood my food context, gave me personalized coaching, and tracked progress without friction or recurring fees.
Constraints
Zero budget pushed me to free tiers exclusively. Every service—Telegram, Gemini, n8n, Supabase, Open Food Facts—had to be free or self-hosted. Indian food context was the harder constraint: generic nutrition databases skip regional dishes, regional brands, and cooking methods. Home-server reality meant no auto-scaling; my HP box runs everything locally. Single-user workload let me optimize ruthlessly—I can abandon graceful degradation.
Architecture & Decisions
Fully event-driven: Telegram message arrives → Cloudflare Tunnel exposes my home n8n instance → webhook triggers, n8n routes and orchestrates everything. No custom app server. Why? n8n gives me retry logic, conditional branching, multi-step workflows, and scheduling built-in. Rolling a server would multiply complexity.
Gemini 2.0 Flash over GPT-4o: free tier covers my API call volume, and its multimodal strength—analyzing meal photos and nutrition labels in a single call—is perfect for visual food logging. Supabase free tier handles the data: structured queries for a single user scale indefinitely without cost.
The four logging modes matter because friction kills consistency. Text (“I had ragi mudde and sambar”) → Gemini extracts items and estimates macros. Meal photo → Gemini Vision analyzes portion and composition. Barcode → decoded, looked up in Open Food Facts. Nutrition label photo → Gemini Vision reads it directly. Each mode feeds the same n8n workflow; the bot routes based on what the user sends.
Build Notes
Five cron workflows keep me accountable: 7:00 AM motivation push, 7:30 AM workout reminder, 1:30 PM lunch logging nudge, 9:00 PM dinner nudge, Sunday 10:00 AM weekly progress snapshot (all IST). Calorie targets are Mifflin-St Jeor baseline, 400 kcal deficit, 2g/kg protein—simple enough to calculate in a workflow but personalized to my profile. Supabase stores food logs, weight history, and user configuration.
The India optimization isn’t a filter; it’s baked into the system prompt. Gemini knows that “paratha” varies wildly by region and oil, that MTR canned products are common, that IST matters for scheduling. This was cheaper than building a curated database.
Outcome
The bot replaced my fitness stack entirely: subscription tracking apps, a spreadsheet for manual logging, and the weekly slog of calculating trends. I log meals passively (photo or text), get immediate feedback on macros and progress, and see streaks without thinking. It’s been in daily personal use for several months without downtime.
What I’d do differently
Barcode OCR silently fails sometimes—adding image preprocessing would help. Caching Gemini responses for repeated foods (“oats with milk” shouldn’t call Vision every time) would cut latency and API costs. Building the Grafana dashboard earlier would have shown which logging modes users actually prefer. More granular error logging in n8n would catch silent workflow failures before they compound—home servers have different failure modes than managed platforms.