DEV Community

Cover image for mealmate: a meal planner that can't serve my roommate their allergens
Lagnadeep Samal
Lagnadeep Samal

Posted on

mealmate: a meal planner that can't serve my roommate their allergens

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

What I Built

mealmate is a weekly meal planner for my roommate om, who has food allergies who has food allergies (peanuts, tree nuts and shellfish). Cooking for the two of us used to mean checking every recipe and every label by hand. A vague "it's probably fine" isn't good enough when the stakes are real.

You enter your housemate's allergies, favourite foods, dislikes and cooking time. mealmate plans breakfast, lunch and dinner for each day and makes a printable page with a week grid, recipes, a shopping list, and a "read the label on these" list for packaged items like stock and sauces. It runs as a small web app on your own computer.

Demo

https://drive.google.com/drive/folders/1eMKFDevAiV6uzxoCuBSizH1RcuCls2T9?usp=sharing

The progress log shows the safety layer working. With the demo model it looks like this:

Monday...
  attempt 1 rejected: Pad thai: 'shrimp' is crustacean (+1 more)
  ok on attempt 2
Enter fullscreen mode Exit fullscreen mode

Code

mealmate

A weekly meal planner for a housemate with food allergies. A local open-weight model proposes meals; a plain word-list checker decides whether they are allowed. Nothing leaves the laptop.

Run it

# 1. a local model (one-time)
ollama pull qwen2.5:7b          # older laptop? try llama3.2:3b

# 2. describe your housemate
cp profile.example.json profile.json     # edit allergies, likes, dislikes

# 3a. use it in the browser (recommended)
python mealmate.py serve                 # then open http://localhost:8000

# 3b. or from the terminal
python mealmate.py plan --days 5         # writes plan.html and plan.json

# no model handy? watch the guard work with a fake one that gets it wrong first
python mealmate.py plan --profile profile.example.json --mock

# quick check of any recipe or shopping list
python mealmate.py check "soy sauce, pesto, oat milk"

# tests (no model or network needed)
python -m unittest -v
Enter fullscreen mode Exit fullscreen mode

The web app listens on 127.0.0.1 only…



Python standard library only, plus tests that run without a model or a network connection.

How I Built It

  • Model: an open-weight model (qwen2.5:7b, or llama3.2:3b for slower machines) running locally through Ollama. It returns structured JSON that follows a schema.
  • Planning loop: the model plans one day at a time, with the allergies in its system prompt.
  • The safety layer is not AI. allergens.py is a plain word-list checker. It scans every dish name, ingredient and cooking step, so "drizzle with tahini" in a recipe step can't slip past a clean ingredient list. It knows hidden sources (ghee, casein, Worcestershire sauce, pesto, hummus) and avoids false alarms (peanut butter isn't dairy, eggplant isn't egg).
  • Retry with feedback: when the checker rejects a meal, the model is told exactly what was found and tries again, up to four times. If it still can't produce a safe day, that day is left blank instead of showing something unsafe.
  • Fail loudly: an allergy the checker doesn't recognise is treated as a literal word to avoid and is never silently dropped.
  • Interface: a tiny local web server on 127.0.0.1 only, with a form, a live log and the finished plan.

mealmate is not a medical device. It can't see inside a packet or catch cross-contact in a shared kitchen, and it deliberately over-blocks. The page says so, and for severe allergies the person should read each plan before cooking.

Why Does Open Innovation Matter?

  • Privacy: an allergy list is health information. It never leaves the laptop. There's no account, no upload and no third-party terms.
  • Cost: it costs nothing to run, so my roommate can use it for years without a subscription.
  • Swappable: I can change the model with one setting, or add another local runtime with a few lines. If a model plans badly, I can replace it without rewriting the app.
  • Inspectable safety: the part that matters most is code anyone can read and test, not a prompt I'm hoping holds. With a closed API I couldn't put a deterministic guard between the model and my roommate, and I couldn't be sure the model behind it wouldn't change underneath me.

My Agent Session

I built MealMate myself and wrote and debugged the code. I used Claude as a coding partner when I got stuck, but I made the development decisions and implemented the changes. I chose my roommate as the person to build for, decided what the tool needed to do, and added features like the browser version and a modern colour palette.

I also set up and debugged the local Ollama side myself: pulling the models, checking with ollama ps that they were running on CPU only, and fixing an outdated copy of the file. I used Git to push the project to GitHub so my work stays backed up and in sync.

Top comments (0)