Most meal-planning applications begin with the wrong question.
They ask:
“What do you want to eat?”
That sounds reasonable.
But real life is rarely that simple.
A person opens the refrigerator and finds half a tomato, three eggs, some cooked rice, spinach, onions, a piece of chicken, and a bottle of sauce. The pantry contains pasta, flour, beans, canned tomatoes, spices, and perhaps something that has been sitting there long enough that nobody remembers when it was purchased.
The problem isn't necessarily a lack of food.
The problem is that the food already exists, but the intelligence required to turn it into meals doesn't.
This creates an interesting software problem.
What if we built a system that didn't primarily recommend meals based on recipes?
What if it started with reality?
What do I already own?
From there, the system could determine:
- what meals can be prepared immediately,
- what meals require only one or two additional ingredients,
- what ingredients are approaching expiration,
- which ingredients can be reused across several meals,
- how many people can be fed,
- how much food is likely to remain,
- and what should be purchased next.
This is not simply a recipe recommendation system.
It is an inventory intelligence engine for food.
And that distinction changes everything.
The Refrigerator Is an Unstructured Database
Think about the average kitchen.
There is no database.
There is no API.
There is no schema.
There is no transaction log.
There is simply food.
A person might say:
“I have some chicken.”
But software needs more information.
How much?
Cooked or raw?
Frozen or refrigerated?
When was it purchased?
When does it expire?
Is it already allocated to another meal?
Can it be consumed safely?
The first engineering challenge therefore becomes food inventory modeling.
A basic inventory record might look like this:
{
"name": "chicken breast",
"quantity": 500,
"unit": "grams",
"state": "raw",
"location": "freezer",
"purchased_at": "2026-09-18",
"expires_at": "2026-10-15"
}
But this still isn't enough.
Food is contextual.
Consider rice.
Rice
could mean:
2 kg uncooked rice
or:
3 cups cooked rice
Those are fundamentally different resources.
So the system needs to understand food states.
Ingredient
│
├── Raw
├── Cooked
├── Frozen
├── Thawed
└── Prepared
This is where the application begins looking less like a recipe app and more like an inventory management platform.
The Core Idea
The system can be modeled around four major components:
┌────────────────────┐
│ Kitchen Inventory │
└─────────┬──────────┘
│
▼
┌────────────────────┐
│ Ingredient Engine │
└─────────┬──────────┘
│
▼
┌────────────────────┐
│ Meal Planning Engine│
└─────────┬──────────┘
│
┌─────────────┼─────────────┐
▼ ▼ ▼
Meal Plan Shopping List Waste Alerts
The inventory tells us what exists.
The ingredient engine understands those resources.
The meal planner determines what can be made.
The shopping system fills the gaps.
The waste system protects ingredients from being forgotten.
This creates a feedback loop.
Buy Food
↓
Inventory
↓
Cook
↓
Inventory Changes
↓
Meal Planning
↓
Shopping
↓
Buy Food
The kitchen becomes a continuously changing state.
Step One: Building the Ingredient Inventory
The most important database table might be surprisingly simple.
CREATE TABLE pantry_items (
id UUID PRIMARY KEY,
user_id UUID NOT NULL,
ingredient_id UUID NOT NULL,
quantity DECIMAL NOT NULL,
unit VARCHAR(30) NOT NULL,
state VARCHAR(30),
storage_location VARCHAR(30),
purchased_at TIMESTAMP,
expires_at TIMESTAMP
);
But manually entering every ingredient is terrible UX.
Nobody wants to type:
Tomatoes
Quantity: 4
Unit: pieces
Purchased: yesterday
Expiration: next week
for every shopping trip.
Therefore, input becomes a major engineering problem.
We could support several methods.
Manual Entry
The simplest approach.
Users type:
3 eggs
500g chicken
2 onions
1kg potatoes
The system parses the input.
Barcode Scanning
A barcode can identify packaged products.
Barcode
↓
Product Database
↓
Ingredient Mapping
↓
Inventory Entry
Receipt Scanning
This becomes significantly more interesting.
A receipt can be converted into structured inventory.
RECEIPT
--------------------------------
Chicken Breast K45.00
Rice 2kg K38.00
Tomatoes K15.00
Eggs 12 K42.00
--------------------------------
OCR extracts the text.
An entity recognition system identifies ingredients.
The inventory engine then creates records.
Natural Language
We can also allow:
“I bought two kilos of potatoes, a dozen eggs and half a kilo of chicken.”
The system transforms that sentence into structured inventory.
This is where an AI layer becomes useful.
But AI should not become the database.
The AI interprets.
The deterministic system stores.
Step Two: Normalize Food
Humans use inconsistent language.
One person says:
tomato
Another says:
tomatoes
Another:
fresh tomatoes
Another:
Roma tomatoes
The system needs an ingredient ontology.
For example:
Tomato
├── Roma tomato
├── Cherry tomato
├── Beefsteak tomato
└── Canned tomato
But we shouldn't normalize everything into one ingredient.
Canned tomatoes are not interchangeable with fresh tomatoes in every recipe.
Therefore, ingredients need semantic relationships.
fresh tomato
│
├── substitute → canned tomato
└── related → tomato paste
This creates a graph.
And suddenly meal planning becomes a graph-search problem.
Step Three: Represent Recipes as Requirements
A recipe isn't just text.
It is a set of requirements.
Imagine a simple chicken rice bowl.
Chicken Rice Bowl
Chicken 250g
Rice 200g
Onion 1
Tomato 2
Oil 10ml
Salt 2g
We can represent it as:
{
"meal": "Chicken Rice Bowl",
"servings": 2,
"ingredients": [
{"name": "chicken", "quantity": 250, "unit": "g"},
{"name": "rice", "quantity": 200, "unit": "g"},
{"name": "onion", "quantity": 1, "unit": "piece"},
{"name": "tomato", "quantity": 2, "unit": "piece"},
{"name": "oil", "quantity": 10, "unit": "ml"}
]
}
Now the system can compare this requirement against inventory.
Suppose the user owns:
Chicken: 500g
Rice: 1kg
Onion: 3
Tomato: 1
Oil: 500ml
The meal is almost possible.
Only one tomato is missing.
This creates an important concept:
Meal Completeness
We can calculate:
available requirements / total requirements
For example:
Chicken: 100%
Rice: 100%
Onion: 100%
Tomato: 50%
Oil: 100%
Overall:
90%
The system could therefore say:
You can make this meal if you buy one tomato.
That's far more useful than simply recommending a random recipe.
Step Four: Score Meals
Now we need an algorithm.
The system shouldn't simply find meals that are technically possible.
It should find meals that make sense.
We can define a meal score:
MealScore =
InventoryMatch
+ ExpirationPriority
+ NutritionalFit
+ PreferenceScore
+ CostEfficiency
- MissingIngredients
- RepetitionPenalty
Each component represents a different dimension.
Inventory Match
How much of the recipe already exists?
0 → nothing available
1 → everything available
Expiration Priority
Suppose spinach expires tomorrow.
A spinach-based meal should receive a higher score.
days_until_expiration = 1
might produce:
expiration_priority = 0.95
While something expiring in three weeks might produce:
expiration_priority = 0.1
The engine therefore becomes proactive.
Instead of asking:
“What should I eat?”
It can say:
“You should probably use these ingredients soon.”
Step Five: Minimize Food Waste
This is where the system becomes genuinely interesting.
Imagine the inventory:
1 avocado
3 tomatoes
half an onion
250g spinach
2 eggs
400g chicken
The naive system might generate five unrelated meals.
That could actually increase waste.
A smarter system thinks in sequences.
For example:
Monday
Chicken and spinach rice.
Uses:
250g chicken
150g spinach
rice
onion
Tuesday
Chicken tomato pasta.
Uses:
150g chicken
2 tomatoes
onion
Wednesday
Egg and spinach toast.
Uses:
2 eggs
remaining spinach
1 tomato
Now ingredients are deliberately reused.
This is cross-meal optimization.
The objective isn't:
Find the best meal.
It is:
Find the best sequence of meals given the inventory.
That's a much harder problem.
Meal Planning Is an Optimization Problem
Suppose we have:
Ingredients = I
Meals = M
Days = D
We want to select meals that maximize utility.
Conceptually:
maximize:
food_utilization
+ preference_satisfaction
+ nutritional_balance
+ expiration_reduction
while minimizing:
shopping_cost
+ food_waste
+ preparation_time
+ ingredient_repetition
This starts resembling operations research.
We can formulate binary variables:
x(m,d) = 1
if meal m is selected for day d.
Then constraints can be introduced.
For example:
One dinner per day.
Σ x(m,d) = 1
We can also enforce inventory constraints:
total ingredient consumption <= available quantity + purchased quantity
And dietary constraints:
protein >= minimum requirement
The problem could be solved using:
- integer linear programming,
- constraint programming,
- dynamic programming,
- heuristic optimization,
- genetic algorithms,
- simulated annealing,
- or a hybrid approach.
This is where meal planning becomes a serious engineering project.
Traditional meal planning often works like this:
Choose recipes
↓
Generate shopping list
↓
Buy everything
Our system reverses the relationship.
Inventory
↓
Find possible meals
↓
Identify missing ingredients
↓
Determine which purchases unlock the most meals
↓
Generate shopping list
That difference matters.
Suppose buying one onion unlocks five meals.
Buying a specialty ingredient unlocks one.
The system should understand the difference.
We can define:
IngredientValue =
meals_unlocked
/ purchase_cost
An onion might therefore have enormous planning value.
A rare ingredient might have low value.
The shopping list becomes an optimization system.
The “One Purchase Unlocks Many Meals” Algorithm
Imagine:
Meal A requires:
chicken + rice + tomato
Meal B requires:
chicken + pasta + tomato
Meal C requires:
eggs + tomato + spinach
The user owns everything except tomatoes.
One purchase unlocks three meals.
The engine can say:
Buying tomatoes completes three meals already compatible with your inventory.
This is much more intelligent than:
Add tomatoes to shopping list.
The system understands consequence.
Ingredient Substitution
Real kitchens are messy.
You may have:
beans
but the recipe asks for:
chickpeas
Can they substitute?
Sometimes.
But substitutions need confidence.
We can maintain a substitution graph:
Ingredient A
│
├── strong substitute
├── moderate substitute
└── weak substitute
For example:
spinach
↓
kale
↓
cabbage
The system can then adjust recipe requirements.
Instead of:
Missing spinach.
It could say:
You don't have spinach, but your kale can work as a substitute.
This is where AI and deterministic food knowledge can cooperate.
Learning the User
The engine should eventually learn.
Suppose the user repeatedly rejects:
fish
and repeatedly selects:
chicken
The system should adapt.
But there's an important distinction between preference and behavior.
The user might love pizza but rarely cook it.
Therefore:
declared preference
isn't the same as:
observed preference
We can maintain both.
{
"ingredient": "chicken",
"declared_preference": 0.8,
"observed_preference": 0.92
}
Over time the recommendation engine becomes personalized.
Time Is an Ingredient Too
Food planning shouldn't only consider food.
It should consider human time.
A person may have:
Monday: 20 minutes
Tuesday: 45 minutes
Wednesday: 15 minutes
Saturday: 90 minutes
The meal planner should understand that.
A complex meal doesn't belong on a night when the user only has fifteen minutes.
So:
MealScore =
food compatibility
+ preference
+ expiration
+ nutrition
+ cost
+ time compatibility
Saturday could therefore receive more complex meals.
Tuesday might prioritize:
one-pan meals
leftovers
quick meals
prepared ingredients
Now the system understands lifestyle.
Leftovers Become First-Class Objects
Most recipe applications treat a meal as finished when it is cooked.
Our system shouldn't.
If the user prepares:
4 servings of chicken stew
and eats one:
3 servings remain
Those leftovers enter inventory.
This changes the planning graph.
Tomorrow's meal might use:
leftover chicken stew
+ rice
The system therefore tracks prepared food.
Raw Ingredient
↓
Cooking
↓
Prepared Meal
↓
Leftover Inventory
↓
Future Meal
This is effectively a transformation pipeline.
Food Has a Lifecycle
We can model food like a state machine.
PURCHASED
↓
STORED
↓
OPENED
↓
PARTIALLY_USED
↓
COOKED
↓
LEFTOVER
↓
CONSUMED
Or:
PURCHASED
↓
EXPIRING_SOON
↓
EXPIRED
The system can monitor transitions.
For example:
Spinach
expires tomorrow
could trigger:
Your spinach is approaching its expected use-by window. Here are three meals that use most of it.
This is proactive software.
The AI Layer
AI is useful, but it should not control everything.
A large language model can help with:
- understanding natural-language inventory,
- parsing receipts,
- identifying ingredients,
- generating recipe variations,
- explaining substitutions,
- understanding user preferences,
- generating cooking instructions.
But deterministic algorithms should handle:
- inventory quantities,
- expiration calculations,
- nutritional calculations,
- shopping totals,
- constraints,
- meal scheduling,
- food consumption,
- transaction history.
This separation is important.
The AI should not decide whether:
2 eggs - 1 egg = 1 egg
That's database logic.
AI interprets messy human language.
The core engine maintains reality.
Architecture
A production architecture could look like this:
Mobile / Web App
│
▼
API Gateway
│
┌──────────────────┼──────────────────┐
▼ ▼ ▼
Inventory Service Meal Service User Service
│ │
▼ ▼
Inventory DB Recipe Database
│ │
└──────────┬───────┘
▼
Planning Engine
│
┌──────────┼──────────┐
▼ ▼ ▼
Optimizer AI Layer Nutrition
│
▼
Shopping Engine
A PostgreSQL database could handle transactional data.
Redis could support caching.
A background worker could process:
expiration checks
receipt processing
meal optimization
notifications
And an AI service could handle semantic interpretation.
Event-Driven Inventory
One powerful design is to make inventory event-driven.
Instead of simply changing:
chicken.quantity = 250g
we record events.
PURCHASED 500g chicken
CONSUMED 250g chicken
The current quantity becomes a projection.
500g - 250g = 250g
This creates an audit trail.
Events might look like:
{
"type": "FOOD_CONSUMED",
"ingredient": "chicken",
"quantity": 250,
"unit": "g",
"timestamp": "2026-09-20T18:00:00Z"
}
This architecture gives us something valuable:
history.
The system can learn how quickly a household consumes ingredients.
Predicting Future Consumption
Once enough historical data exists, the engine can estimate consumption.
Suppose the user purchases:
2kg rice
and historically consumes:
500g per week
The system can estimate:
2kg / 500g = approximately 4 weeks
This can influence shopping.
Instead of simply saying:
You're out of rice.
The system eventually says:
Based on your historical usage, your rice is likely to run out in approximately six days.
Now the system is forecasting.
Household Intelligence
The system becomes even more powerful when multiple people use it.
Imagine a household with:
Parent
Partner
Child
Each person has different preferences.
The planner now needs to optimize across everyone.
Meal Utility =
Person A satisfaction
+ Person B satisfaction
+ Person C satisfaction
+ nutritional requirements
+ inventory efficiency
This introduces another interesting problem:
conflict resolution.
One person wants chicken.
Another wants vegetarian food.
A third hates tomatoes.
The system could find meals that satisfy overlapping constraints.
Meal planning becomes a multi-agent optimization problem.
The Hidden Power: Turning Food Into a Resource Graph
At this point, the application is no longer just a recipe app.
It becomes a resource graph.
Chicken
│
┌──────┼──────┐
▼ ▼ ▼
Curry Pasta Rice Bowl
│ │ │
▼ ▼ ▼
Onion Tomato Spinach
Each ingredient connects to potential meals.
Each meal connects to time.
Each meal connects to nutrition.
Each ingredient connects to expiration.
Each purchase connects to cost.
This creates a dynamic graph of the user's kitchen.
And that graph changes every day.
The Interesting Product Experience
Imagine opening the application.
Instead of seeing:
“Here are today's recipes.”
You see:
Your Kitchen
12 ingredients available
3 expiring soon
5 meals available now
2 meals available with one purchase
Then:
Use Soon
Spinach
Tomatoes
Avocado
You Can Cook Tonight
Chicken Rice Bowl
Egg & Spinach Wrap
Tomato Pasta
One Purchase Unlocks
Chicken Tacos
Requires: tortillas
Tomatoes
Tortillas
Milk
The application isn't telling you what food exists in the universe.
It is telling you what you can realistically do with the food you already own.
That is a fundamentally different product.
Building the MVP
I wouldn't start with AI.
I'd start with the deterministic core.
Version 1
Build:
User accounts
+
Inventory
+
Recipes
+
Ingredient matching
+
Basic meal recommendations
+
Shopping list
Version 2
Add:
Expiration tracking
+
Leftovers
+
Ingredient substitutions
+
Meal scheduling
Version 3
Add:
Receipt scanning
+
Barcode scanning
+
Natural language inventory
Version 4
Add:
Personalization
+
Consumption prediction
+
Optimization algorithms
Version 5
Add:
Household planning
+
Advanced nutrition
+
Adaptive shopping
+
Predictive waste reduction
The important thing is to avoid building a giant AI wrapper around recipes.
Build the underlying system.
A Simple Planning Algorithm
A basic recommendation algorithm might look like this:
def score_meal(meal, inventory, preferences):
score = 0
for ingredient in meal.ingredients:
available = inventory.get(ingredient.name, 0)
if available >= ingredient.required:
score += 20
else:
missing = ingredient.required - available
score -= missing * 5
score += preference_score(meal, preferences)
score += expiration_score(meal, inventory)
score += nutrition_score(meal)
return score
Then:
meals = load_candidate_meals()
ranked = sorted(
meals,
key=lambda meal: score_meal(
meal,
inventory,
preferences
),
reverse=True
)
That's enough to demonstrate the concept.
But the real system eventually becomes much more sophisticated.
The Optimization Engine
A more advanced planner could evaluate an entire week.
Suppose:
Inventory = 25 ingredients
Candidate meals = 500
Days = 7
We don't simply select seven independent meals.
We search for a combination.
Meal 1
Meal 2
Meal 3
Meal 4
Meal 5
Meal 6
Meal 7
that maximizes:
inventory utilization
nutrition
preference
expiration reduction
cost efficiency
time compatibility
while minimizing:
waste
shopping
repetition
preparation time
This is where advanced optimization becomes valuable.
You could even experiment with genetic algorithms.
A chromosome could represent:
[meal_12, meal_98, meal_41, meal_17, meal_203, meal_5, meal_88]
The fitness function evaluates the entire weekly plan.
Mutation changes one meal.
Crossover combines two plans.
Selection keeps higher-performing schedules.
The system evolves meal plans rather than simply generating them.
The Bigger Idea
There is something deeper here.
Software often starts from what users want to acquire.
But some of the most useful software can start from what users already possess.
People already have:
- food,
- money,
- time,
- devices,
- documents,
- messages,
- skills,
- energy,
- transportation,
- inventory.
The interesting problem is often not:
“What should I get?”
It is:
“What can I accomplish with what I already have?”
A smart meal planner is a beautiful example of this philosophy.
The refrigerator becomes a dataset.
The pantry becomes an inventory system.
Recipes become executable plans.
Ingredients become resources.
Shopping becomes an optimization problem.
And cooking becomes the execution layer.
Final Architecture
The complete system can eventually look like this:
USER
│
▼
┌─────────────────┐
│ Kitchen Capture │
│ Receipt / Scan │
│ Manual / Voice │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Food Normalizer │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Inventory │
│ Engine │
└────────┬────────┘
│
┌────────┴─────────┐
▼ ▼
Expiration Engine Consumption Model
│ │
└────────┬─────────┘
▼
┌─────────────────┐
│ Meal Candidates │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Optimization │
│ Engine │
└────────┬────────┘
│
┌──────────┼──────────┐
▼ ▼ ▼
Meals Shopping Waste
Plan List Alerts
And that's when the product becomes much more than a recipe application.
It becomes a personal food operating system.
The interesting engineering isn't generating another recipe.
The interesting engineering is understanding the state of a person's kitchen, predicting what they can do with it, optimizing what should happen next, and continuously updating that model as reality changes.
Because the future of smart software isn't always about giving people more choices.
Sometimes it's about looking at what they already have and saying:
You already have enough. Let's figure out what we can build with it.
That is where the real system begins.