Skip to content

tung-programming/nutrigo

Repository files navigation

๐Ÿงƒ NutriGo

Smart Packaged Food Scanning Made Simple

Live Demo GitHub License

Stop guessing what's in your packaged foods. Scan any packaged product with AI-powered precision to reveal hidden sugars, calories, and ingredients. Make informed choices instantly.

Live Demo ยท Report Bug ยท Request Feature


๐Ÿ“‹ Table of Contents


๐ŸŽฏ About the Project

In a world where food labels confuse more than they clarify, NutriGo brings clarity. We're India's AI-powered nutrition companion, making every food choice an informed one.

With 101 million Indians living with diabetes and childhood obesity rates rising, we knew something had to change. NutriGo was born from the belief that everyone deserves to know what's in their food, without needing a nutrition degree to figure it out.

๐Ÿš€ Our Mission

To democratize nutrition knowledge through AI-powered technology, empowering every Indian to make informed food choices that improve their health and well-being.

๐ŸŒŸ Our Vision

A future where food transparency is the norm, not the exception. Where every Indian has instant access to clear, reliable nutrition information that helps them live healthier lives.


โœจ Features

๐Ÿ” AI-Powered Scanner

Instantly scan any packaged food product with advanced AI to decode sugar levels, calories, and hidden ingredients. Crystal-clear visual insights at your fingertips.

๐Ÿ“Š Smart Health Score

Every packaged product gets an intelligent Health Score based on comprehensive analysis of sugar, calories, additives, and nutritional value. Know what's truly healthy.

๐Ÿ”„ Better Alternatives

Discover healthier packaged food substitutes instantly. Compare products side-by-side and make smarter swaps for your everyday nutrition goals.

๐Ÿ“ˆ Progress Tracking

Monitor your nutrition journey with detailed analytics, personalized recommendations, and AI-driven insights based on your dietary preferences.

โšก Instant Analysis

Get real-time nutrition breakdown of packaged products in milliseconds. Our AI processes complex data instantly, giving you immediate actionable insights.

๐Ÿค– Smart AI Chatbot

Ask questions about nutrition, ingredients, and healthy eating. Get instant AI-powered answers and personalized recommendations 24/7.


๐Ÿ› ๏ธ Tech Stack

Frontend

  • Framework: Next.js 14 - React framework with App Router
  • Language: TypeScript - Type-safe JavaScript
  • Styling: Tailwind CSS - Utility-first CSS framework
  • UI Components: shadcn/ui - Re-usable component library
  • State Management: React Hooks (useState, useEffect)
  • HTTP Client: Fetch API
  • Deployment: Vercel

Backend

  • Runtime: Node.js (v18+)
  • Framework: Express.js - Web application framework
  • Language: JavaScript
  • Authentication: JWT (JSON Web Tokens)
  • File Upload: Multer - Middleware for handling multipart/form-data
  • CORS: cors - Cross-Origin Resource Sharing middleware

Database

  • Primary Database: Supabase - PostgreSQL database
  • ORM: Supabase Client SDK
  • Tables:
    • scans - Stores nutrition scan history and analysis

AI & Machine Learning

  • AI Model: Google Gemini AI - Advanced AI for image recognition and nutrition analysis
  • Image Processing: AI-powered food product recognition
  • Natural Language Processing: Chatbot for nutrition queries

Development Tools

  • Package Manager: npm / pnpm
  • Version Control: Git & GitHub
  • Code Editor: VS Code (recommended)
  • Environment Variables: dotenv

๐Ÿš€ Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js 18+ - Download
  • Git - Download
  • npm or pnpm - Comes with Node.js
  • Supabase Account - Sign up
  • Google Cloud Account - Sign up (for Gemini AI API)

Installation

  1. Clone the repository

    git clone https://github.com/tung-programming/nutrigo.git
    cd nutrigo
  2. Install frontend dependencies

    npm install
    # or
    pnpm install
  3. Install backend dependencies

    cd backend
    npm install
    cd ..
  4. Set up environment variables (see Environment Variables section)

  5. Set up Supabase database

    Create the following table in your Supabase project:

    create table scans (
      id text primary key,
      user_id text,
      detected_name text,
      brand text,
      nutrition jsonb,
      warnings text[],
      health_score integer,
      created_at timestamp with time zone default timezone('utc'::text, now()),
      barcode text,
      source text
    );
  6. Run the development servers

    Backend (Terminal 1):

    cd backend
    npm run dev

    Frontend (Terminal 2):

    npm run dev
  7. Open your browser

    Navigate to http://localhost:3000


๐Ÿ” Environment Variables

Frontend Environment Variables

Create a .env.local file in the root directory:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
BACKEND_URL=http://localhost:4000

Backend Environment Variables

Create a .env file in the backend directory:

PORT=4000
FRONTEND_URL=http://localhost:3000
JWT_SECRET=your_jwt_secret_key
SUPABASE_URL=your_supabase_project_url
SUPABASE_KEY=your_supabase_service_role_key
GEMINI_API_KEY=your_gemini_api_key

Variable Descriptions

