A personalised meal plan generator built around the Mifflin-St Jeor TDEE equation. Enter your stats and activity level, and the app calculates your daily calorie target and assembles a randomised meal plan split across up to four meal slots — served through a clean Tailwind CSS web interface backed by a Flask API.
- The user submits weight, height, gender, age, meals-per-day, and activity level via the web form
- The Flask API computes BMR using the Mifflin-St Jeor formula, then multiplies by the activity factor to get TDEE
- The calorie budget is divided across meal slots (e.g. 35/25/20/20 for a 4-meal split)
- For each slot, the planner shuffles the corresponding food database and picks the item(s) whose calorie count is closest to the slot's budget
- The assembled plan is returned as JSON and rendered in the browser without a page reload
- Mifflin-St Jeor BMR — gender-corrected formula (male: +5, female: −161) applied before activity scaling
- Flexible meal splits — 1, 2, 3, or 4 meals per day, each with its own calorie proportion
- Randomised selection — food database is shuffled on every request so plans vary day to day
- Single-page UI — Tailwind CSS form, XHR request, results rendered dynamically without reload
- Modular food data — breakfast, main dishes, and snacks in separate modules; swap or extend without touching logic
- Backend: Python 3, Flask
- Frontend: HTML, Tailwind CSS (CDN), vanilla JS (XHR)
- Algorithm: Mifflin-St Jeor TDEE, greedy closest-calorie meal picker
tdee-meal-planner/
├── app.py # Flask app — routes and request handling
├── bmr.py # Person class — BMR and TDEE calculation
├── generator.py # Diet plan logic — calorie splitting and meal selection
├── data/
│ ├── breakfast.py # Breakfast food database
│ ├── maindishes.py # Lunch and dinner food database
│ └── snacks.py # Snack food database
└── templates/
└── index.html # Single-page frontend
1. Clone the repo
git clone https://github.com/candtk/tdee-meal-planner.git
cd tdee-meal-planner2. Install dependencies
pip install flask3. Run
python app.pyNavigate to http://localhost:5000 and fill in your stats.
MIT
