How eatas-dev/light-up-test works
1. What this repo is
- This is a full-stack Azure sample for a food-ordering chat app powered by Azure OpenAI and Azure Cosmos DB for MongoDB vCore.
- The main runtime is a Python Quart backend plus a TypeScript/React frontend, deployed together to Azure App Service via azd/Bicep.
2. Top-level architecture
- The system splits into four practical layers:
- UI layer: frontend/
- Application/API layer: src/quartapp/
- Data ingestion / serverless support: functions/AddRagData/ and src/scripts/add_data.py
- Cloud infrastructure: infra/ and governance/
- The repo also includes tests, docs, and notebooks for bootstrapping and RAG data prep.
3. Frontend subsystem
- frontend/ is a Vite-based React app written in TypeScript.
- It is organized around chat-oriented UI components such as:
- QuestionInput, Answer, UserChatMessage
- AnalysisPanel, SupportingContent
- VectorSettings, SettingsButton, ClearChatButton
- CartButton, BuyModal
- This suggests the UI is not just a chat box; it also supports recommendation review, settings, cart/order actions, and analysis visibility.
4. Backend application subsystem
- src/quartapp/ contains the Python server built on Quart.
- It is structured around multiple “approaches” in src/quartapp/approaches/:
- rag.py
- vector.py
- keyword.py
- summarizer.py
- shared base/setup/utils/schemas modules
- This indicates the backend can route a query through different retrieval/generation strategies, with RAG and vector search being core paths.
5. Primary request/response flow
- The browser UI sends chat or ordering requests to the Quart app.
- The backend then:
- interprets the prompt,
- retrieves relevant food/product data from Cosmos DB,
- calls Azure OpenAI for generation/embedding-driven reasoning,
- returns an answer plus supporting context back to the UI.
- The frontend renders both the final answer and supplemental panels for explanation or retrieved content.
6. Data stores and AI dependencies
- The architecture is centered on Azure Cosmos DB for MongoDB vCore as the persistent store for food items and user-related memory/preferences.
- Azure OpenAI provides:
- chat completion for conversational responses,
- embedding generation for vector retrieval.
- The repository’s notebook-first setup and the insert-vector-data.ipynb/rag-azure-openai-cosmosdb-langchain-notebook.ipynb files indicate the vector index/data preparation step is part of the solution’s data pipeline.
7. Data ingestion and seeding
- src/data/food_items.json is the sample catalog used to populate the knowledge base.
- src/scripts/add_data.py and the App Service SSH instructions show a manual/operational seeding path for loading food data into the backend datastore.
- functions/AddRagData/ is an Azure Function that likely exists to support additional ingestion or augmentation of RAG data in a serverless way.
8. Infrastructure boundary
- infra/main.bicep is the main deployment entrypoint.
- infra/core/ defines reusable Azure building blocks for:
- App Service hosting
- Azure OpenAI / Cognitive Services
- Cosmos DB
- Key Vault and secrets
- Application Insights / monitoring
- networking and app settings
- infra/app/ contains app-specific wiring, especially Key Vault secret injection.
- This makes the deployment model clearly split between core platform modules and app-specific composition.
9. Governance and enterprise setup
- governance/ contains Bicep for management-group, policy, role, and logging governance.
- This is a separate control plane from the app deployment and is meant to establish organizational guardrails before the application resources are provisioned.
10. Runtime and hosting model
- The app is designed to run on Azure App Service.
- Locally, the frontend is built and then served alongside the Quart backend.
- The backend serves as the main application host; the frontend appears to be compiled into static assets that are consumed by the backend deployment.
11. Configuration and environment management
- Environment variables are documented in .env.example and the frontend’s .env.* files.
- src/quartapp/config.py and config_base.py centralize backend configuration.
- The repository is set up for azd-driven deployment using azure.yaml, which ties local source to Azure provisioning and deployment.
12. Observability and operations
- Monitoring is treated as a first-class infrastructure concern through infra/core/monitor/.
- The presence of workflow files for linting, unit tests, static analysis, frontend CI, and function-specific CI shows the repo is meant to be continuously validated across both Python and TypeScript parts.
13. Testing boundaries
- Backend behavior is covered by tests/test_app_endpoints.py, tests/test_approaches.py, and config tests.
- This indicates the critical test boundary is the Quart API and the retrieval/generation approaches, not just isolated utility functions.
14. Architecture summary for diagramming
- A useful diagram would show:
- User browser → React frontend
- Frontend → Quart backend on App Service
- Backend → Azure OpenAI and Cosmos DB Mongo vCore
- Optional Azure Function / scripts for data ingestion
- Bicep/azd provisioning the Azure resources
- Application Insights / Key Vault as supporting platform services
- The central architectural idea is a RAG-based food ordering assistant with persistent product data and user preference memory in Cosmos DB, surfaced through a conversational UI.
Main entry points: app.py Quart App · Chat.tsx React App · main.bicep Main Bicep · food_items.json Food Catalog
Components 22
Frontend UI
React chat interface and client-side interaction layer.
- React App · TypeScript/React frontend for chat, settings, and cart actions.
frontend/src/pages/chat/Chat.tsx - Chat Input · Collects user questions and voice input.
frontend/src/components/QuestionInput/QuestionInput.tsx - Answer View · Renders answers, loading, errors, and speech output.
frontend/src/components/Answer/Answer.tsx - Analysis Panel · Displays supporting content and thought-process views.
frontend/src/components/AnalysisPanel/AnalysisPanel.tsx - Cart UI · Cart, settings, and purchase interaction controls.
frontend/src/components/CartButton/CartButton.tsx - API Client · Frontend request layer and client models.
frontend/src/api/index.ts
Quart App
Python application API and retrieval/generation approaches.
- Quart App · Backend application host for chat and orchestration endpoints.
src/quartapp/app.py - Config · Central backend configuration and environment handling.
src/quartapp/config.py - RAG · Primary retrieval-augmented generation path.
src/quartapp/approaches/rag.py - Vector Search · Embedding-driven retrieval strategy.
src/quartapp/approaches/vector.py - Keyword Search · Fallback lexical retrieval strategy.
src/quartapp/approaches/keyword.py - Summarizer · Condenses retrieved context into concise responses.
src/quartapp/approaches/summarizer.py
Data Prep
Sample data, ingestion scripts, and serverless augmentation.
- Food Catalog · Seed catalog used for product and menu knowledge.
src/data/food_items.json - Seeder · Loads sample data into the backend datastore.
src/scripts/add_data.py - RAG Function · Serverless ingestion or augmentation entry point.
functions/AddRagData/function_app.py
Azure Platform
Infrastructure, secrets, monitoring, and governance modules.
- Main Bicep · Top-level Azure deployment composition.
infra/main.bicep - App Service · App Service hosting, app settings, and function hosting modules.
infra/core/host/appservice.bicep - AI and DB · Azure OpenAI and Cosmos DB modules for the application.
infra/core/ai/cognitiveservices.bicep - Secrets · Key Vault, secret, and role wiring for the app.
infra/core/security/keyvault.bicep - Monitoring · Application Insights and dashboard modules.
infra/core/monitor/monitoring.bicep - Governance · Management-group, policy, and logging guardrails.
governance/main.bicep
Other components
- Browser · End-user entry point for chat and ordering flows.
Connections 27
- Browser → React App: uses · User interacts with the chat UI.
- React App → API Client: calls · Frontend sends chat and ordering requests through the client layer.
- API Client → Quart App: requests · Client talks to backend endpoints.
- Chat Input → React App: part of · Input component is embedded in the chat page.
- Answer View → React App: part of · Answer rendering is part of the chat experience.
- Analysis Panel → React App: part of · Supporting content and analysis live in the UI.
- Cart UI → React App: part of · Cart and settings controls are exposed in the UI.
- Quart App → Config: loads · Backend uses centralized environment and app configuration.
- Quart App → RAG: routes to · Primary conversational flow uses RAG.
- Quart App → Vector Search: routes to · Backend can use vector retrieval strategy.
- Quart App → Keyword Search: routes to · Backend can fall back to keyword retrieval.
- RAG → Summarizer: uses · RAG path condenses retrieved context before responding.
- RAG → Food Catalog: retrieves from · RAG uses catalog data as grounding material.
- Vector Search → Food Catalog: indexes · Vector retrieval is built from the food catalog.
- Keyword Search → Food Catalog: searches · Lexical lookup uses the same catalog data.
- Seeder → Food Catalog: seeds · Seeder loads the sample catalog into the store.
- RAG Function → Food Catalog: augments · Azure Function supports additional RAG data ingestion.
- Main Bicep → App Service: provisions · Main deployment composes hosting resources.
- Main Bicep → AI and DB: provisions · Main deployment composes AI and database resources.
- Main Bicep → Secrets: provisions · Main deployment wires secrets and access control.
- Main Bicep → Monitoring: provisions · Main deployment enables observability.
- Governance → Main Bicep: guards · Governance establishes policy and logging guardrails before app deployment.
- Secrets → Quart App: injects · Key Vault-backed settings are consumed by the backend.
- AI and DB → Quart App: supports · Backend depends on Azure OpenAI and Cosmos DB services.
- Monitoring → Quart App: observes · Application Insights monitors the backend runtime.
- App Service → React App: serves · App Service hosts the built frontend alongside the backend.
- App Service → Quart App: runs · App Service runs the Quart application.