A professional AI-powered nutrition supplement analysis application built with Next.js 14 and OpenAI GPT-4. Scan supplement labels, get comprehensive nutritional insights, and make informed health decisions.
Experience the complete UI component library with:
- ποΈ Professional Layout Components (Header, Footer, Sidebar)
- π Advanced Loading States (Skeleton components for all sections)
- 𧬠Nutrient Analysis Display (Progress bars, safety levels, interactions)
β οΈ Warning System (4 severity levels, emergency contacts)- π Academic References (Credibility scores, citation standards)
- π¨ Framer Motion Animations (Smooth transitions throughout)
- βΏ Full Accessibility (ARIA labels, keyboard navigation)
- π± Mobile-First Design (Touch-friendly, responsive)
Local development:
npm run dev
# Open http://localhost:3000ε¦δ½ζ¬ε°εΏ«ιδ½ιͺοΌε
θΏθ‘ npm installοΌεζ§θ‘ npm run devοΌζεζεΌ http://localhost:3000/analysisγ
This demo application showcases an AI-powered nutrition analysis platform designed for health-conscious individuals and fitness enthusiasts. It provides instant supplement analysis through OCR scanning and database search, delivering professional-grade nutritional insights.
- OCR Label Scanning: Upload supplement images for instant text extraction and ingredient identification
- AI-Powered Analysis: Comprehensive nutritional breakdowns using OpenAI GPT-4
- Search Database: Search curated supplement database with popular brands
- Professional Reports: 8-point analysis format in English and Chinese
- Safety Compliance: Evidence-based recommendations with interaction warnings
- Mobile-First Design: Responsive, accessible, medical-grade UI
- Next.js 14 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first CSS framework
- Lucide React - Beautiful icons
- Framer Motion - Smooth animations
- OpenAI GPT-4 - AI analysis engine
- Tesseract.js - OCR processing (planned)
- Prisma ORM - Database management
- SQLite - Demo database
- ESLint - Code linting
- Prettier - Code formatting
- TypeScript - Static type checking
Each supplement receives a comprehensive 8-point analysis:
- εΊζ¬δ»η» (Basic Introduction) - Overview and primary purpose
- δΈ»θ¦ηε€ (Primary Benefits) - Evidence-based benefits with research citations
- ζ¨θζε ₯ι (RDA) - Recommended daily allowance for adults
- ε―θεζι«ζε ₯ι (UL) - Safe upper limits for consumption
- εΈΈθ§θ³ι£ζ₯ζΊ (Dietary Sources) - Natural food sources
- θ‘₯ε εε½’εΌ (Supplement Forms) - Different forms and bioavailability
- ιεε ³ζ³¨ηζ ε΅ (Usage Scenarios) - When supplementation is beneficial
- ι£ι©δΈζ³¨ζδΊι‘Ή (Risks & Precautions) - Safety warnings and interactions
- Node.js 18+
- npm or yarn package manager
- Git
-
Clone the repository
git clone https://github.com/your-username/nutrition-ai-demo.git cd nutrition-ai-demo -
Install dependencies
npm install
-
Set up environment variables
cp .env.local.example .env.local
Update
.env.localwith your configuration. Keep API keys (NIH, OpenAI, etc.) in this untracked file so they never reach Git history. -
Run the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
npm run build
npm startBefore committing, run the lightweight secret scanner to double-check that no keys have slipped into tracked files:
npm run check:secretsYou can wire this up to a local git hook (for example, pre-commit) if youβd like the scan to run automatically.
nutrition-ai-demo/
βββ src/
β βββ app/ # Next.js App Router pages
β β βββ page.tsx # Landing page
β β βββ layout.tsx # Root layout
β β βββ globals.css # Global styles
β β βββ analyze/ # Analysis page
β βββ components/ # React components
β β βββ layout/ # Layout components
β β βββ upload/ # File upload components
β β βββ analysis/ # Analysis display components
β βββ lib/ # Utilities and types
β βββ types.ts # TypeScript interfaces
β βββ utils.ts # Helper functions
βββ public/ # Static assets
βββ docs/ # Documentation
βββ package.json # Dependencies and scripts
- Primary: Blue tones for trust and professionalism
- Health: Green tones for wellness and nature
- Accent: Complementary colors for highlights
- Medical: Clean whites and grays for medical-grade appearance
- Font: Inter for modern, readable interface
- Hierarchy: Clear heading structure for accessibility
- Language: Bilingual support (English/Chinese)
- Medical Cards: Elevated cards with professional shadows
- Buttons: Primary and secondary button styles
- Forms: Accessible form controls with validation
- Icons: Consistent Lucide React icon usage
- Local Storage: Sensitive data stored locally
- Encrypted Profiles: User data encryption
- GDPR Compliance: Privacy-focused design
- Medical Disclaimers: Clear legal disclaimers
- Data Minimization: Collect only essential information
- β Next.js 14 setup with TypeScript
- β Tailwind CSS configuration
- β Professional landing page
- β Analysis page interface
- β Navigation and layout components
- β Error boundary implementation
- π OCR implementation with Tesseract.js
- π File upload with drag & drop
- π Search functionality
- π Database integration
- π OpenAI GPT-4 integration
- π Professional analysis prompts
- π Structured response parsing
- π User tracking system
- π Testing and QA
- π Performance optimization
- π Deployment to Vercel
- π Documentation completion
- Start the dev server with
npm run devand open http://localhost:3000/test-scanner to exercise the barcode β OCR β analyze β search flow. - Runtime flags: the scanner reads the standard
NEXT_PUBLIC_API_URLfor API routing andNEXT_PUBLIC_OCR_LANGfor OCR language selection. To enable the Paddle OCR microservice in production, setNEXT_PUBLIC_OCR_ENGINE=paddle, pointNEXT_PUBLIC_PADDLE_OCR_URLat your deployed service (for examplehttps://ocr.example.com), and useNEXT_PUBLIC_OCR_TIMEOUT_MS/NEXT_PUBLIC_OCR_CONFIDENCE_MINto tune timeouts and quality thresholds. LeaveNEXT_PUBLIC_TESSERACT_ENABLED=trueonly if you want automatic fallback to the in-browser worker. - Open the Debug Drawer via the gear icon in the top-right corner to toggle engines, force OCR, inspect raw JSON, view timing metrics, and review the last eight sessions recorded in the in-memory history list.
- Common issues:
- Camera permission denied β the page surfaces a toast and guidance banner; grant access in the browser settings and retry.
- Barcode timeout/unsupported β switch engines from the Debug Drawer or move closer to the label to improve detection.
- Low OCR confidence β the flow automatically enters Manual Correction so you can edit the extracted text before rerunning analysis.
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run type-check # Run TypeScript checks- Create a Vercel account at vercel.com
- Connect your GitHub repository:
npm install -g vercel vercel login vercel --prod
- Set environment variables in Vercel dashboard:
OPENAI_API_KEY: Your OpenAI API keyDATABASE_URL: Database connection string (when implemented)
- Connect your GitHub repository to Netlify
- Set build command:
npm run build - Set publish directory:
.next - Add environment variables in Netlify dashboard
- Connect GitHub repository to Railway
- Railway will auto-detect Next.js and deploy
- Add environment variables in Railway dashboard
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This project showcases modern web development practices and AI integration for health technology applications, focusing on evidence-based nutrition guidance and professional supplement analysis.
For questions, suggestions, or support:
- Create an issue on GitHub
- Contact the development team
- Review the documentation
β‘ Powered by Next.js 14, OpenAI GPT-4, and modern web technologies