Skip to content

Repository files navigation

NutriGo

NutriGo — AI Nutrition Assistant

Snap a photo of your food, let AI analyze the nutrition, and get personalized dietary advice. A Tauri 2 mobile app with cloud-hosted data and AI services.

Go Python React TypeScript License

CI Release Last Commit


📸 Screenshots

Live demo · AI chat

NutriGo AI chat: ask a question, view the reply and expand tool details
Login AI Chat Food Diary Nutrition Trend Health Profile
Login AI Chat Food Diary Nutrition trend chart Health profile

✨ Features

  • 📷 Photo Analysis — DeepSeek V4.1 Flash estimates multiple foods, portions and nutrition; edit grams or nutrients, then save the whole meal with retry deduplication
  • 🤖 AI Chat — Agent Loop + 5 tools, SSE streaming output, Markdown, expandable tool results and optional model reasoning
  • 📚 RAG Knowledge Base — ChromaDB with 2,277 entries from a nutrition textbook, answers professional nutrition questions
  • 📊 Nutrition Analysis — 8,407 food nutrition references, gram-based conversion, multi-day trend insights
  • 🗓️ Food Diary — Photo or manual entries by date; meal type defaults to the phone's local time and remains editable, with daily totals and nutrition trends
  • 👤 Personalized Profile — Height/weight, goals, allergies, pre-existing conditions; AI-tailored dietary advice
  • 🛡️ Authentication & Access Control — JWT + refresh-token rotation & logout blacklist, IP rate limiting on auth, internal service token, strict key validation in production
  • 💾 Data protection — Referenced-photo deletion guards, durable cleanup retries, verified local backups, and optional offsite/alert configuration; see the operations guide.

🚀 Quick Start

Android download

Download Android 1.0.0 APK · Release notes and checksums

ARM64 stable release build for Android 8.0+ with Android System WebView 117+. Android debugging and cleartext HTTP are disabled. Its production package ID differs from the earlier .debug test builds, so both can coexist; iOS source and native checks are available, but no IPA or TestFlight release is published yet.

The production API is deployed from commit 6ddfe4d3. Android 1.0.0 uses POST /agent-api/chat, keeping message text out of URLs and access logs. Older test APKs can still use accounts, profiles, diaries and the retained CLIP photo endpoints, but their legacy GET /chat client can no longer chat. See the mobile compatibility table before testing an older build.

Requirements

Tool Version
Go 1.26.5+
Python 3.13 (CI / Docker)
Node.js 24 (CI); minimum 22.12
uv 0.11+

Installation

git clone https://github.com/Green-hats/NutriGo.git
cd NutriGo

# Configure LLM API key (supports OpenAI/Gemini/DeepSeek/Ollama via litellm)
cp agent/.env.example agent/.env
# Edit agent/.env and fill in LLM_API_KEY
# Photo analysis uses DeepSeek official: set FOOD_VISION_API_KEY
# or reuse LLM_API_KEY when chat is configured for DeepSeek official

# Start all services with one command
./start.sh

The command above starts local services and the browser preview. The product is a Tauri 2 Android / iOS app:

cd frontend
npm run android:dev
# On macOS with Xcode: npm run ios:dev

Stop any existing Vite process first to free port 5173. See the mobile guide for prerequisites, device debugging, API configuration and signing. Local development works before a cloud domain is available.

Service Layout

Service Port Stack Responsibility
frontend App bundle (dev :5173) Tauri 2 + React 19 + TS Android / iOS interface
backend :3333 Go + Gin + GORM + SQLite Users / data / files
agent :8000 FastAPI + litellm + ChromaDB AI chat / recognition / RAG

🏗️ Architecture

