AI-powered mobile food diary — photograph a meal to identify it, or search ingredients manually. Built with React Native, FastAPI, and the LogMeal food recognition API.
Food Diary lets users track daily calorie intake through two logging flows:
- Photo log — take a photo or pick one from the gallery. The image is sent to the LogMeal segmentation API, which returns bounding boxes and top-5 dish candidates for each detected food region. Users confirm (or correct) each region, edit the serving size in grams, and kcal updates instantly without an extra API call.
- Manual log — search a locally cached ingredient catalogue (≈3 000 items), add ingredients to a basket, set grams per item, and compute total kcal in one call.
All entries are stored in a date-grouped diary with per-day kcal totals, photo thumbnails, and swipe-to-delete. An optional profile screen tracks weight, height, goal, and dietary preference, with live BMI calculation.
Android App (Expo / React Native + TypeScript)
│
│ HTTPS + Bearer JWT
▼
FastAPI (Railway) ─────────────────────────────┐
├── /auth → Supabase Auth │
├── /profile → Supabase Postgres │
├── /diary → Supabase Postgres │
└── /logmeal/* → LogMeal API (key server-side only)
│
Supabase Storage ◄──────────┘
(meal-images bucket — public URL
stored in diary_entries.image_url)
The mobile app never calls LogMeal directly. The LOGMEAL_API_KEY lives only in Railway environment variables and is never shipped in the APK.
| Layer | Technology |
|---|---|
| Mobile | React Native, Expo SDK 54, TypeScript (strict) |
| State | Zustand — one store per domain |
| Backend | Python 3.12, FastAPI 0.115, httpx async |
| Database | Supabase Postgres (profiles, diary entries, ingredient cache) |
| Auth | Supabase Auth — JWT, OTP email verification, auto-refresh |
| Storage | Supabase Storage — meal-images bucket |
| AI | LogMeal API — food segmentation, confirmation, nutrition |
| Deployment | Railway (backend), EAS Build (Android APK) |
Run the one-shot setup script to wire git hooks, create the Python virtualenv, install mobile dependencies, and validate project files:
bash setup.shOr set up each part manually:
| Tool | Version |
|---|---|
| Python | 3.12 |
| Node.js | ≥ 20 |
| EAS CLI | latest — npm install -g eas-cli |
cd backend
python3 -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # fill in the three variables below
uvicorn app.main:app --reload
requirements.lockis the pinned lockfile generated fromrequirements.txt. The Dockerfile uses the lockfile for reproducible builds. To update dependencies:pip-compile requirements.txt -o requirements.lock
Confirm it is running:
curl http://127.0.0.1:8000/health
# {"status":"ok"}cd mobile
npm installCreate mobile/.env:
EXPO_PUBLIC_API_URL=https://food-diary-production-cd15.up.railway.app
Start the dev server and press a to open on an Android device or emulator:
npx expo start| Variable | Description |
|---|---|
SUPABASE_URL |
Supabase project URL |
SUPABASE_SECRET_KEY |
Service role key — backend only, never in mobile |
LOGMEAL_API_KEY |
LogMeal API bearer token — backend only, never in mobile |
| Variable | Description |
|---|---|
EXPO_PUBLIC_API_URL |
FastAPI backend base URL |
EXPO_PUBLIC_SUPABASE_URL |
Supabase project URL (for client-side session refresh) |
EXPO_PUBLIC_SUPABASE_ANON_KEY |
Supabase anon key (public — safe in mobile) |
Requires Android 10 (API 29) or later. To install: go to Settings → Apps → Special app access → Install unknown apps, enable installation from your browser or file manager, open the APK, and tap Install.
https://www.youtube.com/watch?v=bUg6UNzSWow
food-diary/
├── backend/ FastAPI — auth, profile, diary, LogMeal proxy
│ ├── app/
│ │ ├── routers/ auth.py profile.py diary.py logmeal.py
│ │ ├── models/ schemas.py
│ │ ├── middleware/auth_guard.py
│ │ └── db/ supabase.py
│ └── Dockerfile
├── mobile/ Expo React Native — Android app
│ └── src/
│ ├── screens/ PhotoLogScreen ManualLogScreen DiaryScreen ProfileScreen
│ ├── components/BboxOverlay Toast Button Input PickerField
│ ├── store/ auth.ts diary.ts
│ ├── api/ client.ts
│ └── theme/ colors spacing typography
├── docs/ Architecture and user manual
├── .github/ CI workflow and Copilot instructions
├── .githooks/ Pre-commit AI usage guardrail
├── .vscode/ Recommended extensions, workspace settings, and debug configs
└── setup.sh One-shot dev environment bootstrap
- Architecture — system diagram, API reference, caching and auth design
- User manual — step-by-step guide for all five flows
- Performance profiling — runtime analysis of POST /logmeal/segment
- Contributing — git workflow, commit conventions, and AI disclosure rules
- Changelog — release history in Keep a Changelog format
- AI usage disclosure — full record of AI-assisted and manual changes
- Known limitations — free-tier constraints and deliberate design choices