Stop guessing what's in your packaged foods. Instantly scan packaged products with AI-powered precision to reveal hidden sugars, calories, and ingredients. Make informed choices in seconds.
- ๐ฏ About the Project
- โจ Features
- ๐ Supported Packaged Food Categories
- ๐ ๏ธ Tech Stack
- ๐ Project Structure
- ๐๏ธ Architecture & API Reference
- ๐ Getting Started
- ๐ป Usage
- ๐ฑ Dashboard Features
- ๐ค AI-Powered Tools
- ๐ณ Docker & Deployment
- ๐ฅ Our Team
- ๐ License
- ๐ Contact & Support
NutriGo is India's AI-powered nutrition companion, revolutionizing how people understand packaged foods. In a world where food labels confuse more than they clarify, we bring clarity through intelligent technology.
To democratize nutrition knowledge through AI-powered technology, empowering every Indian to make informed food choices that improve their health and well-being.
A future where food transparency is the norm. Where every Indian has instant access to clear, reliable nutrition information that helps them live healthier lives.
- 101 million Indians living with diabetes
- Rising childhood obesity rates across the country
- Confusing food labels that lack transparency
- Need for instant, reliable nutrition insights
Instantly scan any packaged food product with advanced AI to decode:
- Scan chips, biscuits, breakfast cereals, snacks, and beverages
- Identify sugar levels and hidden additives in processed foods
- Get calorie breakdown and complete nutritional values
- Analyze all ingredients and detect allergens
- Works with Indian packaged brands like Lay's, ITC, Britannia, Amul, and more
Every packaged product gets an intelligent Health Score (0-100):
- Comprehensive analysis of sugar content in snacks and beverages
- Calorie density assessment for portion planning
- Additive and preservative detection with warnings
- Overall healthiness rating for instant comparison
- Perfect for comparing products like Maggi, Haldiram's, Cadbury, and local brands
Discover healthier packaged food substitutes instantly:
- Find healthier alternatives for favorite snacks and breakfast items
- Compare popular products: Lay's vs Baked Chips, Regular Cookies vs Oats Cookies
- See nutritional differences at a glance
- Browse curated healthy options from brands like Yoga Bar, Slurrp Farm, Nature's Path
- Integration with major e-commerce platforms (Blinkit, Zepto, Swiggy, BigBasket)
Monitor your nutrition journey with detailed analytics:
- Track your packaged food consumption patterns
- Personalized recommendations based on scanning history
- AI-driven insights from your dietary choices with real products
- Weekly and monthly nutrition analytics for packaged foods
- Visual progress charts and statistics showing improvement
Get real-time nutrition breakdown in milliseconds:
- Scan packaged products and get results instantly
- Lightning-fast AI processing of food labels
- Complex nutritional data analyzed in seconds
- Immediate actionable insights for better choices
- No waiting, instant results for busy lifestyles
Ask questions about packaged foods, nutrition, and ingredients:
- Ask "Is Maggi noodles healthy?" - Get instant analysis
- "What's in this snack?" - AI decodes all ingredients
- 24/7 instant AI-powered answers and recommendations
- Voice input support (speech-to-text) for hands-free queries
- Voice output support (text-to-speech) for audio responses
- Conversational AI that understands your dietary goals
Comprehensive user dashboard featuring:
- See your recent packaged food scans at a glance
- Nutrition statistics from all your scanned products
- Health trends visualization based on packaged foods
- Quick access to all scanning and comparison features
- Responsive design that works on all devices
Keep track of everything you've scanned:
- Complete history of all packaged food products scanned
- Date, time, and details of each scan
- Product names, brands (Britannia, ITC, Lay's, etc.), and health scores
- Quick re-access to previous packaged food analyses
- Easy search and filter capabilities
Create your personal collection of packaged foods:
- Save favorite healthy packaged products you like
- Save unhealthy products to remember what to avoid
- Quick access to frequently checked packaged items
- Organize by category (snacks, cereals, beverages, etc.)
- Track trending healthy packaged options
Secure and easy account management:
- Sign up and login with email/password
- Google OAuth one-click sign-in integration
- User profile management (name, phone, location, bio)
- Supabase Auth with session refresh middleware
- Protected routes โ middleware redirects unauthenticated users to login
- JWT-based backend authentication with bcrypt password hashing
- Privacy-first approach to your health data
Compare packaged products side-by-side:
- Compare similar products: Britannia Cookies vs Sunfeast Cookies
- View nutritional comparison charts instantly
- See health score differences at a glance
- Analyze ingredient variations between brands
- Find the best packaged option for your dietary needs
Advanced analytics for premium users:
- Daily, weekly, monthly nutrition trends from packaged foods
- Health goal progress tracking based on your scans
- Detailed nutrient breakdowns (proteins, fats, carbs, sugars)
- Personalized health insights and recommendations
- Export reports of your nutrition journey
Set and track personal health objectives:
- Customizable health goals
- Goal progress visualization
- AI recommendations aligned with goals
- Success tracking
Seamless experience across all devices:
- Mobile-optimized interface with touch-friendly controls
- Tablet compatibility with adaptive layouts
- Desktop full experience with sidebar navigation
- Framer Motion animations and smooth transitions
- Floating navbar with scroll-aware transparency
Full theme support powered by next-themes:
- Dark mode by default with rich gradient backgrounds
- Light mode support via theme toggle
- System preference detection
- Persistent theme preference across sessions
Interactive and delightful authentication pages:
- Animated mascot that follows your cursor on the login page
- Mascot covers its eyes when you type your password
- Happy expression on successful login
- Starfield background animation with 60 animated stars
- Google OAuth button with animated icon
- Remember Me functionality
NutriGo scans and analyzes products across all major Indian packaged food categories:
- ๐ Snacks & Chips โ Lay's, Bingo, Kurkure, Cheetos, Makhana, Popcorn
- ๐ช Biscuits & Cookies โ Britannia, ITC, Sunfeast, Oreo, Parle-G
- ๐ฅฃ Breakfast Cereals โ Kellogg's, Quaker Oats, Bagrry's, Muesli, Granola
- ๐ Noodles & Pasta โ Maggi, Yippee, Top Ramen, Pasta, Vermicelli
- ๐ง Instant Mixes โ Dosa mix, Idli mix, Upma mix, Dhokla mix
- ๐ซ Chocolates & Sweets โ Cadbury, Nestlรฉ, Amul, KitKat, Dairy Milk
- ๐ฅ Beverages โ Tropicana, Real, Coca-Cola, Pepsi, Frooti, Paper Boat
- ๐ฅ Dairy โ Amul, Mother Dairy, Paneer, Cheese, Yogurt, Ghee
- ๐ฏ Spreads & Jams โ Peanut Butter, Nutella, Kissan, Honey
- ๐ Bread โ Sliced bread, Pav, Buns, Sandwich bread
- ๐ง Frozen Foods โ Paratha, Samosa, Spring Roll, Nuggets
- ๐ฅ Pickles โ Priya, Mother's Recipe, Patanjali
- ๐ฅซ Condiments โ Ketchup, Sauce, Mayonnaise, Chutney, Masala
- ๐ช Health Drinks โ Horlicks, Bournvita, Boost, Complan, Protinex
- ๐ฅ Nuts & Dry Fruits โ Happilo, Farmley, Trail Mix, Roasted Makhana
- ๐พ Grains & Flour โ Rice, Wheat, Atta, Quinoa, Ragi, Jowar
- ๐ Protein & Health Products โ Yoga Bar, Slurrp Farm, Whey Protein
Each product is analyzed for optimal nutrition and health impact!
Download and share scan results and comparisons:
- Export scan results as professional PDF reports (jsPDF + html2canvas)
- Export side-by-side product comparisons as landscape PDFs
- Share results via Web Share API or clipboard
- Generate shareable comparison summary text
- Dark-themed PDF reports with A4 formatting and multi-page support
Full voice support powered by Sarvam AI and Web Speech API:
- Text-to-Speech: Sarvam AI (
bulbul:v1model) with Indian English voice (vidyaspeaker) - Speech-to-Text: WebKit Speech Recognition for hands-free chatbot input
- Browser-based TTS fallback when Sarvam API is unavailable
- RecordRTC integration for audio recording capabilities
- Real-time interim transcript display during voice input
Category-specific scoring with transparent breakdown:
- 8 specialized scoring algorithms: Beverage, Snack, Dairy, Packaged Food, Breakfast Cereal, Frozen Food, Condiment, Dessert
- Detailed score breakdown showing penalties and bonuses with reasons
- Score interpretation: Excellent (85+), Good (70+), Moderate (50+), Poor (30+), Very Poor (<30)
- Confidence adjustment based on data completeness
- Per-100g normalization for fair comparison
Intelligent 4-step product identification:
- Tesseract.js OCR โ Extract barcode numbers and text from images
- OpenFoodFacts API โ Barcode lookup against global food database
- OpenFoodFacts Text Search โ Fallback search by product name
- Gemini 2.5 Flash Vision โ AI-powered image analysis with nutrition prediction when labels aren't visible
Automatic product categorization with subcategory support:
- Detects 15+ categories: snacks, biscuits, beverages, sweets, dairy, grains, proteins, noodles, cereal, condiments, frozen, pickles, bread, spreads, health drinks, instant mixes
- Subcategory detection (e.g., chips โ chips/namkeen/popcorn, biscuits โ cream/digestive/cookies)
- Both frontend and backend implementations with regex-based pattern matching
Direct purchase links to India's top delivery platforms:
- Blinkit โ 10-20 minute delivery links
- Zepto โ Ultra-fast delivery links
- Swiggy Instamart โ Quick grocery delivery links
- BigBasket โ Online grocery delivery links
- Auto-generated search URLs for every alternative product
Three-tier pricing model with yearly discounts:
- NutriGo (Free) โ 5 scans/day, basic health score, food comparisons
- NutriPlus (โน249/mo) โ Unlimited scans, detailed nutrients, AI insights, weekly reports, no ads
- NutriPro (โน499/mo) โ Everything in Plus + health goals, advanced analytics, hydration tracker, expert consultation
- Monthly/yearly billing toggle with 17% yearly savings
Machine learning health score prediction:
- CatBoost Regressor trained on
Indian_Packaged_Food.csvdataset - Feature engineering: protein-to-calorie ratio, fat-to-calorie ratio, sugar-to-carb ratio, macronutrient balance, calorie density
- RobustScaler normalization with 3-fold cross-validation
- Model artifacts:
health_score_catboost_model.pkl,health_score_scaler.pkl,feature_columns.pkl
Rich data visualization with Recharts:
- Weekly scan activity bar charts
- Health score trend line charts
- Streak tracking (consecutive days of scanning)
- Healthy choices percentage calculation
- Average health score aggregation
Food record management by meal type:
- Track scans by meal: breakfast, lunch, dinner, snack
- Servings count per food record
- Notes per scan entry
- Aggregated average health score over configurable time periods (30-day default)
- Indexed queries by user + meal type + date for fast lookups
Real-time feedback via Sonner toast system:
- Success/error/info toast notifications across all actions
- Scan saved, favorite toggled, PDF downloaded, profile updated confirmations
- Auto-dismiss toasts with smooth animations
- Global Toaster component on all dashboard pages
Comprehensive component library built on Radix UI + shadcn/ui:
- Accordion, Alert Dialog, Avatar, Badge, Breadcrumb, Button, Calendar
- Card, Carousel, Chart, Checkbox, Collapsible, Command Palette
- Context Menu, Dialog, Drawer, Dropdown Menu, Form, Hover Card
- Input, Input OTP, Label, Menubar, Navigation Menu, Pagination
- Popover, Progress, Radio Group, Resizable Panels, Scroll Area
- Select, Sheet, Sidebar, Skeleton, Slider, Switch, Table, Tabs
- Textarea, Toast, Toggle, Tooltip, and more
- Next.js 16+ โ React framework with App Router
- TypeScript โ Type-safe development
- Tailwind CSS v4 โ Utility-first styling
- Radix UI โ Full accessible component library (50+ components)
- Recharts โ Data visualization (bar/line charts)
- React Hook Form + Zod โ Form management with schema validation
- Framer Motion โ Smooth animations and transitions
- jsPDF + html2canvas โ PDF generation from DOM
- Vercel Analytics โ Production analytics
- Sonner โ Toast notification system
- Lucide React โ Icon library
- date-fns โ Date manipulation
- cmdk โ Command palette component
- next-themes โ Dark/Light theme system with system preference detection
- RecordRTC โ Audio recording capabilities for voice input
- Express.js โ Node.js web framework with TypeScript
- Tesseract.js โ OCR text recognition from food label images
- Mongoose/MongoDB โ Document database for products, users, food records, subscriptions
- Supabase (PostgreSQL) โ Primary database for scans, comparisons; Row Level Security
- Winston โ Structured logging with file transports (error.log, all.log)
- Multer โ File upload handling for image scans
- express-validator โ Request validation middleware
- JWT + bcrypt โ Authentication with JSON Web Tokens and password hashing
- node-cron โ Scheduled job infrastructure (cleanup jobs)
- Morgan โ HTTP request logging
- Google Gemini 2.5 Flash โ Vision AI for food label analysis and nutrition prediction
- Google Gemini 1.5 Flash โ Text-based food analysis fallback
- Google Generative AI โ Chatbot responses with knowledge base grounding
- LangChain โ AI framework integration (community + Google GenAI)
- Sarvam AI โ Indian English text-to-speech (
bulbul:v1model) - CatBoost โ ML health score regression model (Python)
- scikit-learn โ Feature engineering, scaling, cross-validation
- OpenFoodFacts API โ Global food product database (barcode + text search)
- Indian Packaged Food CSV โ Training dataset for ML model
- Knowledge Base FAQ โ 25+ curated Q&As about Indian packaged food brands
- Vercel โ Frontend deployment with edge middleware
- Docker โ Backend containerization (Node.js Alpine)
- Docker Compose โ Multi-service setup (app + MongoDB + Redis)
- Supabase โ PostgreSQL + Auth + Row Level Security
- Supabase Auth โ Email/password + Google OAuth (via
@supabase/auth-helpers-nextjs) - JWT (Backend) โ Token-based API authentication with 7-day token expiry
- bcryptjs โ Password hashing with salt rounds
- Middleware โ Next.js edge middleware for route protection (
/dashboard/*,/auth/*) - Row Level Security โ Supabase RLS policies on
comparisonstable (users can only read/write their own data)
- Jest โ Unit testing framework
- Supertest โ HTTP assertion library for API tests
- ts-jest โ TypeScript Jest transformer
nutrigo/
โโโ app/ # Next.js App Router
โ โโโ page.tsx # Landing page (Hero, Features, About, CTA)
โ โโโ layout.tsx # Root layout with theme provider & chatbot
โ โโโ globals.css # Global styles
โ โโโ api/ # Next.js API routes (proxy to backend)
โ โ โโโ auth/ # Login, signup, logout endpoints
โ โ โโโ scan/image/ # Image upload proxy
โ โ โโโ scans/ # CRUD for scan records
โ โ โโโ alternatives/ # Alternatives proxy
โ โ โโโ compare/ # Score recalculation proxy
โ โ โโโ tts/sarvam/ # Sarvam AI text-to-speech
โ โ โโโ metrics/ # Dashboard metrics
โ โ โโโ health/ # Health check
โ โ โโโ user/profile/ # User profile CRUD
โ โโโ auth/ # Auth pages (login, signup, callback)
โ โโโ dashboard/ # Protected dashboard routes
โ โ โโโ scanner/ # Camera/upload scanner
โ โ โโโ history/ # Scan history + [id] detail page
โ โ โโโ alternatives/ # Healthier alternatives browser
โ โ โโโ favorites/ # Saved favorites (localStorage)
โ โ โโโ profile/ # Editable user profile
โ โ โโโ settings/ # App settings & preferences
โ โโโ pricing/ # Subscription pricing page
โโโ backend/ # Express.js backend service
โ โโโ src/
โ โ โโโ app.ts # Express app setup with CORS & routes
โ โ โโโ server.ts # Server entry point
โ โ โโโ routes/ # API route handlers
โ โ โโโ controllers/ # Request handlers (scan, auth, products, history)
โ โ โโโ services/ # Business logic (chatbot, product, auth)
โ โ โโโ models/ # Mongoose schemas (User, Product, FoodRecord, Subscription)
โ โ โโโ middlewares/ # Auth, validation, error handling
โ โ โโโ lib/ # External APIs (OpenFoodFacts, Supabase)
โ โ โโโ utils/ # Health score calculator, category detector, logger, HTTP client
โ โ โโโ knowledge-base/ # FAQ JSON for chatbot grounding
โ โ โโโ config/ # Environment config
โ โ โโโ jobs/ # Scheduled cleanup jobs (node-cron)
โ โ โโโ scripts/ # DB migrations & seed scripts
โ โโโ Dockerfile # Node.js 18 Alpine container
โ โโโ docker-compose.yml # App + MongoDB + Redis stack
โโโ components/ # Reusable React components
โ โโโ scanner/ # Scan result, comparison, score breakdown components
โ โโโ landing/ # Landing page sections (hero, features, about, nav, footer)
โ โโโ ui/ # 50+ shadcn/ui components (Radix-based)
โ โโโ ChatbotWidget.tsx # Floating AI chatbot with voice I/O
โ โโโ theme-provider.tsx # Dark/Light theme provider (next-themes)
โโโ lib/ # Frontend utilities & API clients
โ โโโ api.ts # Auth, scans, comparisons API client
โ โโโ health-score.ts # Client-side health score calculation
โ โโโ categoryDetector.ts # 15+ category detection with subcategories
โ โโโ comparisonUtils.ts # Product comparison math & share text
โ โโโ comparisonApi.ts # Comparison CRUD API client
โ โโโ comparisonContext.ts # TypeScript types for comparison feature
โ โโโ pdf-utils.ts # PDF generation from DOM (jsPDF + html2canvas)
โ โโโ getSmartAlternatives.ts # Smart alternative fetcher with match scoring
โ โโโ mockAlternatives.ts # 890+ lines of static healthy alternatives
โ โโโ constants.ts # App routes, health score ranges
โ โโโ supabaseClient.js # Frontend Supabase client
โโโ model.py # CatBoost ML model training script
โโโ Indian_Packaged_Food.csv # Training dataset for ML model
โโโ middleware.ts # Next.js edge middleware (auth route protection)
โโโ hooks/ # Custom React hooks (useToast, useMobile)
| Route | Method | Description |
|---|---|---|
/api/auth/login |
POST | Mock login with deterministic user ID from email |
/api/auth/signup |
POST | Mock signup with email, password, name |
/api/auth/logout |
POST | Clear session |
/api/scan/image |
POST | Forward image upload to backend for OCR + AI analysis |
/api/scans |
GET | Fetch all scans for a user (by userId query param) |
/api/scans |
POST | Save a new scan record to Supabase |
/api/scans |
DELETE | Delete a scan (ownership verified) |
/api/scans/[id] |
GET | Fetch single scan detail by ID |
/api/scans/[id] |
DELETE | Delete specific scan |
/api/alternatives |
GET/POST | Proxy to backend alternatives API |
/api/compare/recalculate-scores |
POST | Forward score recalculation to backend |
/api/health |
GET | Health check endpoint |
/api/metrics |
GET | Dashboard metrics (total scans, avg score, streak) |
/api/tts/sarvam |
POST | Sarvam AI text-to-speech (Indian English, WAV format) |
/api/user/profile |
GET/PUT | User profile CRUD |
| Route | Method | Description |
|---|---|---|
/api/scan/image |
POST | Image upload โ OCR โ OpenFoodFacts โ Gemini Vision pipeline |
/api/scan/barcode |
POST | Barcode lookup via OpenFoodFacts + Gemini fallback |
/api/scan/history |
GET | Fetch all scan history from Supabase |
/api/alternatives |
GET/POST | Smart alternatives with Gemini AI + static fallback DB (3000+ lines) |
/api/chatbot/chat |
POST | Knowledge-base grounded chatbot via Gemini |
/api/chatbot/health |
GET | Chatbot service health check |
/api/compare/save |
POST | Save comparison between two products |
/api/compare/history |
GET | User's comparison history |
/api/compare/:id |
GET/DELETE | Get or delete specific comparison |
/api/compare/recalculate-scores |
POST | Recalculate health scores with detailed breakdown |
/api/auth/register |
POST | User registration (MongoDB + bcrypt) |
/api/auth/login |
POST | JWT token-based login |
/api/auth/me |
GET | Protected route โ get current user |
/api/products/alternatives |
GET | Healthier alternatives from Supabase (by minScore) |
/api/health |
GET | Backend health check with available routes |
| Route | Page | Description |
|---|---|---|
/ |
Landing | Hero, Features, Market stats, About team, CTA, Footer |
/auth/login |
Login | Email/password + Google OAuth with animated mascot |
/auth/signup |
Signup | Registration with password confirmation + Google OAuth |
/auth/callback |
OAuth Callback | Handles Supabase OAuth redirect |
/pricing |
Pricing | 3-tier subscription plans with monthly/yearly toggle |
/dashboard |
Dashboard Home | Stats cards, weekly charts, recent scans, streak tracker |
/dashboard/scanner |
Scanner | Camera capture + file upload โ AI analysis โ results |
/dashboard/history |
Scan History | All scans with search, filter by category, sort by date/score/calories/sugar |
/dashboard/history/[id] |
Scan Detail | Full nutrition breakdown, ingredients, warnings for a single scan |
/dashboard/alternatives |
Alternatives | Browse healthier alternatives with purchase links |
/dashboard/favorites |
Favorites | Saved favorite products (localStorage per user) |
/dashboard/profile |
Profile | Edit name, email, phone, location, bio; view subscription plan |
/dashboard/settings |
Settings | Notifications, dark mode, daily reminders, privacy controls |
| Model | Fields | Purpose |
|---|---|---|
| User | name, email, password, subscription_tier | User accounts with bcrypt passwords |
| Product | barcode, name, brand, nutrition, ingredients_text, image_url, health_score | Cached product data from OpenFoodFacts |
| FoodRecord | user, product, scanDate, servings, mealType, notes, healthScore | Meal tracking with aggregation queries |
| Subscription | user, type (free/premium), status, startDate, endDate, paymentHistory, features | Subscription management with TTL index |
| Table | Key Columns | Purpose |
|---|---|---|
| scans | id, user_id, product_name, detected_name, brand, category, barcode, health_score, nutrition (JSONB), ingredients, warnings, source | All scan records |
| comparisons | id, user_id, product_1_id, product_2_id, winner_id | Product comparison history with RLS policies |
| profiles | id, full_name, phone, location, bio, subscription_plan | User profile extensions |
| Component | File | Description |
|---|---|---|
ScanResult |
components/scanner/scan-result.tsx |
Full scan results with nutrition, score, alternatives, comparison, PDF download, share, favorite |
ProductComparisonView |
components/scanner/ProductComparisonView.tsx |
Side-by-side comparison with VS badge, winner detection, PDF export |
HealthScoreComparison |
components/scanner/HealthScoreComparison.tsx |
Health score visual comparison with score breakdown |
NutritionComparison |
components/scanner/NutritionComparison.tsx |
Metric-by-metric nutrition diff with percentage indicators |
ScoreBreakdownCard |
components/scanner/ScoreBreakdownCard.tsx |
Expandable penalties/bonuses breakdown card |
ComparisonCard |
components/scanner/ComparisonCard.tsx |
Individual product card in comparison view |
ScanLoadingPortal |
components/scanner/scan-loading-portal.tsx |
Full-screen loading portal during scan processing |
ChatbotWidget |
components/ChatbotWidget.tsx |
Floating chatbot with voice I/O, Sarvam TTS, WebKit STT |
| File | Purpose |
|---|---|
services/chatbot.service.ts |
Gemini 2.5 Flash chatbot with knowledge base loading from multiple paths |
services/product.service.ts |
Product fetch/cache: OpenFoodFacts โ MongoDB with health score calculation |
utils/healthScoreCalculator.ts |
1028-line scoring engine with 8 category-specific algorithms + breakdown |
utils/categoryDetector.ts |
Regex-based food category + subcategory detection |
utils/httpClient.ts |
Axios client with request/response interceptors and logging |
utils/logger.ts |
Winston logger with console + file transports (error.log, all.log) |
lib/openFoodFacts.ts |
OpenFoodFacts API client (barcode lookup, text search, existence check) |
lib/supabase.ts |
Singleton Supabase client for backend |
middlewares/auth.middleware.ts |
JWT Bearer token verification |
middlewares/error.middleware.ts |
Global error handler with Mongoose/JWT error classification |
middlewares/validate.middleware.ts |
express-validator result handling |
| File | Purpose |
|---|---|
lib/health-score.ts |
Client-side health score calculation with rating + color functions |
lib/categoryDetector.ts |
Extended 15+ category detection for frontend |
lib/comparisonUtils.ts |
Comparison math: diff calculation, winner detection, share text generation |
lib/comparisonContext.ts |
TypeScript types/interfaces for comparison feature + nutrition metrics config |
lib/comparisonApi.ts |
Frontend API client for save/get/delete comparisons |
lib/pdf-utils.ts |
PDF generation from DOM elements (A4, dark theme, multi-page) |
lib/getSmartAlternatives.ts |
Smart alternative fetcher with category detection, match scoring, fallback |
lib/mockAlternatives.ts |
890+ lines of static healthy alternatives across all categories with purchase links |
lib/api.ts |
Frontend API client for auth, scans, comparisons with safe JSON parsing |
lib/constants.ts |
App routes, health score ranges, nutrition guidelines |
lib/supabaseClient.js |
Frontend Supabase client instance |
middleware.ts |
Next.js edge middleware โ session refresh + route protection for /dashboard/* |
components/theme-provider.tsx |
Dark/Light theme provider wrapping next-themes |
hooks/use-toast.ts |
Custom toast hook for Sonner notification system |
hooks/use-mobile.ts |
Responsive breakpoint detection hook |
- Node.js 16+
- npm or yarn
- Docker (optional, for backend)
- Google Cloud credentials
- Supabase account
-
Clone the repository
git clone https://github.com/tung-programming/nutrigo.git cd nutrigo -
Install dependencies
# Frontend npm install # Backend cd backend npm install cd ..
-
Set up environment variables
Create
.env.localin the root directory:NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key SUPABASE_SERVICE_ROLE_KEY=your_service_role_key BACKEND_URL=http://localhost:4000 NEXT_PUBLIC_BACKEND_URL=http://localhost:4000 SARVAM_API_KEY=your_sarvam_tts_api_key
Create
backend/.env:PORT=4000 GEMINI_API_KEY=your_google_gemini_api_key SUPABASE_URL=your_supabase_url SUPABASE_KEY=your_supabase_service_key JWT_SECRET=your_jwt_secret MONGO_URI=mongodb://localhost:27017/nutrigo FRONTEND_URL=http://localhost:3000 NODE_ENV=development
-
Run the application
Backend (Terminal 1):
cd backend npm run devFrontend (Terminal 2):
npm run dev
-
Open your browser Navigate to
http://localhost:3000
- Sign Up/Login - Create an account or log in to access all features
- Scan Products - Upload an image of any packaged food product
- View Analysis - Get instant nutrition breakdown and health score
- Track Progress - Monitor your nutrition journey over time
- Find Alternatives - Discover healthier substitutes for your favorite products
- Ask Chatbot - Get personalized nutrition advice 24/7
Health Conscious Users
- Track daily nutrition intake
- Set health goals
- Get healthier alternative suggestions
- Monitor progress with analytics
Busy Professionals
- Quick product scans
- Instant health scores
- Fast alternative recommendations
- No-fuss interface
Parents
- Check kids' food safety
- Identify allergens
- Track family nutrition
- Get health recommendations
Fitness Enthusiasts
- Monitor macronutrients
- Track protein intake
- Compare supplement options
- Optimize nutrition for goals
- Recent Scans - Quick access to last scanned packaged products
- Nutrition Stats - Overview of your packaged food metrics
- Health Trends - Visualize your nutrition journey from scans
- Quick Actions - Scan new products, Compare brands, Ask Chatbot
- Complete list of all packaged food products scanned
- Filter by date, category (snacks, cereals, beverages), or health score
- Re-scan products you've analyzed before
- See scanning patterns and top products
- Save favorite packaged products (both healthy and unhealthy)
- Save Britannia biscuits, Lay's chips, Yoga Bar snacks, etc.
- Organize by category and brand
- Quick reference for common products
- Manage account settings and health preferences
- Update dietary restrictions (vegan, gluten-free, etc.)
- View your subscription plan and usage
- Download your complete scan history
- Notification preferences for new features
- Privacy controls for your scan data
- Theme preferences (Dark/Light mode)
- Language settings
- Browse healthier packaged food options
- Compare nutritional values of similar products
- See purchase links to Blinkit, Zepto, Swiggy, BigBasket
- Save alternative products to favorites
Multi-step food recognition with intelligent fallbacks:
- Tesseract.js OCR โ Extracts text and barcode numbers from uploaded images
- OpenFoodFacts Barcode Lookup โ Searches global database by detected barcode
- OpenFoodFacts Text Search โ Falls back to text-based product search
- Gemini 2.5 Flash Vision โ Sends raw image to Google AI for product identification, nutrition extraction, and health assessment
- Gemini Text Fallback โ Text-based nutrition analysis when image analysis fails
- Automatic category and subcategory detection
- Nutrition prediction when labels aren't visible (with
dataSource: "predicted"flag) - Scan result saved to Supabase with JSONB nutrition column
Category-aware scoring engine (1028 lines) with transparent breakdown:
- Beverage scoring: Sugar/100ml penalties, calorie/100ml weights, protein bonuses for milk drinks
- Snack scoring: Calorie, fat, sodium penalties; protein/fiber bonuses
- Dairy scoring: Saturated fat focus, calcium/protein bonuses
- Cereal scoring: Sugar-per-serving focus, whole grain/fiber bonuses
- Dessert scoring: Aggressive sugar penalties, portion size awareness
- Frozen/Condiment/General: Specialized algorithms per category
- Score breakdown: Returns
baseScore,finalScore,penalties[],bonuses[],summary - Score interpretation: Rating text + color for UI display
- Confidence adjustment: Reduces reliability for incomplete product data
Knowledge-base grounded chatbot powered by Gemini:
- Google Gemini 2.5 Flash model for response generation
- Knowledge base: 25+ curated FAQ entries about Indian packaged food brands
- Strict grounding: Only answers from knowledge base, declines unknown questions
- Sarvam AI TTS: Indian English voice synthesis (WAV format, 24kHz,
vidyaspeaker) - WebKit Speech Recognition: Browser-based speech-to-text for voice input
- Fallback to browser
SpeechSynthesisif Sarvam API fails - Available globally on every page as floating widget
Side-by-side product analysis:
- Compare any two scanned products with inline scan-another-product flow
- Health score recalculation via backend with detailed breakdown
- Nutrition diff calculation with percentage differences and winner indicators
- 7 tracked metrics: Calories, Sugar, Protein, Fat, Carbs, Sodium, Fiber
- Configurable
lowerIsBetterper metric for accurate winner determination - Export comparison as landscape PDF or share via Web Share API / clipboard
Intelligent healthier product suggestions:
- AI-powered: Gemini generates alternatives based on product category
- Static fallback: 3000+ line database covering snacks, chips, biscuits, beverages, dairy, sweets, cereals, namkeen, noodles
- Match scoring: 4 factors โ health improvement (40%), subcategory match (30%), calorie similarity (20%), brand diversity (10%)
- Purchase links: Auto-generated URLs for Blinkit, Zepto, Swiggy, BigBasket
- Top 12 alternatives returned, sorted by match score
cd backend
docker-compose up -dServices:
appโ Node.js 18 Alpine backend (port 5000)mongoโ MongoDB 6 (port 27017, persistent volume)redisโ Redis Alpine (port 6379, persistent volume)
Run in Supabase SQL editor:
-- Creates comparisons table with RLS policies, indexes, and updated_at trigger
-- See: backend/src/scripts/001-create-comparisons-table.sqlMeet the dedicated team of innovators building the future of food transparency:
![]() Arjun Bhat Frontend Developer |
![]() Pranav Rao K Frontend Developer |
![]() Tushar P Backend Developer |
![]() Amogha K A Backend Developer |
โ
AI-Powered โ Multi-model AI pipeline (Gemini Vision + OCR + OpenFoodFacts)
โ
Instant Results โ Get nutrition insights in milliseconds
โ
Voice Enabled โ Sarvam AI TTS + WebKit Speech Recognition
โ
Beautiful UI โ 50+ Radix components, Framer Motion animations, dark theme
โ
Mobile Optimized โ Responsive design with touch-friendly controls
โ
PDF Reports โ Export scan results and comparisons as branded PDFs
โ
Secure โ Supabase Auth, JWT, bcrypt, Row Level Security, edge middleware
โ
Free to Start โ Three-tier pricing with generous free plan
โ
India-Focused โ 17+ food categories, 25+ FAQ entries, 890+ static alternatives
โ
ML-Powered โ CatBoost health score model trained on Indian food dataset
โ
Quick Commerce โ Direct links to Blinkit, Zepto, Swiggy, BigBasket
โ
Dockerized โ One-command backend deployment with MongoDB + Redis
This project is licensed under the MIT License - see the LICENSE file for details.
- Website: nutrigo-kappa.vercel.app
- GitHub: tung-programming/nutrigo
- Issues: Report a bug or request a feature



