Inspiration 💡

Meal planning is usually treated as a simple question: What should we eat? In reality, households must solve several connected problems at the same time:

  • Which meals fit everyone’s dietary needs?
  • What ingredients are already available?
  • What groceries still need to be purchased?
  • Will the shopping basket stay within budget?
  • How can leftovers be reused instead of wasted?
  • Does the plan provide reasonable nutritional coverage?

Many existing tools solve only one part of this process. Recipe apps may suggest meals without considering pantry inventory or grocery prices, while shopping-list apps may recommend ingredients without explaining how those ingredients become complete meals.

RightMeal was inspired by the idea of connecting the entire household food cycle:

Plan meals, use what is already available, buy only what is needed, track what is eaten, and carry leftovers into the next plan.

Our goal was to build a practical, transparent, and local-first planning assistant that helps households make better food decisions without acting as a grocery store or checkout service.

What it does 🍽️

RightMeal is a local-first grocery, meal, pantry, leftover, and nutrition-planning application built with Python and Flet.

Users provide their household information, dietary restrictions, allergies, location, planning dates, preferred variety style, and estimated grocery budget. RightMeal then generates a schedule of real breakfast, lunch, and dinner recipes.

After selecting the meals, RightMeal:

  • Calculates the total ingredient demand
  • Checks the user’s current pantry inventory
  • Uses eligible prepared leftovers before creating new grocery demand
  • Determines which ingredients are still needed
  • Converts ingredient gaps into purchasable package combinations
  • Estimates the grocery basket cost
  • Checks whether the result fits the selected budget
  • Reports nutrition and food-group coverage
  • Explains why meals and grocery items were selected

The basic purchase calculation is:

$$ \text{Purchase Gap} = \max(0, \text{Recipe Demand} - \text{Available Pantry Stock}) $$

Unlike systems that assume users can purchase an exact number of grams, RightMeal selects combinations of real package sizes. Package selection prioritizes the lowest total cost, followed by lower excess quantity and fewer total packages.

Users can also:

  • Record groceries as purchased
  • Add food manually to the pantry
  • Import product or receipt photos
  • Read original recipe directions
  • Mark meals as eaten
  • Track pantry deductions
  • Record prepared leftovers
  • Use leftovers in future plans
  • View meals through a calendar
  • Review planned and actually consumed nutrition

RightMeal does not contain shopping carts, affiliate links, external checkout buttons, or user accounts. Ordinary application data is stored locally.

User Flow 🔄

1. Create a household profile 👨‍👩‍👧‍👦

When users open RightMeal for the first time, they create a household profile containing:

  • Number of adults, children, and seniors
  • Vegetarian preference
  • No-pork preference
  • Lactose-free preference
  • Free-form food allergies
  • City and five-digit U.S. ZIP code

The profile can be updated later. When important household information changes, an existing plan is marked as outdated rather than silently deleted.

2. Add optional API credentials 🔑

The core meal planner works without an API key.

Users may optionally configure:

  • Kroger credentials for nearby product prices
  • Instacart credentials for product matching and prices
  • A BLS API key for higher public-data limits
  • An OpenAI API key for photo imports, receipt analysis, explanations, leftover-note analysis, and fallback cooking directions

3. Configure a new plan 📅

On the Start page, the user selects:

  • A daily or weekly estimated grocery budget
  • Beginning and ending dates
  • Planning ZIP code
  • Preferred planning style

The available planning styles are:

  • High variety: Prioritizes different recipes
  • Balanced: Reduces repetition while allowing practical reuse
  • Meal prep: Allows more batch cooking and planned leftovers

The user then selects Plan my groceries.

4. Check pantry inventory and leftovers 🥫

Before searching for new meals, RightMeal examines:

  • Raw pantry inventory
  • Prepared leftovers
  • Existing purchase records

An eligible prepared leftover may fill a lunch or dinner slot before a new recipe is selected. This prevents already-cooked food from creating duplicate ingredient demand.

5. Filter the recipe catalog 🔍

RightMeal removes recipes that:

  • Conflict with dietary restrictions
  • Match a recorded allergy
  • Do not support the required meal slot
  • Have unresolved core ingredients
  • Lack sufficient reviewed nutrition information
  • Contain invalid portions or structural problems

Dietary restrictions are treated as hard requirements, not preferences that can be ignored to reduce cost.

6. Generate the meal schedule 🗓️

The planner fills breakfast, lunch, and dinner slots across the selected date range.

Recipes are evaluated using factors such as:

  • Nutrition fit
  • Pantry coverage
  • Preparation time
  • Cuisine variety
  • Recipe repetition
  • Repeated proteins or carbohydrates
  • Estimated package-level grocery cost

RightMeal uses a deterministic, budget-aware bounded beam search. Identical saved inputs produce the same core planning result.

7. Calculate ingredient demand 🧮

After the meal schedule is selected, RightMeal combines the raw ingredient requirements from every meal.

$$ \text{Remaining Need} = \text{Total Meal Requirement} - \text{Pantry Allocation} - \text{Prepared Food Allocation} $$

Food already available in the pantry is allocated first. Meals supplied by prepared leftovers do not deduct the same raw ingredients again.

8. Build the grocery basket 🛒

RightMeal searches the available package offers for each remaining ingredient.

The application selects whole-package combinations and shows:

  • Ingredient name
  • Quantity required
  • Quantity supplied by the pantry
  • Quantity still needed
  • Product or package match
  • Package size
  • Number of packages
  • Store
  • Price source
  • Match confidence
  • Estimated cost

9. Review the planning outcome ✅

A complete and fully priced plan that fits the budget can be saved automatically.

When a complete candidate exceeds the budget, RightMeal displays the observed cost without claiming that it found the mathematically cheapest possible plan.

When required information is missing, RightMeal identifies the blocking ingredient, package, catalog record, or price instead of inventing a value.

RightMeal may also offer an explicitly partial food-coverage plan. However, the user must confirm that the plan is incomplete and that additional food will be required before it can be saved.

10. Review meals and recipes 📖

On the Plan page, users can inspect:

  • Breakfast, lunch, and dinner
  • Serving quantities
  • Recipe ingredients
  • Cooking directions
  • Recipe provenance
  • Dish images
  • Daily nutrition
  • Grocery allocation
  • Pantry contribution
  • Budget status

The Calendar page displays meals on their actual planning dates and shows whether each meal has been eaten.

11. Record grocery purchases 🧾

Users can record purchases by:

  • Selecting Purchased beside a package row
  • Adding pantry food manually
  • Importing a product photo
  • Importing one or more receipt photos

For photo imports, RightMeal extracts visible information and asks the user to review the food match, amount, package, price, and destination before saving it.

Confirmed purchases update both pantry inventory and current-plan purchase progress.

12. Cook and track a meal 👨‍🍳

When the user marks a normal meal as eaten, RightMeal:

  • Records the eaten status
  • Deducts the required raw ingredients from the pantry
  • Prevents the same meal from deducting ingredients twice
  • Asks whether any food remains

Batch meals and meals created from existing leftovers follow separate inventory rules to avoid double counting.

13. Record prepared leftovers 📦

The user can record leftovers using:

  • An overall remaining percentage
  • Different percentages for individual meal components
  • An optional written note

A leftover record includes:

  • Source recipe
  • Remaining food quantity
  • Remaining serving estimate
  • Preparation date
  • Suggested use-by date
  • Notes
  • Current reservation status

14. Use leftovers in a future plan ♻️

When another plan is generated, RightMeal checks prepared leftovers before assigning new lunch or dinner recipes.

A suitable leftover can fill a meal slot when it is still available, within its suggested use period, and large enough to provide a meaningful portion of the meal.

15. Review nutrition 📊

RightMeal tracks planned and consumed values for:

  • Calories
  • Protein
  • Fiber
  • Calcium
  • Iron
  • Potassium
  • Vitamin A
  • Vitamin C
  • Vitamin D
  • Folate
  • Magnesium
  • Zinc

It also reports coverage across six general food groups.

16. Generate the next plan 🔁

The next plan begins with the household’s updated information:

  • Remaining pantry inventory
  • Recorded grocery purchases
  • Prepared leftovers
  • Dietary restrictions
  • Household profile

The complete user cycle is:

$$ \text{Plan} \rightarrow \text{Shop} \rightarrow \text{Cook} \rightarrow \text{Track} \rightarrow \text{Reuse} \rightarrow \text{Plan Again} $$

How we built it 🛠️

RightMeal was built primarily with Python and Flet. We separated the application into several layers so that the planning engine, storage system, external services, and user interface could be developed and tested independently.

Recipe data pipeline

The source recipe collection is stored in Markdown files. A development-time compiler processes these files and creates a structured JSON recipe index.

The compiler extracts and validates:

  • Recipe names
  • Serving sizes
  • Meal categories
  • Ingredient quantities
  • Measurement units
  • Cooking directions
  • Recipe images
  • Dietary metadata
  • Ingredient roles
  • Nutrition information
  • Source-file provenance

Recipes with unresolved core ingredients or insufficient reviewed nutrition data are not automatically used by the planner.

Current project data 📦

RightMeal combines a reviewed food catalog, a large recipe corpus, compiled runtime data, and offline recipe imagery.

Data set Current size Runtime role
Food catalog 72 foods Nutrition, dietary metadata, package options, prices, pantry, and matching
Seed catalog 53 foods Base reviewed catalog and local price fallback
Reviewed extended catalog 19 foods Additional reviewed foods, including USDA-assisted entries
Compiled recipe index 408 recipes Runtime recipe catalog
Auto-plannable recipes 99 recipes 24 breakfast recipes and 75 lunch/dinner recipes
Bundled finished-dish images 137 files Offline recipe-card imagery when available

These figures represent the current repository and may grow as additional foods and recipes are reviewed.

Planning engine

The planner applies dietary and data-validation gates before scoring recipes.

Eligible recipes are evaluated based on nutrition, pantry usage, preparation time, variety, repetition, and cost. A bounded beam search fills meal slots chronologically while retaining several promising candidate schedules.

Ingredient demand is repriced as the schedule grows because adding a meal can cause the grocery basket to cross a package boundary.

Package optimization

For every ingredient gap, RightMeal uses deterministic optimization to select a combination of available packages.

The package-selection order is:

  1. Lowest total cost
  2. Lowest excess quantity
  3. Fewest packages
  4. Stable package-offer ordering

This allows the planner to compare meal schedules using realistic purchasable quantities rather than idealized ingredient prices.

Pantry and leftover accounting

Raw pantry food and prepared leftovers are stored separately.

Raw pantry items can be consumed when a normal meal is prepared. Prepared leftovers represent food that has already been cooked, so using one does not create a second raw ingredient deduction.

Purchases, meals, and leftovers use stable identifiers so repeated operations do not accidentally modify inventory twice.

Optional AI services 🤖

Optional OpenAI-powered features can assist with:

  • Product-photo analysis
  • Receipt extraction
  • Basket explanations
  • Leftover-note interpretation
  • Fallback cooking directions

AI output cannot directly select the final plan, bypass dietary filters, or modify inventory without local validation and user review.

Local persistence and reliability

RightMeal uses local JSON stores for the household profile, plan, pantry, purchases, prepared leftovers, photo imports, and cached recipe information.

To protect user data, we implemented:

  • Atomic file replacement
  • Journaled multi-file transactions
  • Rollback after failed operations
  • Crash recovery
  • Stable operation IDs
  • Duplicate-operation protection
  • Revision checks for outdated dialogs
  • Generation tokens that invalidate stale planning requests

The project also contains hundreds of automated tests covering recipe processing, planning, pricing, package optimization, dietary rules, pantry accounting, leftovers, receipt imports, transactions, and interface behavior.

Challenges we ran into 🚧

One of our biggest challenges was connecting meal planning, grocery pricing, nutrition, pantry inventory, purchases, and leftovers without creating inconsistent data.

Inconsistent recipe data

Real recipe files use many different ingredient names, units, formats, and preparation descriptions. We needed to normalize this information while preserving the original recipes and refusing to fabricate missing nutrition or ingredient mappings.

Real package sizes

A recipe may require 600 grams of an ingredient, while available packages may contain 250 grams, 400 grams, or one pound.

The product with the lowest unit price is not always the cheapest combination that actually covers the requirement. We therefore needed package-level optimization rather than simple price-per-unit comparisons.

Budget-aware meal selection

The cost of one recipe depends on ingredients shared with other recipes and on package thresholds. Adding a small ingredient requirement may force the user to purchase an entirely new package.

This meant we could not assign each recipe one fixed cost. The planner needed to repeatedly calculate the cumulative grocery basket during the search.

Pantry and leftover consistency

A meal can use existing pantry food, newly purchased food, batch-prepared food, or an older leftover. Each source requires different accounting rules.

We had to ensure that:

  • Purchases are not added twice
  • Meals do not deduct ingredients twice
  • Leftover meals do not repeat the original raw ingredient deduction
  • Unsafe undo operations are blocked
  • Failed transactions do not partially update stored files

Honest handling of uncertainty

Our planning search is bounded, so failing to find an in-budget plan does not prove that no such plan exists.

Similarly, missing prices, unresolved ingredients, or incomplete nutrition data should not be replaced with invented values. We created explicit outcome types so the application can distinguish between budget issues, missing data, partial plans, and search limitations.

Responsible image and AI processing

Receipt and product photos may contain unclear text, duplicate items, discounts, totals, personal details, and non-food products.

Instead of allowing AI output to change inventory automatically, RightMeal combines structured extraction, local validation, duplicate detection, and a user review step.

Accomplishments that we're proud of 🏆

We are proud that RightMeal connects the complete household food-planning workflow rather than stopping after generating recipes.

Our main accomplishments include:

  • Building a deterministic, budget-aware meal-planning engine
  • Keeping every planned meal traceable to a real source recipe
  • Enforcing dietary restrictions before optimization
  • Creating grocery demand directly from selected recipes
  • Accounting for pantry inventory before recommending purchases
  • Optimizing realistic combinations of whole packages
  • Preserving store, product, price-source, and confidence information
  • Supporting manual, product-photo, and receipt-based purchases
  • Tracking prepared meals and pantry deductions safely
  • Carrying leftovers into future plans
  • Reporting explicit outcomes when a plan cannot be completed
  • Protecting local data with transactions, rollback, and crash recovery
  • Creating a large network-free automated test suite

The current project includes 408 source recipes, 99 auto-plannable recipes, 72 reviewed catalog foods, 137 bundled dish images, detailed planning logic, and extensive tests across the application’s core systems.

What we learned 📚

We learned that realistic meal planning is not just a recipe-generation problem. It is an inventory, optimization, nutrition, pricing, and data-integrity problem.

Some of our most important lessons were:

  • Grocery packages cannot be treated as infinitely divisible quantities
  • Pantry food must be included before calculating new purchases
  • Prepared leftovers are different from raw pantry inventory
  • Dietary restrictions should be enforced as hard rules
  • Nutrition results are only reliable when ingredient mappings are reviewed
  • One meal does not have a fixed cost because ingredients and packages are shared
  • AI output should be treated as unverified input rather than trusted application state
  • Repeated clicks and failed operations must not duplicate purchases or deductions
  • Bounded algorithms should communicate their limitations honestly
  • Missing information is better reported clearly than replaced with a convincing guess

We also learned the importance of traceability. Users should be able to understand where a recipe, ingredient, package, price, and planning decision came from.

What's next for RightMeal 🚀

Our next steps are focused on expanding coverage, improving usability, and supporting more real-world households.

Planned improvements include:

  • Expanding the reviewed food catalog
  • Increasing the number of auto-plannable recipes
  • Supporting additional dietary patterns
  • Adding broader retailer and regional price coverage
  • Improving ingredient and product matching
  • Improving mobile and desktop packaging
  • Adding clearer nutrition visualizations
  • Strengthening accessibility and onboarding
  • Adding more household and serving customization
  • Improving expiration-date tracking
  • Prioritizing ingredients that may expire soon
  • Supporting more countries, currencies, and measurement systems
  • Adding optional encrypted credential storage
  • Testing the application with real households
  • Measuring estimated budget savings and reduced food waste

In the future, RightMeal could also learn from confirmed household behavior, such as frequently selected meals, disliked ingredients, commonly wasted foods, seasonal prices, and preferred preparation times.

Our long-term vision is to help households answer three connected questions:

  1. What should we eat?
  2. What do we actually need to buy?
  3. How can we stay within budget while wasting less food?

Built With

Share this project:

Updates

Submission history