Frontend Variables:

  • NEXT_PUBLIC_SUPABASE_URL - Your Supabase project URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY - Your Supabase anonymous key (public)
  • BACKEND_URL - The URL where your backend is running

Backend Variables:

  • PORT - Backend server port (default: 4000)
  • FRONTEND_URL - Frontend application URL
  • JWT_SECRET - Secret key for JWT tokens (generate a random string)
  • SUPABASE_URL - Your Supabase project URL
  • SUPABASE_KEY - Your Supabase service role key
  • GEMINI_API_KEY - Google Gemini AI API key

๐Ÿ”‘ API Keys Setup

Supabase Setup

  1. Go to Supabase and create a new project
  2. Once created, go to Project Settings โ†’ API
  3. You'll find:
    • Project URL โ†’ Use for SUPABASE_URL
    • anon public key โ†’ Use for NEXT_PUBLIC_SUPABASE_ANON_KEY
    • service_role key โ†’ Use for SUPABASE_KEY

Google Gemini AI Setup

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Gemini API
  4. Navigate to APIs & Services โ†’ Credentials
  5. Create an API key
  6. Copy the API key and use it for GEMINI_API_KEY

๐Ÿ’ป Usage

  1. Sign up/Login - Create an account or log in to access features
  2. Scan Products - Upload an image of any packaged food product
  3. View Analysis - Get instant nutrition breakdown and health score
  4. Track Progress - Monitor your nutrition journey over time
  5. Ask Questions - Use the AI chatbot for personalized nutrition advice
  6. Find Alternatives - Discover healthier substitutes for your favorite products

๐Ÿ“ Project Structure

nutrigo/
โ”œโ”€โ”€ app/                    # Next.js pages and routes
โ”‚   โ”œโ”€โ”€ (auth)/            # Authentication pages
โ”‚   โ”œโ”€โ”€ (dashboard)/       # Main application pages
โ”‚   โ”œโ”€โ”€ layout.tsx         # Root layout
โ”‚   โ””โ”€โ”€ page.tsx           # Landing page
โ”œโ”€โ”€ backend/               # Express backend server
โ”‚   โ”œโ”€โ”€ routes/            # API routes
โ”‚   โ”œโ”€โ”€ middleware/        # Custom middleware
โ”‚   โ”œโ”€โ”€ uploads/           # Uploaded images
โ”‚   โ”œโ”€โ”€ .env               # Backend environment variables
โ”‚   โ””โ”€โ”€ server.js          # Express server entry point
โ”œโ”€โ”€ components/            # React components
โ”‚   โ”œโ”€โ”€ ui/                # shadcn/ui components
โ”‚   โ””โ”€โ”€ ...                # Custom components
โ”œโ”€โ”€ lib/                   # Shared utilities
โ”‚   โ”œโ”€โ”€ supabase.ts        # Supabase client
โ”‚   โ””โ”€โ”€ utils.ts           # Helper functions
โ”œโ”€โ”€ public/                # Static assets
โ”‚   โ”œโ”€โ”€ team/              # Team member images
โ”‚   โ””โ”€โ”€ ...                # Other static files
โ”œโ”€โ”€ styles/                # Global CSS styles
โ”œโ”€โ”€ .env.local             # Frontend environment variables
โ”œโ”€โ”€ next.config.js         # Next.js configuration
โ”œโ”€โ”€ tailwind.config.js     # Tailwind CSS configuration
โ”œโ”€โ”€ package.json           # Frontend dependencies
โ””โ”€โ”€ README.md              # Project documentation

๐Ÿ› Troubleshooting

Common Issues

"supabaseUrl is required" Error

  • Check if you've created the .env file in the backend directory
  • Verify that SUPABASE_URL is correctly set
  • Ensure there are no extra spaces or quotes in the environment variable

Backend Connection Issues

  • Ensure backend is running on port 4000
  • Check if BACKEND_URL is correctly set in frontend .env.local
  • Verify CORS settings allow your frontend URL

Image Upload Errors

  • Ensure the uploads directory exists in the backend folder
  • Check file permissions on the uploads directory
  • Verify file size limits in multer configuration

Database Errors

  • Verify Supabase table schema matches the provided SQL
  • Check if all required columns exist
  • Ensure Supabase service role key has proper permissions

Still Need Help?

If you encounter any issues:

  1. Check the common issues section above
  2. Verify all environment variables are correctly set
  3. Ensure all required dependencies are installed
  4. Create an issue on GitHub with detailed information

๐Ÿ‘ฅ Our Team

Meet the dedicated team of innovators building the future of food transparency in India:

Arjun Bhat
Arjun Bhat
Frontend Developer
Pranav Rao K
Pranav Rao K
Frontend Developer
Tushar P
Tushar P
Backend Developer
Amogha K A
Amogha K A
Backend Developer

๐Ÿค Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

Distributed under the MIT License. See LICENSE for more information.


๐ŸŒŸ Star History

If you find NutriGo helpful, please consider giving it a โญ on GitHub!


๐Ÿ“ž Contact & Support


Together, we're building a healthier India, one scan at a time. ๐Ÿ‡ฎ๐Ÿ‡ณ

Made with โค๏ธ by the NutriGo Team

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages