Perfect idea ๐ โ having a README will make your project easy to understand and use.
Hereโs a clean README.md for your mockFoodDB nutrition project:
# ๐ Mock Food Nutrition Database
This project provides a **mock food database** in JavaScript with nutritional values for common foods.
It can be used for projects like:
- Diet planning apps ๐ฅ
- Calorie tracking systems ๐ฅ
- Fitness/nutrition dashboards ๐ช
- Demo or testing purposes ๐ฏ
---
## ๐ Project Structure
nutrition-project/ โโโ mockFoodDB.js # Contains the mock food database โโโ README.md # Project documentation
---
## ๐ Database Overview
The `mockFoodDB` is a **JavaScript object** containing food items as keys, and their nutritional values (per 100g) as values.
Each entry has:
- `calories` (kcal)
- `protein` (g)
- `carbs` (g)
- `fat` (g)
Example:
```js
const mockFoodDB = {
'apple': { calories: 52, protein: 0.3, carbs: 14, fat: 0.2 },
'banana': { calories: 89, protein: 1.1, carbs: 23, fat: 0.3 },
'chicken breast': { calories: 165, protein: 31, carbs: 0, fat: 3.6 },
// ... more items
};
โ Fruits (apple, banana, mango, grapes, etc.) โ Vegetables (broccoli, spinach, potato, tomato, etc.) โ Proteins (chicken, salmon, tofu, paneer, beef, etc.) โ Grains & Nuts (rice, oats, quinoa, almonds, peanuts, etc.) โ Dairy (milk, yogurt, cheese, butter, etc.) โ Drinks (coffee, tea, orange juice, smoothies, etc.) โ Sweets (chocolate, cake, cookies, etc.)
- Import or include
mockFoodDB.jsin your project. - Query foods by name to get nutrition details.
Example:
console.log(mockFoodDB['banana']);
// Output:
{
calories: 89,
protein: 1.1,
carbs: 23,
fat: 0.3
}- Add serving size adjustments (e.g., per piece, per cup, per slice).
This project is open-source and free to use for learning and development purposes.
---
๐ Do you want me to also **add usage examples in Node.js / Browser** (like `import` and `require`), so anyone can directly plug this into their project?