A MERN stack app to fetch and visualize nutrition data (calories, protein) for any product using the Gemini API.
- Input a product name (e.g., "apple").
- Fetches nutrition data via Gemini API.
- Stores data in MongoDB.
- Displays a bar chart with Chart.js.
- Frontend: React (Vite), Chart.js
- Backend: Node.js, Express.js
- Database: MongoDB
- API: Google Gemini
-
Clone the Repo:
git clone https://github.com/snehauppula/nutrition-tracker.git cd nutrition-tracker -
Backend:
- Go to
backend:cd backend npm install - Add
.env:MONGO_URI=mongodb://localhost:27017/nutrition_tracker GEMINI_API_KEY=your_api_key PORT=5000 - Start MongoDB (local):
mongod - Run:
npm start
- Go to
-
Frontend:
- Go to
frontend:cd ../frontend npm install npm run dev - Open
http://localhost:3000.
- Go to
- Enter a product name.
- See nutrition data in a chart.
nutrition-tracker/
├── backend/ # Node.js, Express, MongoDB
├── frontend/ # React, Vite
└── README.md
- Port Issue: Change
PORTin.envif5000is taken. - MongoDB: Ensure it’s running or use MongoDB Atlas.
- API: Verify your Gemini API key.
MIT