DEV Community

Shyam Kumar V N
Shyam Kumar V N

Posted on

AI Meal Planner App

Education Track: Build Apps with Google AI Studio

This post is my submission for DEV Education Track: Build Apps with Google AI Studio.

What I Built

I built the AI Healthy Meal Planner, an intelligent application that generates comprehensive, 7-day diabetes-friendly and heart-healthy vegetarian meal plans. It specializes in North/South Indian and Chinese cuisines, generating meal plans from a user-managed dish database. The core functionality relies on a powerful prompt engineering approach with the Gemini API to request a structured JSON output that includes the entire weekly plan, ensuring it adheres to strict health rules like low glycemic index, low saturated fats, and low sodium. I also utilized the AI for dynamic features like generating recipes for new custom dishes and providing instant, health-focused feedback when a user tries to swap a meal.

Demo

https://ai-healthy-meal-planner-554719291717.us-west1.run.app/

My Experience

Working through the track and building the AI Healthy Meal Planner was a highly valuable and surprisingly smooth experience.

What I Learned and Key Takeaways

My biggest takeaway was the power and reliability of structured output when working with the Gemini API. By defining a strict JSON schema for the meal plan, I was able to get a complex, multi-day data structure in a predictable format, which drastically simplified the frontend integration and logic. It taught me that for complex applications, the model isn't just a text generator; it's a powerful, self-correcting data engine if given the right instructions.

I also learned to appreciate the efficiency of using AI for database management logic. Instead of writing complex, rule-based code to check if a meal plan adhered to "diabetes-friendly, heart-healthy" rules, I simply included these constraints directly in the system prompt. The Gemini model handles the complex filtering and balancing of dishes from the database, effectively acting as an intelligent planner and rule-checker in one go.

What Was Surprising

The most surprising aspect was how effective the model was at handling layered constraints and contextual feedback. For instance, when a user attempts a meal swap, the AI not only replaces the meal but provides an immediate, nutritional-based justification for the swap (e.g., "This new dish adds more fiber but slightly increases the sodium for the day"). This level of subtle, context-aware reasoning felt like a huge leap from simpler API calls and opened my eyes to the potential for creating truly interactive and personalized AI features within an application.

Top comments (2)

Collapse
 
cyber8080 profile image
Cyber Safety Zone

Great post, @shyam Kumar V N! The way you used the Gemini API along with structured JSON prompts to build your AI meal-planner app is really impressive — especially the part where the model handles layered constraints like low glycemic index, low saturated fats, and low sodium with contextual feedback.

A few thoughts/questions:

  • I loved how you framed the system prompt so the model becomes a “self-correcting data engine” rather than just generating text. That’s a powerful pattern.
  • One idea: have you considered logging swap decisions and user feedback over time, so you can fine-tune or adapt prompts based on real-world user behaviour?
  • Also curious: how are you handling dietary preference updates (e.g., vegan, gluten-free) within your dish database + prompts? Does your JSON schema support that yet?
  • From a UX perspective, maybe an interactive “why did this meal fit you better” tooltip (leveraging the model’s nutritional reasoning) could enhance the swap functionality further.

Thanks for sharing your workflow — this kind of build-in-public example is super valuable for the community! Looking forward to your next project.

Collapse
 
shyam_kumarvn_10f595c2e profile image
Shyam Kumar V N • Edited

That is exceptionally insightful feedback, —thank you. I appreciate you drilling down into the architectural and UX design choices.

Here is a breakdown of how the app handles these areas, and how your feedback informs the roadmap:

1. Adaptive Logging and Fine-Tuning

You're right—this is the path to a truly "learning" planner.

  • Current Status: The app logs all swap decisions and plan ratings/comments to the user's history. This data is currently for user reporting (Statistics page) only.
  • Future Roadmap (Informed by your input): The next step is utilizing your suggested feedback loop. We will implement a feature to summarize this historical data and inject it into the generateMealPlan prompt, allowing the AI to automatically make better-personalized suggestions without explicit user input.

2. Handling Dynamic Dietary Preferences

The app is already highly flexible, handling this via a data + prompt engineering pattern:

  • Data Layer: Each dish in the "Manage Dishes" modal supports custom tags (e.g., vegan, gluten-free, nut-free).
  • Prompt Layer: Users set permanent Global Instructions (e.g., "Only use dishes tagged as 'vegan'"). The Gemini model receives the full list of available dishes and these instructions, using its reasoning to ensure the structured JSON output is compliant. The prompt is the dynamic constraint checker.

3. Interactive "Why did this meal fit you better" Tooltip

I'm glad you spotted this crucial UX feature—it's already live!

  • Implementation: When swapping a meal, the EditMealModal performs a real-time Gemini API call.
  • Output: The model returns instant AI Suitability Analysis and Health Impact feedback, allowing the user to make a truly informed, intelligent decision before confirming the swap. This achieves the interactive, intelligent experience you described.

Your questions provide a clear mandate for the transition from a robust prototype to a scalable production system, particularly around the data architecture needed for true AI learning. Thank you for validating the key design decisions and pushing the roadmap forward