DEV Community

Cover image for I built my cousin a gym planner that can't sneak an allergy past him
Smaranika
Smaranika

Posted on

I built my cousin a gym planner that can't sneak an allergy past him

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🤝

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

My cousin just started going to the gym. He also has a severe nut allergy and a shellfish allergy, which makes "just follow a meal plan from the internet" a bad idea. Most meal-plan apps don't know what he can't eat.

So I built him PlateAndPlate: a gym meal and workout planner that runs on his own laptop, and checks every plan for his allergens before he ever sees it.

PlateAndPlate Train tab

What I Built

PlateAndPlate has three tabs:

  • 🏋️ Train. A weekly split based on how many days he trains (4 days gives Upper, Lower, Upper, Lower). He taps a day and the model writes that session: warm-up, exercises, sets, reps and rest.
  • 🥗 Eat. He types what he wants ("3 high-protein dinners") and gets meals with approximate calories and protein.
  • 📊 Log. A daily calorie counter. A ring at the top fills as he logs food, and turns red if he goes over.

The one rule behind all of it: the AI suggests, and plain code decides.

Demo

Watch PlateAndPlate in action: one gym planner, zero nuts

PlateAndPlate is built to run locally on his laptop, so there is no hosted version. The screenshots and the code show how it works.

PlateAndPlate Eat tab

PlateAndPlate Log tab

Code

🏋️ PlateAndPlate

A gym meal and workout planner that can't sneak an allergen past you.

Runs on your own laptop with an open model. No account, no cloud, no per-request cost.

Python deps model Hacktoberfest

PlateAndPlate workout tab


Why this exists

I built PlateAndPlate for my cousin, who is starting a gym routine and has severe nut and shellfish allergies. Most meal and fitness apps suggest almond-crusted everything and don't know what he can't eat. PlateAndPlate plans his meals and workouts, counts his calories, and checks every plan for his allergens before he sees it.

What it does

🏋️ Train A weekly split (set by gym days per week). Tap a day and Gemma writes that session: warm-up, exercises, sets, reps, rest.
🥗 Eat Ask for meals in plain language, such as "3 high-protein dinners". Plans include approximate calories and protein.
📊 Log A daily calorie counter with a ring that fills as you log food.
…

How I Built It

The whole thing is one Python file with no dependencies, a single HTML page, and a JSON profile. The model is Gemma 3 1B, served locally by Ollama.

1. The guardrail is code, not a prompt. Asking a model nicely to avoid nuts isn't a safety system. So every response goes through a plain-code check against his avoid list before it reaches the screen. The text is normalised first (Unicode NFKC, zero-width characters stripped), so pea​nut with a hidden character and the full-width peanut still count as "peanut". If anything on the list appears, the draft is thrown away and regenerated, up to three times, then refused. Workouts get the same treatment for exercises he should skip.

2. The numbers come from formulas, not the model. A 1B model can't look up real food data, so his daily calorie and protein targets are calculated in code with the Mifflin-St Jeor equation from his age, weight, height, activity and goal. Gemma only writes the meals and exercises.

3. The weekly split is fixed in code. Gemma writes one session at a time instead of a whole week, which keeps requests short and the structure reliable. Sessions are checked against a whitelist, and the server only answers requests addressed to localhost.

4. Tests. They cover bypass attempts (hidden and full-width characters), the second allergen, the retry logic, the workout whitelist and the calorie formula.

What I learned along the way:

  • My first prompt called the model a "friendly meal planner", and it started calling my cousin "darling" in the middle of dinner plans. Small models over-act a persona. Changing "friendly" to "practical" and telling it to start directly with the first meal fixed it.
  • I didn't trust a small model to follow "no nuts" on its own, so I wrote tests that try to sneak a peanut past the check using a hidden zero-width character and full-width letters, and a draft containing a banned word is thrown away and regenerated. I haven't yet seen a long run of real-world use with it, so treat the guard as a safety net, not a guarantee.
  • The test I cared about most: I asked the Eat tab for "something with almond", on purpose, with almonds on my cousin's avoid list. The app showed a red "Blocked by the safety check" banner instead of a recipe. That banner only appears when all three attempts contained a banned ingredient, so the check threw every draft away and nothing unsafe reached the screen. It's what I built the guardrail for, because asking a model nicely to avoid nuts isn't enough. A small model tends to repeat the words it's given, and here the almonds were in my own request.

PlateAndPlate Eat tab with allergen in prompt

Honest limits. The calorie targets are estimates and the model's per-meal numbers are rough guesses, so this isn't medical advice. The guard checks words, not ideas: if an ingredient or synonym isn't on his list, it won't be caught. The README says so too.

Why Does Open Innovation Matter?

For this project, open models weren't a principle. They solved four practical problems:

  1. His health data stays on his laptop. Allergies, body weight and eating habits are about the last thing I'd want to send to someone else's server. Here it's one small JSON file.
  2. It's free every day. There is no cost per plan, so he can ask as often as he wants without thinking about it.
  3. It works offline, and the model version is pinned, so it can't change behaviour on him overnight.
  4. I could wrap it tightly. A hard safety check, a calorie formula and a fixed weekly structure around the model are much easier when you control the model and can run it locally.

Handing it over

I haven't handed it over yet. I'm putting it on his laptop this week with his real allergens in the avoid list, and I'll update this post with what he thinks. I suspect he'll ignore the workout tab and go straight to the calorie ring.

Prize Categories

  • Best Use of Gemma. Gemma 3 1B writes every meal plan and workout locally through Ollama.

Built with AI coding assistance. I directed it, reviewed the code and ran it myself. Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms.

Top comments (0)