# eatas-dev/light-up-test architecture

> Architecture diagram of the GitHub repository eatas-dev/light-up-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eatas-dev/light-up-test
- Repository: https://github.com/eatas-dev/light-up-test

## Overview

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: [`src/quartapp/app.py`](https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/app.py) (Quart App), [`frontend/src/pages/chat/Chat.tsx`](https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/pages/chat/Chat.tsx) (React App), [`infra/main.bicep`](https://github.com/eatas-dev/light-up-test/blob/main/infra/main.bicep) (Main Bicep), [`src/data/food_items.json`](https://github.com/eatas-dev/light-up-test/blob/main/src/data/food_items.json) (Food Catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Frontend UI"]
  node_frontend["React App<br/>vite ui<br/>[Chat.tsx]"]
  node_chat_input["Chat Input<br/>ui component<br/>[QuestionInput.tsx]"]
  node_answer_view["Answer View<br/>ui component<br/>[Answer.tsx]"]
  node_analysis_panel["Analysis Panel<br/>ui component<br/>[AnalysisPanel.tsx]"]
  node_shopping_ui["Cart UI<br/>ui component<br/>[CartButton.tsx]"]
  node_api_client["API Client<br/>frontend api<br/>[index.ts]"]
end

subgraph group_app["Quart App"]
  node_quart_app["Quart App<br/>python web app<br/>[app.py]"]
  node_config["Config<br/>[config.py]"]
  node_rag["RAG<br/>approach<br/>[rag.py]"]
  node_vector["Vector Search<br/>approach<br/>[vector.py]"]
  node_keyword["Keyword Search<br/>approach<br/>[keyword.py]"]
  node_summarizer["Summarizer<br/>approach<br/>[summarizer.py]"]
end

subgraph group_data["Data Prep"]
  node_food_data["Food Catalog<br/>sample data<br/>[food_items.json]"]
  node_add_data["Seeder<br/>python script<br/>[add_data.py]"]
  node_add_rag["RAG Function<br/>azure function<br/>[function_app.py]"]
end

subgraph group_platform["Azure Platform"]
  node_bicep["Main Bicep<br/>infra entrypoint<br/>[main.bicep]"]
  node_hosting["App Service<br/>hosting modules<br/>[appservice.bicep]"]
  node_ai_db["AI and DB<br/>core services"]
  node_security["Secrets<br/>security modules<br/>[keyvault.bicep]"]
  node_monitoring["Monitoring<br/>observability<br/>[monitoring.bicep]"]
  node_governance["Governance<br/>[main.bicep]"]
end

node_browser(("Browser<br/>user client"))

node_browser -->|"uses"| node_frontend
node_frontend -->|"calls"| node_api_client
node_api_client -->|"requests"| node_quart_app
node_chat_input -->|"part of"| node_frontend
node_answer_view -->|"part of"| node_frontend
node_analysis_panel -->|"part of"| node_frontend
node_shopping_ui -->|"part of"| node_frontend
node_quart_app -->|"loads"| node_config
node_quart_app -->|"routes to"| node_rag
node_quart_app -->|"routes to"| node_vector
node_quart_app -->|"routes to"| node_keyword
node_rag -->|"uses"| node_summarizer
node_rag -->|"retrieves from"| node_food_data
node_vector -->|"indexes"| node_food_data
node_keyword -->|"searches"| node_food_data
node_add_data -->|"seeds"| node_food_data
node_add_rag -->|"augments"| node_food_data
node_bicep -->|"provisions"| node_hosting
node_bicep -->|"provisions"| node_ai_db
node_bicep -->|"provisions"| node_security
node_bicep -->|"provisions"| node_monitoring
node_governance -.->|"guards"| node_bicep
node_security -->|"injects"| node_quart_app
node_ai_db -->|"supports"| node_quart_app
node_monitoring -->|"observes"| node_quart_app
node_hosting -->|"serves"| node_frontend
node_hosting -->|"runs"| node_quart_app

click node_frontend "https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/pages/chat/Chat.tsx"
click node_chat_input "https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/components/QuestionInput/QuestionInput.tsx"
click node_answer_view "https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/components/Answer/Answer.tsx"
click node_analysis_panel "https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/components/AnalysisPanel/AnalysisPanel.tsx"
click node_shopping_ui "https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/components/CartButton/CartButton.tsx"
click node_api_client "https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/api/index.ts"
click node_quart_app "https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/app.py"
click node_config "https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/config.py"
click node_rag "https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/approaches/rag.py"
click node_vector "https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/approaches/vector.py"
click node_keyword "https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/approaches/keyword.py"
click node_summarizer "https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/approaches/summarizer.py"
click node_food_data "https://github.com/eatas-dev/light-up-test/blob/main/src/data/food_items.json"
click node_add_data "https://github.com/eatas-dev/light-up-test/blob/main/src/scripts/add_data.py"
click node_add_rag "https://github.com/eatas-dev/light-up-test/blob/main/functions/AddRagData/function_app.py"
click node_bicep "https://github.com/eatas-dev/light-up-test/blob/main/infra/main.bicep"
click node_hosting "https://github.com/eatas-dev/light-up-test/blob/main/infra/core/host/appservice.bicep"
click node_ai_db "https://github.com/eatas-dev/light-up-test/blob/main/infra/core/ai/cognitiveservices.bicep"
click node_security "https://github.com/eatas-dev/light-up-test/blob/main/infra/core/security/keyvault.bicep"
click node_monitoring "https://github.com/eatas-dev/light-up-test/blob/main/infra/core/monitor/monitoring.bicep"
click node_governance "https://github.com/eatas-dev/light-up-test/blob/main/governance/main.bicep"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_chat_input,node_answer_view,node_analysis_panel,node_shopping_ui,node_api_client toneBlue
class node_quart_app,node_config,node_rag,node_vector,node_keyword,node_summarizer toneAmber
class node_food_data,node_add_data,node_add_rag toneMint
class node_bicep,node_hosting,node_ai_db,node_security,node_monitoring,node_governance toneRose
class node_browser toneNeutral
```

## Components

### Frontend UI

React chat interface and client-side interaction layer.

- [React App](https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/pages/chat/Chat.tsx): vite ui · TypeScript/React frontend for chat, settings, and cart actions. · `frontend/src/pages/chat/Chat.tsx`
- [Chat Input](https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/components/QuestionInput/QuestionInput.tsx): ui component · Collects user questions and voice input. · `frontend/src/components/QuestionInput/QuestionInput.tsx`
- [Answer View](https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/components/Answer/Answer.tsx): ui component · Renders answers, loading, errors, and speech output. · `frontend/src/components/Answer/Answer.tsx`
- [Analysis Panel](https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/components/AnalysisPanel/AnalysisPanel.tsx): ui component · Displays supporting content and thought-process views. · `frontend/src/components/AnalysisPanel/AnalysisPanel.tsx`
- [Cart UI](https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/components/CartButton/CartButton.tsx): ui component · Cart, settings, and purchase interaction controls. · `frontend/src/components/CartButton/CartButton.tsx`
- [API Client](https://github.com/eatas-dev/light-up-test/blob/main/frontend/src/api/index.ts): frontend api · Frontend request layer and client models. · `frontend/src/api/index.ts`

### Quart App

Python application API and retrieval/generation approaches.

- [Quart App](https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/app.py): python web app · Backend application host for chat and orchestration endpoints. · `src/quartapp/app.py`
- [Config](https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/config.py): backend config · Central backend configuration and environment handling. · `src/quartapp/config.py`
- [RAG](https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/approaches/rag.py): approach · Primary retrieval-augmented generation path. · `src/quartapp/approaches/rag.py`
- [Vector Search](https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/approaches/vector.py): approach · Embedding-driven retrieval strategy. · `src/quartapp/approaches/vector.py`
- [Keyword Search](https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/approaches/keyword.py): approach · Fallback lexical retrieval strategy. · `src/quartapp/approaches/keyword.py`
- [Summarizer](https://github.com/eatas-dev/light-up-test/blob/main/src/quartapp/approaches/summarizer.py): approach · Condenses retrieved context into concise responses. · `src/quartapp/approaches/summarizer.py`

### Data Prep

Sample data, ingestion scripts, and serverless augmentation.

- [Food Catalog](https://github.com/eatas-dev/light-up-test/blob/main/src/data/food_items.json): sample data · Seed catalog used for product and menu knowledge. · `src/data/food_items.json`
- [Seeder](https://github.com/eatas-dev/light-up-test/blob/main/src/scripts/add_data.py): python script · Loads sample data into the backend datastore. · `src/scripts/add_data.py`
- [RAG Function](https://github.com/eatas-dev/light-up-test/blob/main/functions/AddRagData/function_app.py): azure function · Serverless ingestion or augmentation entry point. · `functions/AddRagData/function_app.py`

### Azure Platform

Infrastructure, secrets, monitoring, and governance modules.

- [Main Bicep](https://github.com/eatas-dev/light-up-test/blob/main/infra/main.bicep): infra entrypoint · Top-level Azure deployment composition. · `infra/main.bicep`
- [App Service](https://github.com/eatas-dev/light-up-test/blob/main/infra/core/host/appservice.bicep): hosting modules · App Service hosting, app settings, and function hosting modules. · `infra/core/host/appservice.bicep`
- [AI and DB](https://github.com/eatas-dev/light-up-test/blob/main/infra/core/ai/cognitiveservices.bicep): core services · Azure OpenAI and Cosmos DB modules for the application. · `infra/core/ai/cognitiveservices.bicep`
- [Secrets](https://github.com/eatas-dev/light-up-test/blob/main/infra/core/security/keyvault.bicep): security modules · Key Vault, secret, and role wiring for the app. · `infra/core/security/keyvault.bicep`
- [Monitoring](https://github.com/eatas-dev/light-up-test/blob/main/infra/core/monitor/monitoring.bicep): observability · Application Insights and dashboard modules. · `infra/core/monitor/monitoring.bicep`
- [Governance](https://github.com/eatas-dev/light-up-test/blob/main/governance/main.bicep): bicep governance · Management-group, policy, and logging guardrails. · `governance/main.bicep`

### Other components

- **Browser**: user client · End-user entry point for chat and ordering flows.

## Connections

- 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.
