An AI-powered nutrition tracking application that makes meal logging effortless through natural language processing. Track your meals, monitor macronutrients, set personalized fitness goals, and receive intelligent insights to achieve your health objectives.
- Natural language input: Simply describe your meal in plain text (e.g., "2 chapatis with dal and rice")
- Automatic nutritional analysis: Powered by OpenAI GPT-4o-mini to extract:
- Calories (kcal)
- Protein (g)
- Carbohydrates (g)
- Fat (g)
- Multi-cuisine support: Recognizes Indian and international dishes
- Date/time tracking: Every meal is logged with precise timestamps
- Real-time tracking: View all meals logged today
- Automatic daily totals: Instant calculation of total calories and macros consumed
- Goal comparison: Visual comparison of consumed nutrients vs. your daily goals
- Color-coded macros: Easy-to-read nutritional breakdown
- On-demand analysis: Click any meal to get AI-powered nutritional feedback
- Context-aware recommendations: Insights consider your active health goals
- Practical suggestions: Get actionable advice on meal improvements
- Smart caching: Insights are stored to save API costs
- Multiple goals: Create and manage multiple nutrition/weight goals
- Comprehensive tracking: Set targets for:
- Current and target weight
- Daily calories
- Macronutrient distribution (protein, carbs, fat)
- Target completion date
- Active goal switching: Only one goal active at a time, easily toggle between goals
- Personalized recommendations: AI calculates optimal daily nutrition based on:
- Height and current weight
- Target weight and timeline
- Daily activity level
- Safe guidelines: Ensures healthy weight loss/gain rates
- Balanced macros: Provides scientifically-backed macronutrient distribution
- Historical view: Review meal history for the past week
- Daily grouping: Meals organized by date with daily totals
- Goal comparison: Track progress against your goals over time
- Visual labeling: Clear "Today" and "Yesterday" markers
- Extended profiles: Store health metrics including:
- Date of birth
- Gender
- Height
- Secure authentication: Powered by Laravel Jetstream with:
- User registration and login
- Password reset
- Email verification
- Two-factor authentication
- Account management
- Backend: Laravel 12 (PHP 8.2+)
- Frontend: Vue 3 + Inertia.js
- Build Tool: Vite
- Styling: Tailwind CSS
- Authentication: Laravel Jetstream with Sanctum
- AI Integration: OpenAI API (GPT-4o-mini)
- Testing: PHPUnit
- Database: SQLite (development), MySQL/PostgreSQL (production)
- PHP 8.2 or higher
- Composer
- Node.js 18+ and npm
- SQLite (for development)
- OpenAI API key (Get one here)
Run the automated setup script:
composer setupThis will:
- Install PHP dependencies via Composer
- Install Node.js dependencies via npm
- Create
.envfile from.env.example - Generate application key
- Run database migrations
- Build frontend assets
If you prefer to run steps individually:
# Install dependencies
composer install
npm install
# Environment setup
cp .env.example .env
php artisan key:generate
# Database setup
php artisan migrate
# Build frontend
npm run buildThis application requires an OpenAI API key for AI-powered features. Each user must configure their own API key:
- Sign up for an OpenAI account at https://platform.openai.com
- Generate an API key from https://platform.openai.com/api-keys
- Add the key to your profile settings in the application
Key environment variables in .env:
APP_NAME="Smart Nutrition Tracker"
APP_URL=http://localhost:8000
DB_CONNECTION=sqlite
# For production, use MySQL/PostgreSQL
QUEUE_CONNECTION=sync
# For production, use redis or databaseRun all development services concurrently:
composer devThis starts:
- PHP development server (http://localhost:8000)
- Queue worker
- Log viewer (Laravel Pail)
- Vite dev server (for hot module replacement)
Or run services individually:
php artisan serve # Backend server
npm run dev # Vite dev server
php artisan queue:listen # Queue worker (if using queues)
php artisan pail # Log viewerOpen your browser and navigate to http://localhost:8000
- Register a new account
- Complete your profile (add height, date of birth, gender)
- Add your OpenAI API key in profile settings
- Create your first goal
- Start logging meals using natural language
Try these example meal descriptions:
- "2 chapatis with dal and mixed vegetables"
- "Grilled chicken breast with brown rice and broccoli"
- "Oatmeal with banana and almonds"
- "Paneer tikka with naan and salad"
- "Protein shake with whey, banana, and peanut butter"
app/
├── Http/Controllers/
│ ├── MealEntryController.php # Meal logging and insights
│ └── GoalController.php # Goal management
├── Models/
│ ├── User.php # User model with health metrics
│ ├── MealEntry.php # Meal entries
│ ├── Goal.php # Nutrition goals
│ └── MealInsight.php # AI-generated insights
resources/js/
├── Pages/
│ ├── Dashboard.vue # Main dashboard
│ ├── History.vue # 7-day history
│ └── Goals/Index.vue # Goal management
└── Components/
├── MealLogModal.vue # Meal entry form
├── InsightModal.vue # AI insights display
├── TodaySummary.vue # Daily totals
├── MealEntryCard.vue # Individual meal card
└── DayHistoryCard.vue # Daily history card
# Development
composer dev # Start all dev services
php artisan serve # Start backend only
npm run dev # Start Vite dev server
# Testing
composer test # Run all tests
php artisan test # Alternative test command
php artisan test --filter TestName # Run specific test
# Database
php artisan migrate # Run migrations
php artisan migrate:fresh # Fresh migration
php artisan migrate:fresh --seed # Fresh migration with seeders
# Code Quality
vendor/bin/pint # Format code with Laravel Pint
# Production
npm run build # Build production assetsFor testing purposes, you can seed meal entries:
php artisan db:seed --class=MealEntrySeederThe application uses PHPUnit for testing with SQLite in-memory database:
composer testTests are organized in:
tests/Feature/- Feature and integration teststests/Unit/- Unit tests
The application uses Inertia.js as a bridge between Laravel and Vue, providing SPA-like behavior without a separate API layer.
- Pages: Each route corresponds to a Vue component in
resources/js/Pages/ - Shared Data: Global data available to all pages via Inertia middleware
- Routing: Laravel routes defined in
routes/web.phprender Vue components
- Authentication: Laravel Jetstream with Sanctum (session-based for web)
- AI Integration: OpenAI API calls made server-side for security
- Queue Support: Can be configured for background jobs (API calls, notifications)
- Middleware: Custom middleware for Inertia request handling
- User API keys are stored encrypted in the database
- All API calls to OpenAI are made server-side
- CSRF protection enabled for all forms
- Rate limiting on API endpoints
- SQL injection protection via Eloquent ORM
- XSS protection via Vue's automatic escaping
Contributions are welcome! Please follow these guidelines:
- 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
Please ensure:
- Code follows Laravel and Vue.js best practices
- All tests pass (
composer test) - Code is formatted with Laravel Pint (
vendor/bin/pint)
This project is open-sourced software licensed under the MIT license.
- Built with Laravel
- UI powered by Tailwind CSS
- AI capabilities by OpenAI
- Authentication scaffolding by Laravel Jetstream
For issues, questions, or suggestions, please open an issue on the GitHub repository.