I built a macro tracker powered by AI + attitude. ποΈ
Plan your macros in the morning. Check in once at night. Let Milo cheer you on or let Evil Vilo roast you.
π Live demo: https://web-production-5c594.up.railway.app/
π¦ GitHub: https://github.com/Amulya631/MacroDay
The Problem
Most nutrition apps are reactive.
You eat something, you log it, you feel guilty later. The friction of logging every meal throughout the day is exactly why people abandon these apps within a week β and the people who care most about macros (gym-goers chasing protein and fiber targets) are the ones who need a simple system, not a data-entry job.
Old Way βMacroDay β¦ Log every meal, all daySet an intention in the morningReact to what you already ateMake smarter decisions all dayGuilt at 10pm when you're 40g short Confirm at night β no surprises
The Solution: Planning-First, Not Logging-First
Two touchpoints a day:
Morning β Tell MacroDay what you're planning to eat. Get instant AI-powered macro analysis across all five macros (calories, protein, fiber, carbs, and fats). Add snacks to close gaps and watch the rings update live.
Night. Confirm what you actually ate. Followed your plan? Quick tick-box list. Day went sideways? Enter your actual meals.
You set an intention in the morning, which means better decisions all day, not just guilt at the end.
Features
π― 5 animated SVG macro rings β real-time visual feedback for all five macros
π§ AI-powered analysis β Claude Haiku reads your meal descriptions and calculates macros, gaps, and smart snack suggestions
β‘ Live snack updates β add a suggested snack and all five rings update instantly
ποΈ Voice input β mic button on every meal field (Chrome, Web Speech API)
π Time-aware routing β the right screen for the time of day, automatically
π Night check-in β Path A (tick-box) or Path B (full re-entry), with edge case handling
π End-of-day summary β actual vs. target macro rings with celebration or encouragement
π Day rollover β history written to localStorage, today resets automatically
ππ Milo vs. Evil Vilo β choose your mascot. One is warm and proud of you. The other will not be kind about your fiber intake.
The Mascot System (a first-class feature)
The mascot is not an afterthought. At profile setup, you pick your flavor. Both characters appear on every emotional moment β morning results, skipped meals, end-of-day summary, sleep screen.
Milo (Good) π
"Great job planning ahead your protein is solid, and you've got room for a great snack tonight!"
Evil Vilo π
"Embarrassing. You logged 'some chicken' and expect me to calculate your macros? Try again."
Both are built from the same data β just radically different personalities. Vilo is a ragebait villain who will genuinely not be kind about your fiber intake.
Tech Stack
LayerTechNotesBackendPython Β· FastAPIServes frontend + APIFrontendVanilla HTML/CSS/JSNo framework neededAIClaude Haiku (claude-haiku-4-5-20251001)Single endpointStorageBrowser localStorageZero infraVoiceWeb Speech APIChrome onlyDeploymentRailway1 Procfile, 1 env var
Single-service architecture β FastAPI serves both the static frontend and the /api/analyze endpoint from the same origin. No CORS complexity, no separate frontend deployment.
How the AI Works
All macro analysis runs through a single endpoint:
POST /api/analyze
The request includes:
Meal descriptions (free text β "200g chicken breast, 150g rice")
Daily macro targets from the user's profile
Mode ("morning" or "night")
Mascot preference ("milo" or "vilo")
Claude returns structured JSON:
json{
"macros": {
"calories": 1480,
"protein": 112,
"fiber": 18,
"carbs": 160,
"fats": 38
},
"gaps": {
"calories": 520,
"protein": 38,
"fiber": 7
},
"feedback": "Your protein is on track but fiber is noticeably short...",
"snack_suggestions": [
"Greek yogurt (200g) β +15g protein, +0g fiber"
],
"affirmation": "Solid plan. Don't blow it at dinner.",
"needs_clarification": false
}
Key Architecture Decisions
- One endpoint, three modes Rather than separate routes for morning analysis, night analysis, and snack recalculation, everything goes through POST /api/analyze with a mode field.
One fetch wrapper on the frontend
Prompt logic lives in one place
Easier to tune Vilo's tone without hunting across multiple handlers
- Vague input detection at the prompt level When a user types "some chicken", the app doesn't try to parse or validate before sending. Instead, the Claude prompt instructs the model to return needs_clarification: true if it can't calculate macros with reasonable confidence. This is more robust than regexβClaude catches edge cases a rule-based validator would miss. "Food from the gym" is vague. "Leftover pasta" is ambiguous but probably workable.
- SVG rings over CSS conic gradients stroke-dasharray / stroke-dashoffset on SVG circles gives precise control over fill percentage and animates cleanly with CSS transitions. Conic-gradient is simpler to write but harder to animate and has inconsistent cross-browser rendering for partial fills. The SVG approach adds ~10 lines per ring but is rock-solid on every browser.
- localStorage over a backend database For a personal-use demo with no auth requirement, localStorage is the right call. Zero infrastructure, zero latency, works offline, resets cleanly. The data model is designed so that migrating to a real database later is straightforwardβeach key (macroday_profile, macroday_today, macroday_history) maps directly to what would be a user-scoped database record.
Project Structure
MacroDay/
βββ main.py # FastAPI app β serves frontend + API
βββ requirements.txt
βββ Procfile # Railway deployment config
βββ static/
β βββ index.html # Single-page app (all screens)
β βββ style.css # Health/wellness UI styling
β βββ app.js # Routing, profile, night check-in logic
β βββ analyze.js # API calls, ring rendering, snack logic
βββ assets/
β βββ Milo_Good.png
β βββ Vilo_Evil.png
βββ docs/
βββ scope.md
βββ prd.md
βββ spec.md
Running Locally
bash# 1. Clone
git clone https://github.com/Amulya631/MacroDay.git
cd MacroDay
2. Install
pip install -r requirements.txt
3. Set your API key
echo "ANTHROPIC_API_KEY=your-key-here" > .env
4. Start
uvicorn main:app --reload
5. Open http://localhost:8000 in Chrome
Get an Anthropic API key at console.anthropic.com.
What's Next (v2 Ideas)
πΈ Photo macro analysisβphotograph a meal, AI estimates macros from the image
π Push notifications β morning reminder at 8am, night reminder at 8pm
π Multi-day insightsβ"You've been low on fiber all week."
πͺ Post-workout mode β dedicated high-protein suggestion flow
Try It
π Live demo: https://web-production-5c594.up.railway.app/
β GitHub: https://github.com/Amulya631/MacroDay
π οΈ Built with: Claude Code Β· Anthropic
If you're a gym-goer who's ever abandoned a nutrition app because it felt like a second job β this one's for you. Give it a try, star the repo, or open an issue if you have ideas.
Top comments (0)