Complete nutrition tracking app with camera, BMR calculator, and Google Calendar sync. Built for Samsung A15 with Termux support.
| Tab | Purpose | Key Feature |
|---|---|---|
| 📸 Camera | Capture meal photos | Live preview, instant capture |
| 🧮 Calculator | Track macros | Auto calorie calculation |
| 🎯 BMR Calc | Set daily targets | Mifflin St. Jeor equation |
| 📅 Calendar | Sync to Google | Automatic midnight upload |
- ✅ Photography Integration - Take photos of every meal
- ✅ Macro Tracking - Fat, carbs, protein in grams
- ✅ Auto Calorie Calculation - Standard formula (9/4/4 cal/gram)
- ✅ BMR Calculator - Gold standard Mifflin St. Jeor equation
- ✅ Google Calendar API - OAuth 2.0 integration
- ✅ Automatic Midnight Sync - Daily totals uploaded automatically
- ✅ Daily Reset - All entries cleared at midnight (fresh start daily)
- ✅ Retractable Sidebar - Daily summary & today's entries
- ✅ Light/Dark Mode - Easy on the eyes
- ✅ PWA Support - Install like a native app
- ✅ Offline Storage - LocalStorage persistence
- ✅ Responsive Design - Mobile, tablet, desktop
# 1. Install Termux from F-Droid
# Download: https://f-droid.org/en/packages/com.termux/
# 2. Update & Install Node.js
pkg update && pkg upgrade -y
pkg install nodejs git -y
termux-setup-storage
# 3. Navigate to project
cd ~/storage/shared/projects/nutritrack
# 4. Install dependencies
npm install
# 5. Run the app
npm run dev
# 6. Open Chrome browser
# Go to: http://localhost:5173# 1. Clone repository
git clone <your-repo-url>
cd nutritrack
# 2. Install dependencies
npm install
# 3. Run development server
npm run dev
# 4. Open browser
# Go to: http://localhost:5173| Document | Description |
|---|---|
| QUICK_START.md | ⭐ Start here! Complete setup guide |
| FEATURE_OVERVIEW.md | Detailed feature documentation |
| BMR_CALCULATOR_GUIDE.md | BMR calculator science & usage |
| AUTO_SYNC_FEATURE.md | Automatic midnight sync explained |
| TERMUX_SETUP.md | Full Termux installation guide |
| ANDROID_BUILD.md | APK building instructions |
| GOOGLE_CALENDAR_SETUP.md | Calendar API configuration |
Uses the Mifflin St. Jeor equation - the gold standard for calorie calculation.
Men: BMR = 10 × weight(kg) + 6.25 × height(cm) - 5 × age + 5
Women: BMR = 10 × weight(kg) + 6.25 × height(cm) - 5 × age - 161
| Level | Multiplier | Description |
|---|---|---|
| Sedentary | 1.2 | Little/no exercise |
| Light | 1.375 | 1-3 days/week |
| Moderate | 1.55 | 3-5 days/week |
| Very Active | 1.725 | 6-7 days/week |
| Extra Active | 1.9 | Daily intense exercise |
- Lose Weight: -500 cal/day (≈1 lb/week)
- Maintain: No adjustment (TDEE)
- Gain Weight: +300 cal/day (lean gain)
-
Get Credentials:
- Go to Google Cloud Console
- Project:
nutritrack-490721 - Create API Key + OAuth Client ID
-
Configure App:
- Open Calendar tab
- Enter Client ID & API Key
- Click "Save Configuration"
- Click "Sign In with Google"
-
Enable Auto-Sync (Optional):
- Toggle "Automatic Midnight Sync" ON
- Daily totals upload at midnight
- App must be running
Add these to Google Cloud Console:
http://localhost:5173http://127.0.0.1:5173com.nutritrack.app:/oauth2redirect(for APK)
Advantages:
- ✅ No building required
- ✅ Uses less memory
- ✅ Updates instantly
- ✅ Camera works perfectly
- ✅ Works offline
How to Install:
- Run
npm run dev - Open in Chrome
- Menu (⋮) → "Add to Home screen"
- Done!
Advantages:
- ✅ Full native experience
- ✅ Better performance
- ✅ Can distribute via file
How to Build:
npm run build # Build web app
npm run cap:sync # Sync to Capacitor
# Transfer to PC and build in Android StudioSee ANDROID_BUILD.md for details.
- React 18 - UI framework
- TypeScript - Type safety
- Tailwind CSS v4 - Styling
- Vite - Build tool
- Radix UI - Accessible components
- Lucide React - Icons
- next-themes - Dark mode
- Sonner - Toast notifications
- Google Calendar API - Calendar integration
- Google Identity Services - OAuth 2.0
- LocalStorage - Client-side persistence
- MediaDevices API - Camera access
- Capacitor - Native app wrapper
- Service Worker - PWA offline support
- Vite - Fast HMR & builds
nutritrack/
├── public/
│ ├── icon.svg # App icon
│ ├── manifest.json # PWA manifest
│ └── sw.js # Service worker
├── src/
│ ├── app/
│ │ ├── components/
│ │ │ ├── camera.tsx
│ │ │ ├── calculator.tsx
│ │ │ ├── bmr-calculator.tsx ⭐ NEW
│ │ │ ├── nutrition-sidebar.tsx
│ │ │ ├── google-calendar-setup.tsx
│ │ │ └── ui/ # Radix UI components
│ │ ├── pages/
│ │ │ └── home.tsx # Main page
│ │ ├── types/
│ │ │ └── nutrition.ts
│ │ ├── utils/
│ │ │ ├── google-calendar.ts
│ │ │ └── date-helpers.ts ⭐ NEW
│ │ ├── App.tsx
│ │ ├── providers.tsx
│ │ └── routes.ts
│ ├── styles/
│ │ ├── index.css
│ │ ├── tailwind.css
│ │ └── theme.css
│ └── main.tsx
├── index.html
├── capacitor.config.json
├── package.json
├── vite.config.ts
└── Documentation/ # All .md files
Input: Age, gender, height, weight, goal, activity
Output: Target calories & macros
Example: 2,400 cal/day (180g P, 270g C, 75g F)
Breakfast:
1. Camera → Take photo
2. Calculator → Enter macros
3. Sidebar → Check progress (312/2,400 cal)
Repeat for lunch, snacks, dinner...
End of day:
- Total: 2,380 cal (99% of target)
- Protein: 175g (97%)
- Carbs: 268g (99%)
- Fat: 73g (97%)
App running in background:
→ 12:00 AM hits
→ Data syncs to Google Calendar
→ Daily totals reset to 0
→ Ready for new day!
"nutrition-entries" // All entries (array)
"google-calendar-config" // API credentials (object)
"auto-sync-enabled" // Auto-sync preference (boolean)
"last-calendar-sync" // Last sync date (string)
"theme" // Light/dark mode (string){
id: "1712345678901",
name: "Grilled Chicken",
fat: 5, // grams
carbs: 0, // grams
protein: 35, // grams
calories: 180, // auto-calculated
photo: "data:image/...",
timestamp: 1712345678901,
date: "2026-04-08" // YYYY-MM-DD
}- Store all data locally on your device
- Use OAuth 2.0 for Google Calendar
- No external servers or databases
- No analytics or tracking
- No ads
- Don't send data to third parties
- Don't collect personal information
- Don't track your activity
- Don't require account creation
- You own your data
- Can delete anytime (clear localStorage)
- Can revoke Google Calendar access
- Can export data from localStorage
npm run dev # Start dev server
npm run build # Build for production
npm run preview # Preview production build
# Capacitor commands
npm run cap:init # Initialize Capacitor
npm run cap:add # Add Android platform
npm run cap:sync # Sync web → native
npm run cap:open # Open Android Studio- Node.js: 18+ recommended
- npm: 9+ recommended
- Browser: Chrome/Edge for best PWA support
- Android Studio: For APK builds (optional)
- Daily Calories - Total caloric intake
- Macronutrients - Fat, carbs, protein (grams)
- Meal Photos - Visual food diary
- BMR/TDEE - Metabolic rate calculations
- Weekly Trends - Via Google Calendar export
- Goal Progress - Target vs actual comparison
This is a personal project, but feel free to:
- Fork and customize
- Report issues
- Suggest features
- Share improvements
MIT License - Feel free to use and modify!
- Google Calendar API - Calendar integration
- Bodybuilding.com - Mifflin St. Jeor equation reference
- Radix UI - Accessible components
- Tailwind CSS - Styling framework
- Mifflin St. Jeor equation research
- Nutrition science guidelines
- PWA best practices
-
Check Documentation:
- Start with QUICK_START.md
- Review FEATURE_OVERVIEW.md
-
Common Issues:
- See troubleshooting in QUICK_START.md
- Check FIXES_APPLIED.md for recent updates
-
Google Calendar:
- Detailed setup: GOOGLE_CALENDAR_SETUP.md
- Auto-sync: AUTO_SYNC_FEATURE.md
Your complete nutrition tracking solution is ready:
# Quick start:
npm install
npm run dev
# Open http://localhost:5173Happy tracking! 🚀📸🥗
Made with ❤️ for Samsung A15 + Termux
======= # NutriTrack: Photography & Nutrition CalculatorNutriTrack is a streamlined utility designed to help users track their daily nutritional intake through a combination of visual logging and manual calculation.
- Camera Integration: Capture photos of meals directly within the app to maintain a visual food diary.
- Nutrition Calculator: Input specific macronutrients (Fat, Carbs, Protein) to automatically calculate total calories.
- Daily Summary: View a real-time breakdown of your daily caloric and macronutrient totals.
- Google Calendar Sync (Beta): Includes an integration framework to sync daily nutrition totals with your Google Calendar.
Install the provided APK on your Android device. Ensure that you allow permissions for camera access to enable photography features.
For personalized targets, it is recommended to use an external professional resource:
- Visit the Bodybuilding.com Nutrition Center to use their macronutrient/macromolecule calculator.
Note on Implementation: The Google Calendar integration is currently a secondary feature. It has not yet been fully tested for all environments and is not a requirement for implementation or core tracking.
- Manual Entries: Enter macros in the Calculator tab and hit Add Entry to update your Daily Summary.
- Scannability: Use the side drawer to quickly check your progress against your daily limits.
- Reset: The total resets at midnight every night
