How praveenr-codecrafter/random-dish-generator works
Project type and purpose
• This is a single‐page, client-side web application built with React and Vite.
• Purpose: allow end users to select a cuisine (and optionally a main ingredient), then call the Google Generative AI API to generate a random dish (name, ingredients, instructions, nutrition, time, servings).
File structure
• Top-level:
• package.json, vite.config.js → build & dev tooling
• index.html, public/ → static assets & HTML shell
• src/ → all React source code
• Inside src/:
• components/ → UI building blocks (Header, CuisineSelector, MainIngredient, GenerateButton, DishDisplay, ErrorMessage)
• utils/openaiService.js → service layer that wraps the external AI API call
• App.jsx, main.jsx → entry & root component wiring
• assets/, styles (App.css, index.css) → styling (Tailwind + CSS)
README for additional insights
• Communicates with Google Generative AI via an environment‐backed API key
• Describes the UI flow and how errors and loading states are handled
Detail
• Loading/error states in the flow between GenerateButton and DishDisplay/ErrorMessage