π€ AI-powered web application to analyze food labels with instant insights into nutritional facts, ingredient breakdown, and potential health risks.
EatInformed empowers users to make healthier food choices by leveraging advanced AI to decode complex food labels. Simply upload an image of a food product label, and receive comprehensive analysis including nutritional information, ingredient breakdown, allergen warnings, and health risk assessmentsβall powered by Google Gemini AI with Firebase Genkit integration.
Built with modern web technologies and designed for performance, EatInformed delivers real-time analysis with a beautiful, responsive interface optimized for all devices.
- Google Gemini AI Integration: Advanced multimodal AI for accurate image and text analysis
- Firebase Genkit Framework: Robust AI workflow orchestration and management
- Real-Time Processing: Instant analysis with streaming responses
- Multi-Language Support: Analyze labels in various languages
- Nutritional Facts Extraction: Complete breakdown of calories, macros, vitamins, and minerals
- Ingredient Analysis: Detailed examination of all ingredients with health implications
- Allergen Detection: Automatic identification of common allergens (nuts, dairy, gluten, etc.)
- Health Risk Assessment: AI-powered evaluation of potentially harmful additives
- Additive Identification: Recognition and explanation of E-numbers and preservatives
- Dietary Compliance: Check against vegan, vegetarian, keto, and other dietary restrictions
- Responsive Design: Seamless experience across desktop, tablet, and mobile devices
- Beautiful UI Components: Built with Radix UI primitives and Tailwind CSS
- Interactive Visualizations: Charts and graphs using Recharts
- Smooth Animations: Enhanced with TailwindCSS Animate and TSParticles
- Dark Mode Support: Eye-friendly interface for all lighting conditions
- Firebase Authentication: Secure user sign-up and login
- Email/Password & Social Auth: Multiple authentication methods
- Protected Routes: Secure access to user-specific features
- Admin Panel: Firebase Admin SDK integration for backend operations
- SQLite Database: Efficient local data storage
- Analysis History: Save and review past scans
- User Profiles: Personalized dietary preferences and restrictions
- Offline Support: Access previously analyzed products without internet
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 15.3.3 | React framework with App Router and Turbopack |
| React | 18.3.1 | Component-based UI library |
| TypeScript | 5.x | Type-safe development |
| Technology | Version | Purpose |
|---|---|---|
| Tailwind CSS | 3.4.1 | Utility-first CSS framework |
| Radix UI | Various | Accessible component primitives |
| Lucide React | 0.475.0 | Beautiful icon library |
| TailwindCSS Animate | 1.0.7 | Animation utilities |
| TSParticles | 3.0.0+ | Interactive particle effects |
| Technology | Version | Purpose |
|---|---|---|
| Google Gemini AI | Latest | Multimodal AI for image and text analysis |
| Firebase Genkit | 1.8.0 | AI workflow framework |
| @genkit-ai/googleai | 1.8.0 | Google AI plugin for Genkit |
| @genkit-ai/next | 1.8.0 | Next.js integration for Genkit |
| Technology | Version | Purpose |
|---|---|---|
| Firebase | 10.12.2 | Client-side authentication and services |
| Firebase Admin | 12.2.0 | Server-side Firebase operations |
| SQLite | Latest | Lightweight relational database |
| Technology | Version | Purpose |
|---|---|---|
| React Hook Form | 7.54.2 | Performant form management |
| @hookform/resolvers | 4.1.3 | Schema validation resolvers |
| Zod | 3.24.2 | TypeScript-first schema validation |
| Technology | Version | Purpose |
|---|---|---|
| Recharts | 2.15.1 | React charting library |
| date-fns | 3.6.0 | Date manipulation library |
| html2canvas | 1.4.1 | Screenshot generation |
| React Day Picker | 8.10.1 | Date picker component |
| Technology | Version | Purpose |
|---|---|---|
| ESLint | 8.x | Code linting and quality |
| PostCSS | 8.x | CSS transformations |
| Genkit CLI | 1.8.0 | AI development and testing |
Before you begin, ensure you have the following installed:
- Node.js 18.0 or higher
- Yarn 1.22+ (specified package manager)
- Git for version control
-
Google Gemini API Key
- Visit Google AI Studio
- Create a new API key
- Keep it secure for environment configuration
-
Firebase Project
- Go to Firebase Console
- Create a new project or use existing one
- Enable Authentication (Email/Password, Google Sign-in)
- Generate Web App credentials
- Download Firebase Admin Service Account JSON
-
Clone the Repository
git clone https://github.com/uffamit/eatinformed.git cd eatinformed -
Install Dependencies
yarn install
-
Environment Configuration
Create a
.env.localfile in the root directory:# Google Gemini AI GOOGLE_GEMINI_API_KEY=your_gemini_api_key_here GOOGLE_GENAI_API_KEY=your_gemini_api_key_here # Firebase Client Configuration NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com NEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your-project.appspot.com NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=your_measurement_id # Firebase Admin SDK (Server-side) FIREBASE_PROJECT_ID=your-project-id FIREBASE_CLIENT_EMAIL=firebase-adminsdk@your-project.iam.gserviceaccount.com FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYourPrivateKeyHere\n-----END PRIVATE KEY-----\n" # Application Configuration NEXT_PUBLIC_APP_URL=http://localhost:9003 NODE_ENV=development
Important: Replace all placeholder values with your actual credentials.
-
Firebase Setup
- Enable Authentication methods in Firebase Console
- Set up Firestore Database (if using)
- Configure Firebase Storage for image uploads
- Add authorized domains for authentication
-
Database Initialization
The SQLite database will be automatically created on first run. To manually initialize:
# Database file: database.sqlite # Schema will be created automatically by the application
-
Run Development Server
# Start Next.js development server with Turbopack yarn devThe application will be available at http://localhost:9003
-
Run Genkit Development Server (Optional)
For AI workflow development and testing:
yarn genkit:watch
This starts the Genkit Developer UI for testing AI flows.
# Development
yarn dev # Start Next.js dev server with Turbopack on port 9003
yarn genkit:watch # Watch and run Genkit AI flows in development mode
# Production
yarn build # Build optimized production bundle
yarn start # Start production server
# Code Quality
yarn lint # Run ESLint with strict settings (max-warnings=0)
yarn typecheck # Run TypeScript compiler checks without emitting files
# Package Management
yarn install # Install dependencies
yarn add <package> # Add new dependencyeatinformed/
βββ .github/ # GitHub configuration and workflows
βββ .idx/ # IDX configuration
βββ .vscode/ # VS Code settings
βββ docs/ # Documentation files
βββ src/
β βββ ai/ # AI integration layer
β β βββ flows/ # Genkit AI flows and prompts
β β βββ dev.ts # Genkit development configuration
β β βββ genkit.ts # Genkit initialization and setup
β βββ app/ # Next.js App Router pages and layouts
β β βββ (auth)/ # Authentication routes
β β βββ (dashboard)/ # Protected dashboard routes
β β βββ api/ # API routes and endpoints
β β βββ layout.tsx # Root layout component
β β βββ page.tsx # Home page
β βββ components/ # React components
β β βββ ui/ # Reusable UI components (Radix UI)
β β βββ forms/ # Form components
β β βββ layouts/ # Layout components
β β βββ features/ # Feature-specific components
β βββ context/ # React Context providers
β β βββ AuthContext.tsx # Authentication context
β β βββ ThemeContext.tsx # Theme management
β βββ hooks/ # Custom React hooks
β β βββ useAuth.ts # Authentication hook
β β βββ useFirebase.ts # Firebase utilities
β β βββ useAnalysis.ts # Food analysis hook
β βββ lib/ # Utility libraries and configurations
β β βββ firebase.ts # Firebase client initialization
β β βββ firebase-admin.ts # Firebase Admin SDK setup
β β βββ utils.ts # Helper functions
β βββ types/ # TypeScript type definitions
β β βββ analysis.ts # Food analysis types
β β βββ user.ts # User-related types
β β βββ index.ts # Exported types
β βββ utils/ # Utility functions
β βββ validation.ts # Zod schemas
β βββ formatters.ts # Data formatting utilities
βββ public/ # Static assets (images, fonts, etc.)
βββ .env.local # Environment variables (create this)
βββ .eslintrc.json # ESLint configuration
βββ .gitignore # Git ignore rules
βββ components.json # shadcn/ui component configuration
βββ database.sqlite # SQLite database file
βββ next.config.mjs # Next.js configuration
βββ package.json # Dependencies and scripts
βββ postcss.config.mjs # PostCSS configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ README.md
- Client-side Firebase initialization
- Authentication setup
- Firestore configuration
- Server-side Firebase Admin SDK
- Secure backend operations
- Token verification
- AI model initialization
- Google AI plugin setup
- Flow registration and management
- Image optimization settings
- Environment variable handling
- Build optimizations
- Custom color schemes
- Component styling extensions
- Animation configurations
POST /api/auth/signup # Create new user account
POST /api/auth/login # User login
POST /api/auth/logout # User logout
POST /api/auth/reset-password # Password reset request
POST /api/analyze/image # Upload and analyze food label image
GET /api/analyze/history # Get user's analysis history
GET /api/analyze/:id # Get specific analysis result
DELETE /api/analyze/:id # Delete analysis result
GET /api/user/profile # Get user profile
PUT /api/user/profile # Update user profile
GET /api/user/preferences # Get dietary preferences
PUT /api/user/preferences # Update dietary preferences
POST /api/genkit/analyze-label # AI-powered label analysis flow
POST /api/genkit/extract-nutrients # Extract nutritional information
POST /api/genkit/identify-allergens # Detect allergens in ingredients
- Email/Password Authentication
- Google Sign-In
- Password Reset & Email Verification
- Session Management
- User Profiles: Store user information and preferences
- Analysis Results: Save food label analysis history
- Favorites: Bookmark frequently scanned products
- Image Uploads: Store original food label images
- Report Generation: Save PDF reports of analyses
- Server-side Authentication: Verify user tokens
- Database Operations: Secure backend data access
- User Management: Admin operations
- Model: Gemini Pro Vision (multimodal)
- Capabilities:
- Image recognition and OCR
- Natural language understanding
- Contextual analysis of ingredients
- Nutritional data extraction
- AI Flow Management: Structured workflows for analysis
- Prompt Engineering: Optimized prompts for accurate results
- Streaming Responses: Real-time result delivery
- Error Handling: Robust fallback mechanisms
- Image Upload β User uploads food label photo
- Preprocessing β Image optimization and validation
- AI Analysis β Gemini processes image and extracts data
- Data Structuring β Genkit organizes results
- Health Assessment β AI evaluates nutritional impact
- User Presentation β Results displayed with visualizations
- Calorie breakdown (per serving and per 100g)
- Macronutrients (carbs, proteins, fats)
- Micronutrients (vitamins, minerals)
- Daily value percentages
- Comparison with recommended intake
- Complete ingredient list extraction
- Identification of artificial additives
- E-number explanation and health impacts
- Natural vs. synthetic ingredient classification
- Allergen highlighting
- Traffic light system (red/yellow/green)
- Harmful additive warnings
- Sugar and sodium level alerts
- Trans fat detection
- Preservative analysis
- β Vegan-friendly verification
- β Vegetarian compatibility
- β Gluten-free confirmation
- β Keto/Low-carb suitability
- β Halal/Kosher compliance
- β Allergen warnings (nuts, dairy, soy, etc.)
Built with Radix UI primitives for accessibility and Tailwind CSS for styling:
- Accordion - Collapsible content sections
- Alert Dialog - Confirmation modals
- Avatar - User profile images
- Checkbox - Form selections
- Dialog - Modal windows
- Dropdown Menu - Context menus
- Label - Form labels
- Menubar - Navigation menus
- Popover - Floating content
- Progress - Loading indicators
- Radio Group - Single selections
- Scroll Area - Scrollable regions
- Select - Dropdown selections
- Separator - Visual dividers
- Slider - Range inputs
- Switch - Toggle controls
- Tabs - Tabbed interfaces
- Toast - Notifications
- Tooltip - Hover hints
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Production deployment
vercel --prodEnsure all environment variables are configured in your deployment platform:
- Vercel Dashboard β Project Settings β Environment Variables
- Add all variables from
.env.local
- Automatic image optimization
- Static page generation where possible
- API route caching
- CDN distribution
Contributions make the open-source community thrive! Any contributions you make are greatly appreciated.
-
Fork the Project
# Click the 'Fork' button on GitHub -
Clone Your Fork
git clone https://github.com/your-username/eatinformed.git cd eatinformed -
Create a Feature Branch
git checkout -b feature/AmazingFeature
-
Make Your Changes
- Follow the existing code style
- Add tests if applicable
- Update documentation
-
Commit Your Changes
git add . git commit -m 'Add some AmazingFeature'
-
Push to Your Branch
git push origin feature/AmazingFeature
-
Open a Pull Request
- Go to the original repository
- Click 'New Pull Request'
- Describe your changes
- Use TypeScript strict mode
- Follow ESLint rules (
yarn lint) - Write meaningful commit messages
- Add JSDoc comments for complex functions
- Image analysis accuracy depends on photo quality
- Some obscure ingredients may not be recognized
- OCR may struggle with handwritten labels
- Analysis time varies based on image size (typically 3-10 seconds)
- Multi-language support for international labels
- Barcode scanning integration
- Product comparison feature
- Mobile app (React Native)
- Recipe suggestions based on dietary preferences
- Social sharing and community features
- Integration with fitness tracking apps
- Offline mode with service workers
- Voice input for hands-free operation
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Gemini for powerful AI capabilities
- Firebase for backend infrastructure and authentication
- Next.js Team for an excellent React framework
- Radix UI for accessible component primitives
- Vercel for seamless deployment platform
- shadcn/ui for beautiful component designs
Admin - @uffamit
Project Link: https://github.com/uffamit/eatinformed
- π Report a Bug
- π‘ Request a Feature
- π View Documentation
Made with β€οΈ for healthier food choices
Powered by Google Gemini AI & Firebase
Overview β’ Setup β’ API β’ Contributing β’ License