A modern nutrition tracking application powered by AI that provides personalized metabolic insights and meal analysis.
- AI-Powered Meal Analysis: Upload meal photos for instant nutritional analysis using Gemini Vision AI
- Personalized Insights: Get AI-generated metabolic recommendations using Hugging Face text generation
- Health Dashboard: Track calories, macros, health scores, and trends
- Meal History: Complete timeline with weekly analytics and visualizations
- User Profiles: Manage health goals, allergies, and dietary preferences
- Gamification: Earn badges and maintain tracking streaks
- Secure Authentication: JWT-based user authentication with bcrypt password hashing
- Sustainable Food Dashboard: Track the environmental footprint of your dietary choices and promote eco-friendly eating habits
- Impact Score: A holistic metric that evaluates the nutritional quality and environmental sustainability of your meals
- Curated Wellness Library: Access a library of expert resources on metabolic health, nutrition, and sustainable living
Frontend
- React 18 with React Router
- Tailwind CSS for styling
- Framer Motion for animations
- Recharts for data visualization
- Lucide React icons
Backend
- Node.js with Express
- SQLite database
- Hugging Face Inference API (Mistral-7B)
- Gemini Vision AI for meal analysis
- JWT authentication
- Node.js (v16 or higher)
- npm
- Install Dependencies
npm run install:all- Configure Environment Variables
Create server/.env:
PORT=5000
NODE_ENV=development
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
DB_PATH=./database/nafira.db
UPLOAD_PATH=./uploads
GEMINI_API_KEY=your-gemini-api-key-here
HUGGINGFACE_API_KEY=your-huggingface-api-key-optional
CORS_ORIGIN=http://localhost:5000,http://127.0.0.1:5000Create .env in root:
REACT_APP_API_URL=http://localhost:5000/api- Initialize Database
npm run server:initDemo credentials:
- Email:
demo@nafira.app - Password:
demo123
- Run Application
Windows: Right-click start.bat and select "Run as administrator"
-# This probably won't work with the new commits, I have no idea why it can't.
Manual:
npm run devAccess at:
- App (frontend + API): http://localhost:5000
- Backend API: http://localhost:5000/api
The frontend is configured to run on port 80 for easy internet access.
- Find your local IP:
ipconfig - Access from other devices:
http://<your-local-ip>-# Might give CORS error if not configured properly.
-
Configure Windows Firewall:
- Allow incoming connections on port 80
- Windows Defender Firewall → Advanced Settings → Inbound Rules
-
Configure Router:
- Forward port 80 to your machine's local IP
- Access router settings (usually 192.168.1.1)
-
Access:
- Use your public IP:
http://<your-public-ip>
- Use your public IP:
POST /api/auth/register- Register new userPOST /api/auth/login- Login user
GET /api/user/profile- Get user profilePUT /api/user/profile- Update profilePUT /api/user/settings- Update settingsGET /api/user/quick-stats- Dashboard statisticsGET /api/user/badges- User badgesGET /api/user/ai-focus- AI-generated insights
POST /api/meals- Upload and analyze mealGET /api/meals/recent- Recent mealsGET /api/meals/history- Meal historyGET /api/meals/weekly-stats- Weekly statistics
app2/
├── .env # Frontend environment variables
├── .env.example # Frontend env template
├── README.md # Project documentation
├── package.json # Frontend dependencies
├── start.bat # Windows startup script
├── install.bat # Windows install script
├── src/ # Frontend source
│ ├── components/ # UI components
│ ├── context/ # React context
│ ├── pages/ # Page components
│ └── services/ # API service
└── server/ # Backend
├── .env # Backend environment variables
├── .env.example # Backend env template
├── package.json # Backend dependencies
├── server.js # Express server
├── config/ # Database config
├── routes/ # API routes
├── services/ # AI services
│ ├── huggingfaceService.js # Hugging Face integration
│ └── geminiService.js # Gemini Vision AI
└── database/ # SQLite database
The app uses Mistral-7B-Instruct-v0.2 for generating personalized nutrition insights:
- Analyzes user profile, goals, and meal history
- Generates contextual metabolic recommendations
- Falls back to smart insights if API is unavailable
Processes meal photos to extract:
- Ingredient identification
- Nutritional information (calories, macros)
- Health scores and recommendations
npm startcd server
npm run devcd server
rm database/nafira.db
npm run init-dbnpm run build:prodDeploy the build/ folder (frontend) and server/ folder (backend) separately or together.
- JWT-based authentication with 7-day token expiration
- Bcrypt password hashing
- Rate limiting (100 requests per 15 minutes)
- File upload limits (10MB max)
- CORS configuration
- Helmet security headers
Port 80 Access Denied
- Run as administrator
- Or change PORT in
.envto a higher port (e.g., 3000)
Database Issues
cd server
rm database/nafira.db
npm run init-dbCORS Errors
- Verify
REACT_APP_API_URLmatches backend URL - Check CORS allowed origins in
server/server.js
AI API Errors
- Check API keys in
.env - Verify internet connection
- App will fall back to smart insights automatically
tbh idc yall can run your own instances
Built with ❤️ for metabolic health and wellness by rusetiq