NutriGo architecture: mobile app, cloud services, AI and data

  • Agent Loop — the LLM autonomously decides which tool to call; streams model reasoning when the provider returns reasoning_content
  • 5 Tools — look up nutrition / get profile / get diet history / get nutrition trends / search knowledge base
  • RAG — BGE-small-zh embeddings + ChromaDB vector retrieval
  • Multimodal — DeepSeek V4.1 Flash vision API with nutrition database references; Chinese-CLIP retained for older APKs
  • Meal workflow — upload a photo → verify ownership → analyze food and nutrition → edit the draft in the app → save all items in one Go transaction. Retrying the same batch does not create duplicate records.
  • Client compatibility — Android 1.0.0 has the complete current protocol; older APKs retain core data and CLIP flows, while legacy URL-based chat is intentionally disabled

The app preselects breakfast, lunch, dinner or a snack using local time. Users can change it directly; estimated weight ranges and assumptions are tucked into expandable nutrition details. API keys stay on the server, and React assets ship inside the app.

Diet details remain available; referenced photos are protected, while unattached photos expire seven days after upload by default. Local backups and hourly checks run on the server; offsite storage and notification delivery are not configured yet. See data management. Account deletion / full export and real-data offline sync remain on the roadmap.

See docs/ARCHITECTURE.md for detailed design.


📚 Documentation

Doc Description
Mobile app Android / iOS development, native builds and cloud connection
Cloud deployment Caddy HTTPS + Go + Agent on one server
Architecture System architecture, data flow, security design
API Reference Go routes, errors, image deletion and batch-save contracts
Backend Go services, transactions and background tasks
Data management Retention, deletion, backup scope and recovery gaps
Resource limits Request bounds, photo quotas, disk admission and inference concurrency
Roadmap Delivered capabilities, limitations and priorities
Product proposal Product goals and acceptance criteria
Agent Doc Python Agent design & tool descriptions
Frontend Doc React frontend structure
Test Prompts Agent test prompt suites

🧪 Testing

These checks do not require running application services or live models. Install dependencies as described in the contributing guide first:

(cd backend && go test ./internal/... && go vet ./...)
(cd frontend && npm run lint && npm test && npm run build)
(cd agent && uv run ruff check app/ recognition/ tests/ && uv run mypy app/ recognition/ && uv run pytest)
python3 -m unittest discover -s deploy/cloud/backup -p 'test_*.py'
python3 -m unittest discover -s .github/scripts -p 'test_*.py'

make test also invokes development integration scripts that need services, models or a live LLM; it is neither an isolated unit suite nor every CI check. Go HTTP integration uses a dedicated test database, and Agent integration scripts must not target production. CI additionally checks native code, Android and the gateway; see the contributing guide for full commands and device-validation requirements.


🛠️ Tech Stack

Layer Tech
Mobile app Tauri 2 · Rust · React 19 · TypeScript (strict) · MUI 9 + Emotion · Zustand · Vite · vitest
Agent Python 3.13 · FastAPI · LiteLLM · httpx / DeepSeek vision API · BGE + ChromaDB · SSE
Backend Go 1.26 · Gin · GORM · SQLite · JWT · bcrypt
Quality Go test · pytest · ruff · mypy · oxlint · vitest · GitHub Actions CI

🚀 Deployment

See cloud deployment. Caddy exposes one HTTPS API origin, while Go and Agent run on the private Compose network. React assets are distributed inside the mobile app. No frontend hosting is required. Server updates, Android Releases and documentation changes are delivered separately; Actions does not currently deploy the server.


🤝 Contributing

Contributions are welcome! Please check out:

  • Contributing Guide
  • Run the checks relevant to your change in the contributing guide
  • Follow the Conventional Commits convention

📄 License

This project is open-sourced under the GPL v3 license.


NutriGo — giving everyone their own AI nutritionist.

About

🥗 AI Nutrition Assistant / AI 智能营养师 — Photo food recognition, AI nutrition analysis & personalized dietary advice. 拍照识别食物、AI 营养分析、个性化膳食建议的全栈应用。

Topics

Resources

Contributing

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages