Back to Projects

02 Case Study

AI Meal Planning & Grocery Optimization

AI app that turns "what should I eat this week" into a multi-objective optimization — macro goals, retailer preferences, budget, serving counts, and restock cadence, all on one plan.

  • Python
  • JavaScript
  • AI APIs
  • Prompt Engineering
  • SQL

/ Outcomes

  • Multi-objective recommendations across macros, retailer, budget, serving counts, restock
  • Wholesale grocery list generation tied directly to the weekly meal plan
  • Cost-efficiency optimization layered on top of dietary constraints

Overview

Most meal-planning apps stop at “here’s a recipe.” The actual problem is harder: given a weekly macro target, a preferred retailer, a budget, how many people you’re feeding, and what’s already in the pantry — what should you eat, in what order, and what should you buy this Sunday so you cook from a well-stocked kitchen on Tuesday night?

I built an AI app that frames meal planning as a multi-objective optimization, then uses LLM-driven recommendations to navigate the trade-offs between cost, nutrition, variety, and convenience.

Approach

The system handles four problem layers stacked on each other:

  • Recipe selection under macro and variety constraints. The model proposes a week of meals that hits the macro target while keeping enough variety that you don’t eat the same thing twice in three days.
  • Ingredient consolidation. Across the week’s meals, ingredients get rolled up so the grocery list buys once for what’s used multiple times. Wholesale-pack-size-aware so you’re not buying 14 small jars instead of one big one.
  • Budget allocation. Within the chosen retailer’s pricing, the system splits spend across categories (proteins, produce, pantry) and flags when the budget can’t cover the macros — better to surface that early than let it leak into a “why was this so expensive” moment at checkout.
  • Restock cadence. Estimate when each pantry item runs out based on usage rate, so the next week’s plan can prioritize meals that use what’s already there.

What I built

  • Python backend that orchestrates the AI calls, stores meal plans + grocery state in SQL, and exposes a JSON API for the frontend
  • Prompt engineering carefully scoped per layer — recipe selection, consolidation, budget allocation, restock — instead of a single mega-prompt that drifts
  • JavaScript frontend for the weekly view: meals, grocery list, budget bar, pantry restock alerts
  • Constraint solver layer that takes the LLM’s free-form proposal and reconciles it against hard constraints (allergies, retailer availability, pack sizes) before it surfaces to the user

Results

  • The product turns meal planning from a 30-minute weekly chore into a five-minute review-and-edit cycle
  • Cost-efficiency optimization on real grocery prices — measurable savings vs. eyeballing a recipe book
  • Showed me how far prompt engineering can carry a problem when paired with an explicit constraint layer that catches the LLM’s worst guesses before the user sees them

Lessons

LLMs are great at proposing and bad at honoring hard constraints. The wins come from layering: let the model propose freely, then run a deterministic constraint pass before showing the user. The user sees creativity; the system holds the invariants. That separation is the whole pattern for any AI product I’d build now.