A modern, AI-powered nutrition assistant that helps users analyze their meals, track calories, and get personalized nutrition advice using Google's Gemini AI.
- πΈ Instant Food Analysis: Upload or snap a photo of your meal.
- π€ AI Nutritionist: Powered by Gemini 2.0 Flash for accurate food identification and advice.
- π Smart Tracking: Automatically estimates calories, protein, carbs, and fats.
- π Secure Authentication: Google OAuth 2.0 integration.
- π Meal History: Keep track of your daily nutrition journey.
- π Progress Insights: Weekly charts and stats to monitor your goals.
- π± Mobile Ready: Optimized for both desktop and mobile devices.
- Frontend: React, Vite, Recharts, Framer Motion
- Backend: FastAPI, Python, MongoDB (Motor)
- AI: Google Gemini API (Visual Analysis)
- Storage: Google Cloud Storage (Images)
- Auth: Google OAuth + JWT
- Node.js & npm
- Python 3.9+
- MongoDB Atlas Account
- Google Cloud Project (for GCS & OAuth)
- Gemini API Key
cd backend
python -m venv venv
# Windows
.\venv\Scripts\activate
# Mac/Linux
source venv/bin/activate
pip install -r requirements.txtCreate a .env file in the backend directory:
GEMINI_API_KEY=your_gemini_key
MONGODB_URI=your_mongodb_connection_string
GCS_BUCKET_NAME=your_bucket_name
GOOGLE_APPLICATION_CREDENTIALS=path/to/gcs_credentials.json
# Authorization
GOOGLE_CLIENT_ID=your_oauth_client_id
GOOGLE_CLIENT_SECRET=your_oauth_client_secret
JWT_SECRET_KEY=generate_a_random_secret_string
FRONTEND_URL=http://localhost:5173Start the server:
uvicorn main:app --reloadcd frontend
npm installCreate a .env file in the frontend directory:
VITE_API_URL=http://localhost:8000
VITE_GOOGLE_CLIENT_ID=your_oauth_client_idStart the development server:
npm run dev- Go to Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to APIs & Services > Credentials.
- Click Create Credentials > OAuth client ID.
- Application type: Web application.
- Add Authorized Redirect URI:
http://localhost:8000/auth/google/callback - Copy the Client ID and Client Secret to your
.envfiles.
You can generate a secure random key using python:
import secrets
print(secrets.token_urlsafe(32))To use the camera feature on mobile:
- Access the app via your network IP (e.g.,
http://192.168.1.x:5173). - Ensure your backend allows CORS from this IP.
- The upload button will automatically prompt for Camera or Gallery.
MIT License - Made with β€οΈ by EatRight Team