Cut Tracker
A multi-user fat-loss tracking web app that accepts meal descriptions in any language and converts them into precise macro breakdowns via AI, presenting daily energy balance in a profit-and-loss accounting format.
Why I Built This
I wanted a dead-simple way to know my calorie balance at any point in the day — not a full nutrition app, just a quick answer to "am I in a deficit today?"
My first approach was a dedicated calorie-tracking app. The workflow was: search for the food, find the right entry, log the gram weight, repeat for every ingredient. It worked, but the lookup friction was real — and exporting data in any usable format was painful enough that I stopped doing it.
I switched to a personal Excel sheet with hand-written formulas. That removed the export problem, but I still had to look up macro values for every food item, either through an AI chat or a nutrition database, then copy numbers into cells. Two tools, two windows, lots of switching.
The fix was obvious: collapse everything into one step. Describe the meal in whatever language you think in, let DeepSeek handle the lookup and calculation, store the result automatically, and surface it as a clean dashboard with a one-click CSV export. That's Cut Tracker.
In Practice
Logging a meal
DeepSeek understands any language — log in English, Chinese, Japanese, or whatever comes naturally.
Sourdough toast (1 slice, ~40g) — 105 kcal · P 4g · C 20g · F 1g
Oat milk latte (medium, ~350ml) — 130 kcal · P 4g · C 19g · F 4g
─────────────────────────────────────────────────────────
Total — 455 kcal · P 22g · C 39g · F 22g
红烧肉 (3块, ~120g) — 395 kcal · P 18g · C 8g · F 32g
炒青菜 (1份, ~150g) — 80 kcal · P 3g · C 6g · F 5g
豆腐汤 (1碗, ~250ml) — 65 kcal · P 6g · C 3g · F 3g
─────────────────────────────────────────────────
合计 — 800 kcal · P 32g · C 74g · F 41g
Logging exercise
Brisk walk (20 min) — ~110 kcal
──────────────────────────────────
Exercise total — ~380 kcal added to TDEE
End-of-day balance
TDEE (BMR × NEAT + exer) — 2,310 kcal
──────────────────────────────────────
Net Energy Balance — −470 kcal ✓ deficit
When the cut is done, hit Export — every logged day comes out as a CSV with per-item macros, daily totals, and energy balance, ready for further analysis in Excel or wherever.
System Overview
Cut Tracker is a server-rendered web application with a Python/FastAPI backend, a SQLite database, and an AI integration layer that calls the DeepSeek V3 API for natural language macro parsing. Authentication is session-token-based with bcrypt password hashing and strict user-scoped data isolation.
session tokens · bcrypt
food log · activity · weight · admin
records.db
multilingual input → macros JSON
validate · store · calculate
How It Works
1. Food Logging via AI
Users describe meals in free-form text in any language — English, Chinese, Japanese, or mixed. The input is sent to DeepSeek V3, which returns a structured JSON object with per-item breakdowns: calories, protein, carbohydrates, and fat — both as consumed and per 100g serving. The server validates and stores the result, associating it with the user's session.
API cost is approximately $0.0001 per log entry. At one log per day, annual cost is under $0.04.
2. Energy Accounting Model
The core of Cut Tracker is a P&L-style energy balance calculation performed fresh on each dashboard load. The model mirrors how an accountant tracks profit: gross income minus costs equals net position.
3. NEAT Activity Multipliers
Non-Exercise Activity Thermogenesis is captured through a daily activity level selector. Multipliers are applied to BMR to compute baseline expenditure before exercise is added:
Sedentary — desk work, minimal movement
Light walking, some standing throughout the day
On feet regularly, moderate physical demands
Physical labour, high-step-count day
4. Request Lifecycle
Session token extracted from cookie, looked up in DB. Request is rejected if token is absent, expired, or unrecognised.
Form data is sanitised. Food descriptions are forwarded to DeepSeek V3 with a structured prompt enforcing JSON output.
Parsed macro data, activity entries, and weight measurements are written to the user's isolated rows in SQLite.
On each page load, the full energy balance is recomputed from today's records and rendered. Historical charts aggregate 7-day and 30-day windows.
One-click CSV generation serialises all of the user's records and returns them as a file download.
5. Multi-user & Admin
All data queries are scoped by user ID derived from the session token — no cross-user data leakage is possible
through the standard routes. A hidden admin panel at /admin is protected by a separate secret key
and provides account creation and deletion capabilities.
Infrastructure
The application is deployed on Railway, connected directly to the GitHub repository for continuous deployment. The SQLite database file is persisted via a Railway volume mount. Environment variables manage the DeepSeek API key, admin secret, and session signing key — none are committed to the repository.
API keys · secrets
records.db