Personal project · in active development
FoodLogAI
2026An iOS calorie tracker where you log food in plain language, and every macro is computed by code, not guessed by the model.
Overview
FoodLogAI is an iOS app for tracking calories and macros. You log a meal the way you would text a friend ("8 oz 93/7 ground beef and 200g rice"), and the app turns that into structured, accurate nutrition without making you search a database.
Most AI nutrition apps let the model invent the numbers, so the calories drift. The rule that holds this app together is the same one behind my Sentinel project: the model only interprets what you said. Every calorie and gram of protein is computed deterministically from a canonical food catalog, never estimated by the model.
System diagram
What it explores
Deterministic macros, not model math
The model parses your message into food items and quantities. All nutrition is looked up per-100g from a canonical catalog and scaled in plain code, so the numbers are reproducible.
Multi-turn slot filling
Logging is a small state machine. If a food is missing grams, cooked state, or leanness, the backend asks one targeted follow-up with tappable chips, then resumes the pending session.
Fast food resolution
Each input resolves to a catalog entry through exact, fuzzy, and vector search, with an on-device SQLite FTS5 index so common lookups stay instant.
Pantry from receipts and barcodes
Scanning a barcode (OpenFoodFacts) or uploading a receipt (FatSecret resolution) builds a food inventory with stock levels, which feeds pantry and spending insights.
One schema, two clients
The backend returns typed responses whose type field drives every screen in the SwiftUI app, so the iOS and Python sides cannot drift out of sync.
How it works
- 1
Log
The SwiftUI app sends your message to a FastAPI endpoint over an authenticated session, signed in with Apple, Google, or email (bcrypt + JWT).
- 2
Interpret
An orchestrator classifies intent (log, nutrition question, correction) and an interpreter parses the food items and quantities. The model only produces structured data.
- 3
Resolve
Each item is matched to a canonical catalog entry. Missing details trigger a single follow-up question with option chips instead of a dead end.
- 4
Compute and store
Macros are computed from the catalog in plain Python, logged to Postgres, and rolled up into the day's totals and the pantry, cost, and nutrition insights.
Built and planned
Built
- Natural-language food logging with deterministic catalog macros
- Multi-turn clarification (grams, cooked state, leanness) with option chips
- Barcode scanning and receipt parsing into a pantry inventory
- Pantry, cost, nutrition, and weight insight views
- Sign-in with Apple, Google, and email, with bcrypt and JWT sessions
- On-device SQLite FTS5 food search and a backend pytest suite
Planned
- An AI fitness coach over the logged history
- Cardio logging and progress trends
- A hosted backend deployment
Stack
- Swift
- SwiftUI
- Python
- FastAPI
- PostgreSQL
- SQLite (FTS5)
- Pydantic
- Anthropic API
- JWT