Fridge Oracle: I Built My Friend a Recipe Helper That Never Leaves the Laptop
This is my entry for the Hacktoberfest Weekend Challenge: Build for a Friend.
Demo. This is what it looks like start to finish, typed into the real app on my own laptop. I type what is in the kitchen and that I am lactose intolerant, hit submit, Gemma 3 thinks for a bit (it is running on my CPU, no GPU, so this takes under two minutes), and the result comes back correctly flagged because it actually has cheese and butter in it.
The challenge is simple to say and hard to do well. Pick a real problem someone you know actually has. Build something small that uses open source AI to help with it. No fake use case, no made up user.
The Problem
A lot of people cook with whatever is left in the fridge, and a lot of people also have an allergy or a food rule they cannot break. Lactose intolerance, a nut allergy, halal, vegan, whatever it is. Normal recipe apps do not know your restriction. You still have to read every recipe yourself and check it is safe.
So I built Fridge Oracle. You type what is in your kitchen and what you cannot eat, and it gives you one recipe that fits both.
Why It Has to Run Locally
This is the part that matters most for the "open source AI" side of the challenge. Allergy and health information is personal. I did not want to send a stranger's dietary restrictions to a company's API just to get a recipe back. So Fridge Oracle does not call any cloud AI at all. It runs Google's Gemma 3 model fully on your own computer, through a free tool called Ollama.
What this gets you:
- Private. What you type never leaves your machine.
- Free. No API key, no bill, no rate limit.
- Works offline. Once the model is downloaded, you do not need internet.
Fridge Oracle running on my own laptop. The model said this cheese and butter recipe was for someone lactose intolerant, which it was not. Keep reading, that bug is the whole next section.
The Build, and the Bug That Mattered
I want to be honest about how this went, because the honest part is the actual interesting part. I set up a local model called Gemma 3 (4B) through Ollama, wrote a system prompt telling it to never suggest food that breaks the user's restriction, and asked it to answer in JSON.
First try, it worked. I typed "eggs, rice, cheddar, tinned tomatoes, butter" into the kitchen box and "lactose intolerant" into the restriction box. It gave me a recipe full of butter and cheddar cheese. And it marked the recipe "safe." That is not a small bug. The entire point of this app is to be trusted with someone's allergy. A small 4B model running on a laptop is good, but it is not reliable enough to be the only thing standing between a person and a dairy reaction.
So I did not try to prompt my way out of it. I added a second, dumb, completely non-AI check in plain code. It is a list of common restrictions (dairy, gluten, nuts, egg, shellfish, soy, vegan, vegetarian, halal) mapped to the ingredient words that break them. After the model answers, the code checks the model's own ingredient list against that map. If there is a match, the verdict gets forced to "needs a double-check" no matter what the model said, and the warning names the exact ingredient.
I reran the same test. Same recipe came back, cheddar and butter and all, but this time correctly flagged, with the dairy conflict named in plain words.
Second smaller bug, while I was at it: the model sometimes wrote the literal words "empty string" or "empty array" into fields, because that is the placeholder text I used in my own prompt to describe what an empty field should look like. It was quoting my instructions back at me instead of leaving the field blank. Fixed with a small filter that treats those exact phrases as empty.
Lesson I am taking from this into every future AI project: never let the model's own claim about safety be the last check. If a wrong answer can hurt someone, verify it with plain code you can read and trust, after the model is done talking.
How It Works
app/page.tsx, the form. Kitchen contents, restrictions, mood.app/api/suggest/route.ts, sends that toGemma 3running locally throughOllama's API onlocalhost:11434, asks for one recipe as JSON.lib/safety.ts, the plain keyword safety net described above. This runs after the model, every time, no exceptions.
Why It Is Not on a Public URL
This one is on purpose, not a limitation I ran out of time to fix. The whole value of this app is that your allergy information stays on your computer. Putting it on a shared public server would mean either running the model on someone else's cloud box (so the "your data never leaves your machine" promise breaks), or removing the AI part entirely. Both defeat the point.
Instead, the README has clear steps to run it on your own machine in a few minutes, free, with Ollama and one ollama pull command.
Links
- Code: https://github.com/respect-20/fridge-oracle
- Built with: Next.js,
Gemma 3(viaOllama), TypeScript
If you have a friend with a food restriction, or you have one yourself, I would like to know if this is actually useful once you run it. That feedback is worth more to me than the build itself.
Comments
No comments yet. Start the discussion.