Skip to content
ayushxx01Public

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

๐Ÿณ Meal Prepper

A local-first AI meal planner built for real-life PG kitchens.

Meal Prepper helps you decide what to cook with what you already have.

Living in a PG often means having limited ingredients, limited cooking equipment, and very little motivation to figure out what to make. When deciding what to cook becomes a hassle, ordering food becomes the easier option.

Meal Prepper reduces that decision fatigue by generating meals based on available ingredients, cooking tools, and meal type โ€” while also providing deterministic nutrition information.


๐Ÿ’ก The Problem

When living in a PG, cooking often looks like:

What ingredients do I have?
        โ†“
What can I make with them?
        โ†“
Do I have the equipment required?
        โ†“
How much should I use?
        โ†“
Fuck it, let's order.

This becomes even more important when trying to follow a diet or hit a daily protein goal.

Meal Prepper turns this into:

Ingredients + Quantities + Tools + Meal Type
                    โ†“
                  Gemma
                    โ†“
              Feasible Recipe
                    โ†“
             Nutrition Engine
                    โ†“
             Recipe + Nutrition

โœจ Features

  • ๐Ÿฅ˜ Generate meals based on available ingredients
  • โš–๏ธ Support different ingredient units such as grams, pieces, and ml
  • ๐Ÿ”ง Consider available cooking tools
  • ๐Ÿณ Support different meal types:
    • Breakfast
    • Lunch
    • Snacks
    • Dinner
  • ๐Ÿค– Local AI-powered recipe generation using Gemma
  • ๐Ÿ“ด Works offline once the local model and application are available
  • ๐Ÿ”’ Ingredient and meal data can remain local
  • ๐Ÿงฎ Deterministic nutrition calculation using a local nutrition database
  • ๐Ÿ’ช Protein information for generated meals
  • โœ… Recipe validation to prevent impossible recipes
  • ๐Ÿ“Š Nutrition calculated from ingredient quantities rather than relying on the LLM's arithmetic

๐Ÿง  How It Works

Meal Prepper separates AI reasoning from deterministic application logic.

1. User Input

The user provides:

Ingredients:
- Rice: 200g
- Eggs: 3 pieces
- Onion: 1 piece

Meal:
Lunch

Tools:
- Pan
- Stove
- Knife

2. Local Gemma

The input is sent to a locally running Gemma model through Ollama.

Gemma determines a suitable recipe while considering:

  • Available ingredients
  • Available quantities
  • Meal type
  • Available cooking tools

Gemma returns a structured recipe containing ingredient quantities and cooking steps.

3. Recipe Validation

The application validates the generated recipe.

It checks that:

  • Ingredients actually exist in the user's inventory
  • The recipe doesn't use more than the available quantity
  • Required cooking tools are available
  • Unsupported or missing ingredients aren't silently introduced
  • Cooking steps are compatible with the available equipment

Invalid recipes are rejected instead of being blindly shown to the user.

4. Unit Conversion

Nutrition data is stored primarily on a per-100g basis.

Ingredients already provided in grams can be used directly.

Supported piece-based ingredients can be converted using explicit application-level conversion data.

For example:

1 egg โ‰ˆ 50g
1 onion โ‰ˆ 100g

These are approximate MVP conversions and are not generated by the LLM.

Unsupported conversions are rejected rather than guessed.

5. Nutrition Calculation

The application uses the local nutrition.json dataset to calculate:

  • Calories
  • Protein
  • Carbohydrates
  • Fat

For example:

per-100g nutrition ร— ingredient weight / 100

The nutrition calculator is deterministic and does not rely on Gemma for nutritional arithmetic.


๐Ÿ—๏ธ Architecture

                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚   Web UI      โ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                             โ–ผ
                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚ Node.js API   โ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                             โ–ผ
                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚  Meal Flow    โ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ–ผ                             โ–ผ
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚ Local Gemma   โ”‚             โ”‚ Recipe         โ”‚
      โ”‚ via Ollama    โ”‚             โ”‚ Validation     โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚                             โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ–ผ
                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚ Unit          โ”‚
                     โ”‚ Conversion    โ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ–ผ
                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚ Nutrition     โ”‚
                     โ”‚ Calculator    โ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ–ผ
                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚ nutrition.jsonโ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงฐ Tech Stack

  • Node.js โ€” application server and backend logic
  • Ollama โ€” local LLM runtime
  • Gemma โ€” local recipe reasoning
  • JavaScript โ€” application logic
  • HTML/CSS/JavaScript โ€” minimal frontend
  • JSON โ€” local nutrition database
  • ICMR-NIN IFCT 2017 โ€” primary nutrition data source

๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ nutrition.json
โ”œโ”€โ”€ nutritionCalculator.js
โ”œโ”€โ”€ recipeGenerator.js
โ”œโ”€โ”€ mealFlow.js
โ”œโ”€โ”€ server.js
โ”œโ”€โ”€ unitConversions.json
โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ app.js
โ”‚   โ””โ”€โ”€ styles.css
โ”œโ”€โ”€ test/
โ”‚   โ”œโ”€โ”€ nutritionCalculator.test.js
โ”‚   โ”œโ”€โ”€ recipeGenerator.test.js
โ”‚   โ””โ”€โ”€ mealFlow.test.js
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐Ÿš€ Running Locally

Prerequisites

Install:

  • Node.js
  • Ollama
  • The required Gemma model

Check Node:

node -v

Check Ollama:

ollama list

Make sure the required Gemma model is available locally.

Start the application

From the project directory:

node server.js

The application runs at:

http://127.0.0.1:3000

Open that address in your browser.


๐Ÿงช Running Tests

Run the complete test suite:

npm test

The tests cover:

  • Nutrition calculations
  • Ingredient lookup
  • Ambiguous ingredients
  • Invalid quantities
  • Unknown ingredients
  • Recipe generation
  • Recipe validation
  • Unit conversion
  • Recipe-to-nutrition integration
  • API behavior

๐Ÿ“ด Why Local AI?

The local-first architecture is intentional.

Offline

PG Wi-Fi can be unreliable, and mobile networks can also become unavailable.

Because the core model runs locally through Ollama, Meal Prepper does not need an internet connection to generate meals once the required software/model is installed.

Privacy

Ingredients, meals, and dietary information can stay on the user's machine rather than being sent to an external AI API.

Free

There is no dependency on paid LLM API calls for the core meal-generation functionality.


๐Ÿ“Š Nutrition Data

The project currently uses nutritional data based primarily on:

Indian Food Composition Tables (IFCT) 2017

Published by:

ICMR โ€” National Institute of Nutrition

Nutrition values are stored on a per-100g edible-portion basis where applicable.

The application intentionally distinguishes between:

  • Raw foods
  • Boiled foods
  • Dry foods
  • Other preparation states

Missing nutritional values are treated as unavailable, not automatically as zero.


๐ŸŽฏ Example

Input:

Ingredients:
- Rice: 200g
- Egg: 3 pieces
- Onion: 1 piece

Meal:
Lunch

Tools:
- Pan
- Stove
- Knife

Possible output:

Egg Fried Rice

Ingredients:
- Rice: 150g
- Egg: 2 pieces
- Onion: 1/2 piece

Steps:
1. Heat the pan.
2. Prepare the onion.
3. Add rice.
4. Add the eggs.
5. Cook until done.

Nutrition:
Calories: ...
Protein: ...
Carbohydrates: ...
Fat: ...

The exact nutrition values are calculated by the application's nutrition engine rather than generated by Gemma.


๐Ÿ”ฎ Future Improvements

Potential future improvements include:

  • Better recipe retry/recovery when validation fails
  • More comprehensive ingredient and unit conversion data
  • Daily protein tracking
  • Meal history
  • Better ingredient input UX
  • Ingredient inventory tracking
  • Meal ranking based on protein/calorie goals
  • More cooking constraints
  • Improved UI
  • Optional workflow orchestration

๐Ÿค Project Philosophy

Meal Prepper is intentionally built around a simple principle:

Let the AI reason. Let deterministic code enforce the rules.

Gemma handles the fuzzy problem of deciding what meal could be made.

The application handles things that should not be guessed:

  • Available ingredients
  • Quantities
  • Equipment constraints
  • Unit conversion
  • Nutrition calculations

This keeps the system useful while avoiding unnecessary reliance on the LLM for things that normal software can handle more reliably.


๐Ÿ“œ License

Add your chosen license here.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages