How mripradhan/bitebot-recipe-generator works
Project type and purpose
• BiteBot is a monolithic Python web application built on Streamlit.
• Purpose: provide a browser-based UI for users to input ingredients, equipment, cuisine, time, and dietary restrictions, then generate custom recipes via the Groq AI API and optionally fetch nutritional data from API Ninjas.
File structure
• Top level:
• bitebot.py – the entire Streamlit UI + business logic in one module
• requirements.txt – Python dependencies (Streamlit, Groq client, python-dotenv, API Ninjas client, etc.)
• .env (user-created) – stores GROQ_API_KEY and optional NINJAS_API_KEY
• README.md / LICENSE – documentation and license
• No subdirectories or local databases—external services are the only “backends.”
Key insights from README
• Stack: Python 3.8+, Streamlit for UI, python-dotenv for config, Groq API (LLaMA-3 70B) for recipe generation, API Ninjas for nutrition.
• UX: pastel-themed responsive UI, quick “streamlit run app.py” startup.
Main components & their interactions
a. User’s Browser (client)
b. Streamlit Application (bitebot.py)
• UI Layer: input fields, selection widgets, buttons, display panels
• Controller/Logic Layer: reads inputs, calls service functions
c. Configuration Loader
• python-dotenv reads .env → injects GROQ_API_KEY, NINJAS_API_KEY into environment
d. External Services
1. Groq AI API – generates recipe text given ingredients + parameters
2. API Ninjas Nutrition API – returns nutritional analysis for main ingredients
e. (Optional) Logging / Error Handling – simple print/log statements
Relationships & data flows
1. Browser → Streamlit UI: user inputs
2. UI → Controller: on button click, pass input data
3. Controller → Config Loader: retrieve API keys
4. Controller → Groq API: submit generation request → receives recipe
5. Controller → API Ninjas: if nutrition enabled → receives nutrition data
6. Controller → UI: render recipe steps + nutrition panel back to browser
Architectural patterns & principles
• Monolith with logical separation (View/Controller/Service)
• Single-process, event-driven Streamlit server
• Externalize secrets via dotenv (12-factor config)
• Externalize compute and data to third-party APIs—no own DB/storage
1. Sketch the user’s browser at the left.
– Top: UI Layer (input widgets, display panels)
– Bottom: Controller/Service Layer (functions that orchestrate API calls)
– Groq AI API
– API Ninjas Nutrition API
– Browser → UI Layer
– UI Layer → Controller
– Controller → Config Loader (gets keys)
– Controller → Groq API → Controller
– Controller → API Ninjas → Controller
– Controller → UI Layer → Browser
6. Component: list key technologies (Streamlit, python-dotenv, Groq client, API Ninjas).