Skip to content

Latest commit

 

History

52 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NutriSync

Live Demo CI codecov License: MIT Deno Edge Functions 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: Supabase Edge Functions (Deno/TypeScript), Google Gemini AI, USDA API

Infrastructure: Supabase (PostgreSQL + Auth + Storage + Edge Functions), 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 (Supabase CLI, for Edge Functions):

# https://supabase.com/docs/guides/cli/getting-started
supabase functions serve

Frontend:

cd frontend
npm install

Configure Environment

Set Edge Function secrets (once, via Supabase CLI - SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY are injected automatically, you don't set them):

supabase secrets set GOOGLE_API_KEY=your_gemini_api_key
supabase secrets set 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:54321/functions/v1

Run Application

Backend (Edge Functions, local emulator):

supabase functions serve

Frontend:

cd frontend
npm run dev

Access at http://localhost:5173

Project Structure

nutrisync/
├── supabase/
│   ├── functions/       # Edge Functions - API routes (12 endpoints)
│   │   ├── _shared/     # Shared CORS, Gemini REST client, helpers
│   │   └── <name>/index.ts
│   └── config.toml
├── backend/              # Historical DB migrations only (no app code)
│   └── migrations/       # Database migrations (8 files)
├── 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

Frontend:

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

Test Organization:

  • Frontend: (contexts, components, pages, charts)
  • Backend: no automated tests currently (the old FastAPI pytest suite was retired along with the FastAPI app; Edge Functions would use deno test)

CI/CD: Automated testing on every push via GitHub Actions

Deployment

Backend: Supabase Edge Functions via supabase functions deploy

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:

  • 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

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages