DEV Community

Aryan Mohan
Aryan Mohan

Posted on

AllerGuard: Keeping My Roommate Safe in the Kitchen with Local Gemma 2

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🀝

This is a submission for theHacktoberfest Weekend Challenge: Build for a Friend

What I Built

Cooking with friends and roommates should be one of the best parts of living together. But when your roommate has severe food allergies, every meal prep turns into an anxious guessing game.

My roommate has a severe peanut allergy and a painful sensitivity to dairy and gluten. If you've ever tried scanning complex recipe cards, takeout descriptions, or ingredient lists after a long day of classes and work, you know how easy it is to miss hidden culprits:

  • Soy sauce often contains wheat/gluten.
  • Traditional pestos are loaded with pine nuts and parmesan cheese.
  • Worcestershire sauce typically includes anchovies.
  • Sauces and dressings frequently hide whey or dairy thickeners.

I built AllerGuard for my roommate: an intelligent culinary safety companion. You enter your friend's allergy profile, paste any recipe or meal kit text, and AllerGuard instantly:

  1. Scans every ingredient for direct and hidden dietary hazards.
  2. Explains why an ingredient is risky.
  3. Recommends delicious, 1-to-1 safe substitutions (e.g. swapping heavy cream for oat cream, or standard soy sauce for tamari/coconut aminos).
  4. Provides cross-contamination and kitchen prep advice.

When I showed it to my roommate and pasted their favorite pasta recipe, their reaction was immediate relief: "Wait, I never have to spend 15 minutes squinting at ingredient labels on my phone again?"


Demo

Video Link: Link

Key Features:

  • One-Click Profiles: Customize your friend's name and toggle known allergies (Peanuts, Gluten, Dairy, Soy, Shellfish, etc.) with custom tag additions.
  • Instant Ingredient Audits: Color-coded risk indicators (HIGH / MEDIUM / LOW) with plain-English rationales.
  • Pantry-Friendly Swaps: Thoughtful culinary substitutes that preserve the dish's flavor and texture without triggering allergic reactions.
  • Kitchen Safety Reminders: Practical tips on preventing cross-contamination during prep.

Code

Github Repository: https://github.com/AryanMohan818/AllerGuard


How I Built It

AllerGuard is designed from the ground up to be 100% containerized, local, and self-hosted:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Docker Compose Architecture              β”‚
β”‚                                                        β”‚
β”‚  [ React Frontend ] ────► [ FastAPI Backend ]          β”‚
β”‚     (port 5173)                 β”‚ (port 8000)          β”‚
β”‚                                 β–Ό                      β”‚
β”‚                         [ Ollama Container ]           β”‚
β”‚                            (port 11434)                β”‚
β”‚                                 β”‚                      β”‚
β”‚                         [ Docker Volume ]              β”‚
β”‚                       (stores gemma2 model)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Enter fullscreen mode Exit fullscreen mode

Why Does Open Innovation Matter?

When deciding how to build AllerGuard, using a closed, proprietary cloud LLM API (like OpenAI or Anthropic) was an option. However, open innovation was fundamentally betterβ€”and actually essentialβ€”for what I built:

  1. Medical & Health Data Privacy:
    Personal dietary restrictions and medical allergies are sensitive personal health information. With Google's open-weight Gemma 2 running locally inside our own Docker environment, zero health data ever leaves the laptop. No third-party servers, no corporate data retention policies, and no risk of personal dietary logs being fed into external training datasets.

  2. Zero Operating Cost for Roommates:
    College students and roommates shouldn't have to pay recurring monthly API token fees or subscription tiers just to cook dinner safely. Open-weight models democratize access: once downloaded, Gemma 2 costs exactly $0.00 to run indefinitely, completely eliminating API bill anxiety.

  3. 100% Offline Kitchen Reliability:
    Whether you're cooking in an off-grid cabin, an apartment with spotty Wi-Fi, or camping without cell service, AllerGuard works without an internet connection. Open-source models turn consumer hardware into independent, reliable edge intelligence hubs.

  4. Model Freedom & Deterministic Control:
    Because Gemma 2 is open, we can pair it with local container runtimes like Ollama to enforce strict, constrained JSON decoding schemas. We don't have to worry about a closed provider deprecating a model endpoint, altering system prompts, or silently changing safety guardrails behind our backs.


My Agent Session

To build AllerGuard efficiently over the weekend, I paired with an autonomous coding agent (Antigravity) throughout the entire development lifecycle:

  • Iterative Architecture Design: We collaborated to architect a 100% containerized, multi-service setup (React + FastAPI + Ollama) rather than a monolithic local script, ensuring full reproducibility.
  • Prompt Engineering for Gemma 2: We designed and refined the culinary safety prompt to constrain Gemma 2's reasoning into strict JSON outputs with hazard categorization and culinary substitutions.
  • Fast Troubleshooting: During development, we diagnosed Linux container case-sensitivity issues (App.jsx resolution inside Alpine Node) and configured Docker internal networking (http://ollama:11434) seamlessly.

Using an agent as an interactive pair-programmer accelerated the process from initial brainstorm to a polished, fully Dockerized repository in just a few hours.


Prize Categories

🌟 Best Use of Gemma ($200)

AllerGuard uses Google's open-weight Gemma 2 (2B) as its core reasoning engine. Gemma 2 is deployed locally inside a dedicated Docker container via Ollama, parsing recipe ingredients, detecting hidden cross-reactive allergens, and generating structured JSON substitution recommendations with zero cloud dependencies.

Top comments (0)