A comprehensive full-stack web application that helps users track their daily nutrition, log meals, monitor water intake, and get personalized nutrition insights using AI.
The Dashboard provides a quick summary of your daily nutrition, hydration tracking, and progress towards your goals. Users can log meals, water intake, exercises, and weight, all from one convenient view.
The Meal Plan Playground allows users to generate personalized meal plans based on dietary preferences and restrictions. You can set your daily calorie target, meal duration, and select from various diet types to create a plan that fits your needs.
Nutritional Insights breaks down the nutritional content of your saved meals. Get a clear view of your total calories, protein, carbs, and fat, plus a detailed per-recipe analysis in both chart and table formats.
With the Calorie Scanner, you can upload food photos to automatically analyze their calorie and macronutrient content. The feature uses smart detection to suggest food items and provides tips for best results.
- Google OAuth 2.0 integration for seamless login
- JWT-based authentication for secure sessions
- User registration and login with email verification
- Protected routes and session management
- Multi-step meal wizard (Meal Type β Food Selection β Review)
- Comprehensive food database with 17+ vegetarian/vegan options
- Real-time nutrition calculation with accurate macro tracking
- Meal categorization (breakfast, lunch, dinner, snack)
- Quantity-based serving calculations with proper rounding
- Real-time nutrition display (calories, protein, carbs, fat)
- Progress rings with percentage completion
- Daily nutrition goals (2000 calories, 150g protein, 200g carbs, 70g fat)
- Timeline view of logged meals and activities
- Water intake tracking with visual progress
- MongoDB integration for all user data storage
- Meal storage with complete nutrition breakdown
- Water log storage with timestamps
- User profile management
- Data persistence across sessions
- Responsive design (mobile-first approach)
- Modern UI components with Tailwind CSS
- Smooth animations using Framer Motion
- Interactive charts and data visualization
- Modal-based workflows for better UX
- Personal nutrition analyst with AI insights
- Time period filtering (day, week, month)
- Nutrition deficiency tracking
- Weekly overview charts
- Consistency heatmaps
- React 18 with TypeScript
- Vite (build tool and dev server)
- Tailwind CSS (styling framework)
- Framer Motion (animations)
- Recharts (data visualization)
- React Router (navigation)
- Axios (HTTP client)
- Vitest (testing framework)
- Node.js with Express.js
- TypeScript (type safety)
- MongoDB with Mongoose ODM
- Passport.js (authentication)
- Google OAuth 2.0 (social login)
- JWT (JSON Web Tokens)
- bcryptjs (password hashing)
- dotenv (environment variables)
- Git (version control)
- ESLint (code linting)
- Prettier (code formatting)
- PostCSS (CSS processing)
- Node.js (v16 or higher)
- MongoDB (local or cloud)
- Google OAuth credentials
-
Clone the repository
git clone https://github.com/16Prithvi/NutriTrack.git cd NutriTrack -
Install dependencies
# Install frontend dependencies cd frontend npm install # Install backend dependencies cd ../server npm install
-
Environment Setup
Create a
.envfile in theserverdirectory:MONGODB_URI=mongodb://localhost:27017/nutritrack JWT_SECRET=your_jwt_secret_here GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret GOOGLE_CALLBACK_URL=http://localhost:5000/api/auth/google/callback CLIENT_URL=http://localhost:3000
-
Start the application
# Start the backend server cd server npm run dev # Start the frontend (in a new terminal) cd frontend npm run dev
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
NutriTrack/
βββ frontend/ # React frontend application
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Page components
β β βββ services/ # API service functions
β β βββ context/ # React context providers
β β βββ hooks/ # Custom React hooks
β β βββ types/ # TypeScript type definitions
β β βββ utils/ # Utility functions
β βββ public/ # Static assets
β βββ package.json
βββ server/ # Node.js backend application
β βββ src/
β β βββ controllers/ # Route controllers
β β βββ models/ # MongoDB models
β β βββ routes/ # API routes
β β βββ middleware/ # Custom middleware
β β βββ config/ # Configuration files
β βββ package.json
βββ README.md
// Accurate nutrition calculation with proper rounding
const mealTotals = meal.foods?.reduce((totals, { food, quantity }) => ({
calories: totals.calories + (food.calories * quantity),
protein: Math.round((totals.protein + food.protein * quantity) * 10) / 10,
carbs: Math.round((totals.carbs + food.carbs * quantity) * 10) / 10,
fat: Math.round((totals.fat + food.fat * quantity) * 10) / 10
}), { calories: 0, protein: 0, carbs: 0, fat: 0 });// Save meal to MongoDB
const handleMealLogged = async (meal: Omit<Meal, 'id' | 'name'>) => {
try {
await createMeal(mealData); // Save to backend
// Update local state
} catch (error) {
// Graceful fallback
}
};- Google OAuth integration
- User profile information
- Authentication tokens
- User association
- Food items with quantities
- Calculated nutrition totals
- Timestamps and metadata
- User association
- Amount and timestamps
- Notes and metadata
- Mobile app development (React Native)
- AI meal recommendations based on user preferences
- Social features (sharing meals, challenges)
- Barcode scanning for food logging
- Integration with fitness trackers
- Advanced analytics and reporting
- Meal prep planning features
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Prithvi - GitHub
- Unsplash for food photography
- React and Node.js communities
- MongoDB for database support
- All open-source contributors
Live Demo: https://github.com/16Prithvi/NutriTrack
Issues & Support: GitHub Issues