DEV Community

Oni
Oni

Posted on

Building an AI-Powered Recipe Generator with Google AI Studio

Building an AI-Powered Recipe Generator with Google AI Studio

What I Built

I developed a smart recipe generator that creates personalized cooking recipes based on available ingredients, dietary restrictions, and cuisine preferences. Using Google AI Studio's Gemini model, the app transforms whatever's in your fridge into delicious meal ideas with step-by-step instructions.

The Prompt I Used

You are an expert chef and recipe creator. Generate a detailed recipe based on the user's requirements.

Create a recipe with these elements:
1. Recipe Title: Creative and appetizing name
2. Cuisine Type: Based on user preference or ingredients
3. Prep Time & Cook Time: Realistic estimates
4. Servings: Number of people the recipe serves
5. Ingredients List: Exact measurements using provided ingredients plus necessary additions
6. Equipment Needed: List of cooking tools required
7. Step-by-Step Instructions: Clear, numbered cooking steps
8. Tips & Variations: Helpful cooking tips and possible modifications
9. Nutritional Notes: Basic nutritional highlights

Guidelines:
- Prioritize using the ingredients the user has available
- Suggest minimal additional ingredients if needed
- Adapt recipes for dietary restrictions (vegetarian, vegan, gluten-free, etc.)
- Include cooking techniques explanations for beginners
- Make recipes achievable for home cooks

User Input:
- Available Ingredients: [USER INPUT]
- Dietary Restrictions: [USER INPUT]
- Preferred Cuisine: [USER INPUT]
- Cooking Skill Level: [USER INPUT - Beginner/Intermediate/Advanced]
Enter fullscreen mode Exit fullscreen mode

Demo

Live App: https://ai-recipe-chef.example.com

Screenshots

Ingredient Input Interface:
![Screenshot showing ingredient selection checkboxes and dietary preference options]

Generated Recipe Example:

🍝 Mediterranean Chickpea & Spinach Pasta

Cuisine: Mediterranean
Prep Time: 10 minutes | Cook Time: 20 minutes | Servings: 4

Ingredients:
- 12 oz whole wheat pasta (penne or fusilli)
- 1 can (15 oz) chickpeas, drained and rinsed
- 4 cups fresh spinach
- 3 cloves garlic, minced
- 1 medium onion, diced
- 1 can (14 oz) diced tomatoes
- 1/4 cup olive oil
- 1/2 cup sun-dried tomatoes, chopped
- 1/4 cup pine nuts (optional)
- 1/2 cup crumbled feta cheese
- 2 tsp dried oregano
- 1 tsp red pepper flakes
- Salt and black pepper to taste
- Fresh basil for garnish

Equipment Needed:
- Large pot for pasta
- Large skillet or sauté pan
- Colander
- Wooden spoon

Instructions:
1. Bring a large pot of salted water to boil. Cook pasta according to package directions until al dente.
2. While pasta cooks, heat olive oil in a large skillet over medium heat.
3. Add onion and cook for 3-4 minutes until softened.
4. Add garlic and cook for 1 minute until fragrant.
5. Add diced tomatoes, oregano, and red pepper flakes. Simmer for 5 minutes.
6. Add chickpeas and sun-dried tomatoes. Cook for 3-4 minutes.
7. Add spinach and cook until wilted, about 2 minutes.
8. Drain pasta and add to the skillet. Toss to combine.
9. Remove from heat, add feta cheese and pine nuts.
10. Season with salt and pepper. Garnish with fresh basil.

Tips & Variations:
- For extra protein, add grilled chicken or shrimp
- Substitute kale for spinach for a heartier texture
- Use nutritional yeast instead of feta for vegan option
- Toast pine nuts in a dry pan for extra flavor

Nutritional Notes:
High in fiber, plant-based protein, and iron. The combination of chickpeas and whole wheat pasta provides complete proteins.
Enter fullscreen mode Exit fullscreen mode

My Experience

Creating this recipe generator was both challenging and rewarding. It taught me how AI can be a creative partner in everyday tasks like cooking, making meal planning more accessible and fun.

What I Learned

Context Understanding: Gemini's ability to understand cooking contexts impressed me. It knows that if someone has spinach, they probably need to use it quickly, and adjusts recipes accordingly.

Practical Problem Solving: The AI doesn't just generate random recipes - it solves real problems like "What can I make with these random ingredients?" This practical application made the project feel immediately useful.

Cultural Food Knowledge: The model demonstrates deep understanding of cuisine types, flavor profiles, and traditional cooking techniques across different cultures.

Challenges and Solutions

Challenge: Preventing the AI from suggesting ingredients users don't have or can't easily find.
Solution: I refined the prompt to emphasize using available ingredients first and limiting additional suggestions to common pantry items.

Challenge: Ensuring recipes are actually cookable and measurements make sense.
Solution: Added specific instructions about realistic prep times, proper cooking techniques, and equipment most home cooks have.

Challenge: Accommodating various dietary restrictions without compromising flavor.
Solution: Enhanced the prompt with specific guidelines for common substitutions and alternative cooking methods.

Technical Implementation

I built a simple web interface where users can:

  • Check off ingredients they have available
  • Select dietary preferences from dropdown menus
  • Choose cuisine style and cooking skill level
  • Generate multiple recipe variations

The frontend sends all parameters to Google AI Studio's API, which returns the formatted recipe. I added local storage to save favorite recipes and a simple rating system for user feedback.

Real-World Impact

Since launching, I've received feedback from users who say the app has:

  • Reduced food waste by using up ingredients before they spoil
  • Introduced them to new cuisines and cooking techniques
  • Made meal planning less stressful for busy families
  • Helped people with dietary restrictions find satisfying recipes

Future Enhancements

I'm planning to add:

  • Shopping list generation for missing ingredients
  • Meal planning calendar integration
  • Photo recognition to identify ingredients automatically
  • Community features for sharing custom recipes
  • Integration with grocery delivery services

This project showed me how AI can make everyday life easier while encouraging creativity in the kitchen. Google AI Studio made it incredibly simple to build something that genuinely helps people!


Tags: #GoogleAIStudio #AI #Cooking #FoodTech

Top comments (0)