Inspiration

The internet is currently flooded with conflicting nutritional advice, leaving users overwhelmed by competing philosophies (like "Carbs are bad" versus "Meat is bad"). Demed was inspired by the need to cut through this noise and help individuals who are confused by these conflicting diets find a tailored, evidence-informed, and practical nutrition plan that fits their specific lifestyle and health conditions.

What it does

Demed is an *AI-powered nutrition application that acts as a "mediator". Instead of offering a generic list of options, it evaluates multiple dietary philosophies (such as Keto, Paleo, Mediterranean, Plant-Based, etc.) and recommends the single best personalized diet based on a user's biological profile, goals, health conditions, and culinary preferences. It achieves this by:

  • Pre-calculating exact scientific baselines (Basal Metabolic Rate and Total Daily Energy Expenditure) to generate precise daily calorie and macronutrient targets.
  • Providing a detailed rationale and personalized implementation strategy for the recommended diet.
  • Generating a *practical daily meal plan (Breakfast, Lunch, Dinner) that includes both a Home-Cooked recipe and a Restaurant/Takeout option tailored to the user's target macros.

How we built it

We built Demed as a robust Full-Stack Web Application:

  • Frontend:Built with React 18, Vite, Tailwind CSS, Zustand, and React Router to handle UI, state management, and the clean results dashboard. The frontend also houses the deterministic "Nutrition Engine" which locally computes BMR and TDEE.
  • Backend: Developed with Node.js and Express.js to serve as the API gateway, handle data parsing, and inject pre-computed data into a strict prompt template.
  • AI Integration: Powered by Google Generative AI (Gemini 2.0 Flash). We designed a highly engineered prompt that forces the AI into the persona of a "Nutrition Mediator," dynamically injecting user profiles and mathematical nutrition targets into a strict 3-task structure.

Challenges we ran into

  • Preventing AI Hallucinations: We had to figure out how to stop the AI from "hallucinating" inaccurate calorie counts. We overcame this by handling the math deterministically before the AI is even called, utilizing the highly accurate Mifflin-St Jeor Equation to calculate baselines first.
  • Data Parsing Errors: Ensuring the frontend wouldn't crash due to unexpected AI output was a major hurdle. We solved this by enforcing a strict JSON Schema constraint in our prompt, explicitly forbidding any markdown formatting outside of the JSON block. We also built a custom extractJson() function on the backend to safely isolate the required data.

Accomplishments that we're proud of

The "Mediator" AI Prompt: We successfully engineered a prompt that not only selects the best diet and explains "Why Best," but strictly aligns its food recommendations with the actual pre-computed math. Real-World Applicability: We are incredibly proud of the Daily Meal Implementation feature, which acknowledges real-world lifestyles by providing both home-cooked meals and restaurant/takeout alternatives that actually fit the user's macronutrient targets.

What we learned

We learned the crucial importance of anchoring Generative AI with deterministic systems . By calculating the metabolic science (BMR/TDEE) mathematically and passing those hard numbers to the AI as constraints, we learned how to turn a creative LLM into a precise, reliable recommendation engine. We also learned how to master strict output constraints (like forced JSON and conciseness) to build a stable full-stack application.

What's next for Demed — AI Nutrition Mediator

Currently, Demed processes everything dynamically, but our next step is integrating a MongoDB database. This will "future-proof" the application by allowing us to support user accounts, save users' past diet results, and track their ongoing progress.

Built With

Share this project:

Updates

Submission history