Skip to content

AI-powered nutrition tracking app with intermittent fasting support, meal photo recognition, and personalized health insights. Built with React + FastAPI + Supabase.

License

Notifications You must be signed in to change notification settings

KrishP147/nutrisync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NutriSync

Live Demo CI codecov License: MIT Python 3.11+ Node 18+

NutriSync is a comprehensive full-stack nutrition tracking application designed to simplify and enhance the way users manage their dietary health. The platform combines intelligent meal logging with AI-powered food recognition, personalized nutrition tracking, and intermittent fasting support to create an all-in-one health management solution.

Users can effortlessly log meals by uploading food photos for instant AI analysis or searching through a database of over 400,000 foods from the USDA FoodData Central. The application calculates personalized calorie and macro targets based on individual body metrics, activity levels, and fitness goals (weight loss, maintenance, or muscle gain) using industry-standard BMR and TDEE formulas. Progress is tracked through interactive visualizations, daily nutrition reports, and streak-based achievements to encourage consistent logging habits.

For users practicing intermittent fasting, NutriSync offers built-in fasting timers with support for popular schedules including 16:8, 18:6, 20:4, and OMAD, complete with real-time progress tracking and hydration reminders. The platform also respects dietary preferences and restrictions (Halal, Kosher, Vegan, Vegetarian, Gluten-Free, Dairy-Free, Nut-Free, and more) by flagging incompatible foods during meal logging.

Features

Core Functionality

  • AI food recognition via photo upload (Google Gemini AI)

    AI Photo Logging

  • Comprehensive food database search (USDA FoodData Central - 400,000+ foods)

    Manual Food Logging

  • Customizable nutrition goals with BMR/TDEE calculations

    Goals Setup

  • Intermittent fasting tracking (16:8, 18:6, 20:4, OMAD schedules)

    Fasting Tracking

  • Progress visualization with interactive charts

    Progress Charts

  • Personalized daily reports, saved across each logging day

    Daily Reports

  • Dietary restriction support (Halal, Kosher, Vegan, Vegetarian, Gluten-Free, etc.)

    Dietary Restrictions

Technical Features

  • Google OAuth authentication with email/password fallback
  • Email infrastructure with Resend SMTP (custom domain with SPF/DKIM/DMARC compliance)
  • Password reset, email change verification, and secure account deletion workflows
  • Row Level Security (RLS) policies ensuring complete data privacy
  • Real-time meal photo storage with Supabase Storage
  • AI nutrition assistant chatbot for dietary guidance
  • Responsive design with dark mode theming
  • Comprehensive testing suite with coverage tracking via Codecov flags
  • CI/CD pipeline with GitHub Actions

Demo

demov1.mp4

Tech Stack

Frontend: React 18, Vite, Tailwind CSS, Plotly.js, Supabase Client

Backend: FastAPI, Google Gemini AI, USDA API, Supabase

Infrastructure: Supabase (PostgreSQL + Auth + Storage), Digital Ocean (Backend), Vercel (Frontend), GitHub Actions (CI/CD)

Documentation

Complete setup instructions: docs/README.md

Quick Links

  1. Prerequisites - Required software and accounts
  2. Database Setup - Supabase and migrations
  3. API Configuration - External APIs
  4. Running Locally - Development setup
  5. Google OAuth - Optional OAuth setup
  6. Testing - Running tests
  7. Deployment - Production deployment
  8. Troubleshooting - Common issues and solutions

Quick Start

Install Dependencies

Backend:

cd backend
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

Frontend:

cd frontend
npm install

Configure Environment

Create backend/.env:

SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
SUPABASE_KEY=your_anon_key
GOOGLE_API_KEY=your_gemini_api_key
USDA_API_KEY=your_usda_key

Create frontend/.env.local:

VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_anon_key
VITE_API_URL=http://localhost:8000

Run Application

Backend:

cd backend
uvicorn app.main:app --reload

Frontend:

cd frontend
npm run dev

Access at http://localhost:5173

Project Structure

nutrisync/
├── backend/              # FastAPI application
│   ├── app/
│   │   ├── main.py      # API routes (13 endpoints)
│   │   └── services/    # Gemini AI integration
│   ├── tests/           # Backend tests (85 tests, 74.5% coverage)
│   ├── migrations/      # Database migrations (8 files)
│   └── deploy.sh        # Deployment script
├── frontend/            # React application
│   ├── src/
│   │   ├── components/  # React components
│   │   ├── pages/       # Page routes
│   │   └── services/    # API clients
│   └── tests/           # Frontend tests (137 tests, 60.4% coverage)
├── docs/                # Setup documentation
└── .github/workflows/   # CI/CD configuration

Testing

Backend:

cd backend
pytest tests/ -v                          # Run all tests
pytest tests/ --cov=app --cov-report=html # With coverage report

Frontend:

cd frontend
npm test                  # Run all tests
npm run test:coverage    # With coverage report

Test Organization:

  • Backend: (API endpoints, AI services, user management, fasting, edge cases)
  • Frontend: (contexts, components, pages, charts)

CI/CD: Automated testing on every push via GitHub Actions with separate coverage tracking for backend and frontend

Deployment

Backend: Digital Ocean App Platform via backend/deploy.sh

Frontend: Vercel with automatic GitHub integration

See Deployment Guide for detailed instructions.

License

MIT License - see LICENSE file

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/name)
  3. Commit changes (git commit -m 'Add feature')
  4. Push to branch (git push origin feature/name)
  5. Open a Pull Request

Run tests before submitting:

  • Backend: pytest tests/
  • Frontend: npm test

Note: This monorepo combines frontend and backend. Original separate repositories (frontend, backend) are archived.

About

AI-powered nutrition tracking app with intermittent fasting support, meal photo recognition, and personalized health insights. Built with React + FastAPI + Supabase.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •