Repo: https://github.com/KelbyChau/NutritionalNibbles
Inspiration
Changing your macros usually means looking up every ingredient by hand, doing the math, and guessing at substitutions. Most nutrition apps either track what you ate or hand you a completely different recipe. We wanted an easy way to make the meals you already love fit your goals without losing what makes them good.
What it does
NutritionalNibbles takes a recipe, which you can type in or import from a website link, and matches each ingredient to USDA nutrition data. It shows calories, protein, carbs and fat per serving. Then you pick a goal, such as higher protein, fewer calories, lower carbs or less fat, or just ask in plain English, like "more protein and fewer calories." The AI suggests up to three practical ingredient swaps. Each one is checked against real USDA numbers and comes with a short note on how the taste or texture changes. Nothing is applied until you pick a swap, and you can compare the original and updated recipe side by side.
How we built it
Next.js for the app, and Supabase (Postgres) for accounts and saved recipes. Row-level security keeps each user's recipes private. About 8,200 foods from USDA FoodData Central (Foundation Foods and SR Legacy), stored in our database for fast search. Nutrition totals are calculated in the database, not by the AI. Google Gemini suggests what to search for and picks the best swaps from real catalog matches. Our code then checks every swap before showing it. A local Docker setup with demo recipes, so each of us could test the whole app without touching the shared database.
Challenges we ran into:
Keeping the AI honest. Language models will happily invent nutrition numbers, so Gemini never supplies the numbers. It only chooses from USDA foods, and we verify that each swap actually moves the nutrients in the direction you asked for. Speed. Gemini's response times varied a lot, so we switched to a faster model, added time limits and retries, and fall back to a built-in list of swaps when the AI is slow. Matching ingredients. "Maple syrup" is listed in USDA data as "Syrups, maple," and recipes measure in cups and spoons. We needed fuzzy search and USDA portion data to turn those amounts into accurate weights.
Accomplishments that we're proud of:
Every nutrition number traces back to real USDA data, even the ones behind the AI's suggestions. You can ask for any combination of goals, such as more protein and fewer calories at once, and get swaps that respect all of them. A full working product in 24 hours: import, build, optimize, save, and a dashboard of your recipes.
What we learned
AI is most useful when it makes judgment calls, like what would work in a creamy pasta, while plain code handles the facts and the math. We also learned a lot about splitting work across a team of three on one codebase in a short time.
What's next for NutritionalNibbles:
Updating cooking instructions to match the swaps. Branded and packaged foods. More goals, such as fiber and saturated fat. Planning a whole day or week of meals, not just one recipe.
Built With
- docker
- next.js
- node.js
- postgresql
- react
- tailwind