# dm-chelupati/grubify architecture

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

- Interactive diagram: https://gitdiagram.com/dm-chelupati/grubify
- Repository: https://github.com/dm-chelupati/grubify

## Overview

#### Purpose and Entry Points
Grubify is a containerized food-delivery demo: a React single-page frontend drives a .NET 9 REST API for restaurant browsing, cart management, checkout, and order tracking. Runtime entry points are `GrubifyApi/Program.cs` for the API and `grubify-frontend/src/index.tsx` for the browser app. Azure Developer CLI deployment is defined by `azure.yaml`.

#### Frontend Application
The React 18/TypeScript client composes the delivery flow from page-level views: discovery, restaurant menus, cart, checkout, and tracking. Routing/application composition is centralized in `grubify-frontend/src/App.tsx`; page stages reside under `grubify-frontend/src/pages/HomePage.tsx`, `grubify-frontend/src/pages/CheckoutPage.tsx`, and `grubify-frontend/src/pages/OrderTrackingPage.tsx`. Shared navigation is in `grubify-frontend/src/components/Navbar.tsx`.

#### Frontend-to-API Boundary
Browser-side API access is centralized in `grubify-frontend/src/services/api.ts`, with shared client-side domain types in `grubify-frontend/src/types/index.ts`. This is the principal integration boundary: UI pages should consume the service layer rather than directly coupling to backend routes. The production frontend is containerized and served through Nginx via `grubify-frontend/Dockerfile` and `grubify-frontend/nginx.conf`.

#### API Host and HTTP Surface
The ASP.NET Core Web API host configures the HTTP pipeline and service startup in `GrubifyApi/Program.cs`. Controllers expose resource-oriented endpoints for the delivery workflow: restaurants and menus in `GrubifyApi/Controllers/RestaurantsController.cs` and `GrubifyApi/Controllers/FoodItemsController.cs`; carts and orders in `GrubifyApi/Controllers/CartController.cs` and `GrubifyApi/Controllers/OrdersController.cs`. `WeatherForecastController.cs` is a template/diagnostic-style endpoint, not part of the delivery domain.

#### Domain State and Workflow
Core API data contracts are `Restaurant`, `FoodItem`, `Cart`, and `Order` under `GrubifyApi/Models/Restaurant.cs`, `GrubifyApi/Models/Cart.cs`, and `GrubifyApi/Models/Order.cs`. The primary flow is: retrieve restaurants/items, construct or update cart state, create an order during checkout, then retrieve order status for tracking. No persistence layer, database project, or external payment provider is represented in the supplied tree; model/controller behavior is therefore the effective application-state boundary.

#### Container and Azure Deployment
Both application tiers build as separate images using `GrubifyApi/Dockerfile` and `grubify-frontend/Dockerfile`. Azure infrastructure is provisioned with Bicep: `infra/main.bicep` coordinates resources, while `infra/core/host/container-registry.bicep` and `infra/core/host/container-app.bicep` define image registry and Container Apps hosting. The target platform includes Azure Container Registry, Azure Container Apps, and a Container Apps Environment; the README also identifies Log Analytics as deployed observability infrastructure.

#### Operations and Automation
The repo is designed for Azure SRE-agent investigation scenarios, including stated memory-leak and payment-failure testing goals. GitHub Actions automation is defined in `.github/workflows/sre-agent-investigate.yml`. Deployment requires Docker for image builds plus Azure Developer CLI and Azure CLI; the prerequisite validation entry point is `scripts/check-prerequisites.sh`.

Main entry points: [`GrubifyApi/Program.cs`](https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Program.cs) (API host), [`infra/core/host/container-app.bicep`](https://github.com/dm-chelupati/grubify/blob/main/infra/core/host/container-app.bicep) (Container Apps), [`infra/core/host/container-registry.bicep`](https://github.com/dm-chelupati/grubify/blob/main/infra/core/host/container-registry.bicep) (Container Registry), [`infra/main.bicep`](https://github.com/dm-chelupati/grubify/blob/main/infra/main.bicep) (Infrastructure)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_browser(("Browser user<br/>actor"))
  node_frontend_entry["React entry<br/>React bootstrap<br/>[index.tsx]"]
  node_frontend_app["App routing<br/>React composition<br/>[App.tsx]"]
  node_delivery_pages["Delivery pages<br/>React views<br/>[HomePage.tsx]"]
  node_api_client["API service<br/>HTTP client<br/>[api.ts]"]
  node_frontend_container["Frontend image<br/>Nginx container"]
end

subgraph group_api["Delivery API"]
  node_api_host["API host<br/>ASP.NET Core<br/>[Program.cs]"]
  node_catalog_controllers["Catalog endpoints<br/>REST controllers"]
  node_cart_controller["Cart endpoints<br/>REST controller<br/>[CartController.cs]"]
  node_orders_controller["Order endpoints<br/>REST controller"]
  node_domain_models["Delivery state<br/>domain models<br/>[Order.cs]"]
  node_api_container["API image<br/>container image"]
end

subgraph group_platform["Azure deployment"]
  node_azure_deploy["AZD deployment<br/>deployment manifest<br/>[azure.yaml]"]
  node_bicep_orchestration["Infrastructure<br/>Bicep orchestration<br/>[main.bicep]"]
  node_container_registry[("Container Registry<br/>Azure registry")]
  node_container_apps{{"Container Apps<br/>Azure hosting"}}
end

subgraph group_operations["Operations"]
  node_sre_workflow["SRE investigation<br/>GitHub Actions workflow"]
  node_prerequisite_check["Prerequisite check<br/>shell script"]
end

node_browser -->|"loads"| node_frontend_entry
node_frontend_entry -->|"boots"| node_frontend_app
node_frontend_app -->|"routes to"| node_delivery_pages
node_delivery_pages -->|"uses"| node_api_client
node_api_client -->|"REST requests"| node_api_host
node_api_host -->|"routes catalog"| node_catalog_controllers
node_api_host -->|"routes cart"| node_cart_controller
node_api_host -->|"routes orders"| node_orders_controller
node_catalog_controllers -->|"reads catalog"| node_domain_models
node_cart_controller -->|"updates cart"| node_domain_models
node_orders_controller -->|"creates and tracks orders"| node_domain_models
node_frontend_container -.->|"publishes image"| node_container_registry
node_api_container -.->|"publishes image"| node_container_registry
node_container_registry -->|"supplies images"| node_container_apps
node_container_apps -.->|"runs"| node_frontend_container
node_container_apps -.->|"runs"| node_api_container
node_azure_deploy -->|"provisions"| node_bicep_orchestration
node_bicep_orchestration -->|"creates"| node_container_registry
node_bicep_orchestration -->|"creates"| node_container_apps
node_sre_workflow -.->|"investigates deployed system"| node_azure_deploy
node_prerequisite_check -.->|"validates tooling"| node_azure_deploy

click node_frontend_entry "https://github.com/dm-chelupati/grubify/blob/main/grubify-frontend/src/index.tsx"
click node_frontend_app "https://github.com/dm-chelupati/grubify/blob/main/grubify-frontend/src/App.tsx"
click node_delivery_pages "https://github.com/dm-chelupati/grubify/blob/main/grubify-frontend/src/pages/HomePage.tsx"
click node_api_client "https://github.com/dm-chelupati/grubify/blob/main/grubify-frontend/src/services/api.ts"
click node_frontend_container "https://github.com/dm-chelupati/grubify/blob/main/grubify-frontend/Dockerfile"
click node_api_host "https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Program.cs"
click node_catalog_controllers "https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Controllers/RestaurantsController.cs"
click node_cart_controller "https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Controllers/CartController.cs"
click node_orders_controller "https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Controllers/OrdersController.cs"
click node_domain_models "https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Models/Order.cs"
click node_api_container "https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Dockerfile"
click node_azure_deploy "https://github.com/dm-chelupati/grubify/blob/main/azure.yaml"
click node_bicep_orchestration "https://github.com/dm-chelupati/grubify/blob/main/infra/main.bicep"
click node_container_registry "https://github.com/dm-chelupati/grubify/blob/main/infra/core/host/container-registry.bicep"
click node_container_apps "https://github.com/dm-chelupati/grubify/blob/main/infra/core/host/container-app.bicep"
click node_sre_workflow "https://github.com/dm-chelupati/grubify/blob/main/.github/workflows/sre-agent-investigate.yml"
click node_prerequisite_check "https://github.com/dm-chelupati/grubify/blob/main/scripts/check-prerequisites.sh"

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_browser,node_frontend_entry,node_frontend_app,node_delivery_pages,node_api_client,node_frontend_container toneBlue
class node_api_host,node_catalog_controllers,node_cart_controller,node_orders_controller,node_domain_models,node_api_container toneAmber
class node_azure_deploy,node_bicep_orchestration,node_container_registry,node_container_apps toneMint
class node_sre_workflow,node_prerequisite_check toneRose
```

## Components

### Frontend

- **Browser user**: actor
- [React entry](https://github.com/dm-chelupati/grubify/blob/main/grubify-frontend/src/index.tsx): React bootstrap · `grubify-frontend/src/index.tsx`
- [App routing](https://github.com/dm-chelupati/grubify/blob/main/grubify-frontend/src/App.tsx): React composition · `grubify-frontend/src/App.tsx`
- [Delivery pages](https://github.com/dm-chelupati/grubify/blob/main/grubify-frontend/src/pages/HomePage.tsx): React views · Discovery, checkout, and order tracking views. · `grubify-frontend/src/pages/HomePage.tsx`
- [API service](https://github.com/dm-chelupati/grubify/blob/main/grubify-frontend/src/services/api.ts): HTTP client · Principal browser-to-API integration boundary. · `grubify-frontend/src/services/api.ts`
- [Frontend image](https://github.com/dm-chelupati/grubify/blob/main/grubify-frontend/Dockerfile): Nginx container · `grubify-frontend/Dockerfile`

### Delivery API

- [API host](https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Program.cs): ASP.NET Core · Configures HTTP pipeline and service startup. · `GrubifyApi/Program.cs`
- [Catalog endpoints](https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Controllers/RestaurantsController.cs): REST controllers · Restaurant and menu resources. · `GrubifyApi/Controllers/RestaurantsController.cs`
- [Cart endpoints](https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Controllers/CartController.cs): REST controller · `GrubifyApi/Controllers/CartController.cs`
- [Order endpoints](https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Controllers/OrdersController.cs): REST controller · Checkout creation and order-status retrieval. · `GrubifyApi/Controllers/OrdersController.cs`
- [Delivery state](https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Models/Order.cs): domain models · Restaurant, food item, cart, and order contracts form the effective state boundary. · `GrubifyApi/Models/Order.cs`
- [API image](https://github.com/dm-chelupati/grubify/blob/main/GrubifyApi/Dockerfile): container image · `GrubifyApi/Dockerfile`

### Azure deployment

- [AZD deployment](https://github.com/dm-chelupati/grubify/blob/main/azure.yaml): deployment manifest · `azure.yaml`
- [Infrastructure](https://github.com/dm-chelupati/grubify/blob/main/infra/main.bicep): Bicep orchestration · Coordinates Azure resources. · `infra/main.bicep`
- [Container Registry](https://github.com/dm-chelupati/grubify/blob/main/infra/core/host/container-registry.bicep): Azure registry · `infra/core/host/container-registry.bicep`
- [Container Apps](https://github.com/dm-chelupati/grubify/blob/main/infra/core/host/container-app.bicep): Azure hosting · Hosts frontend and API containers in a Container Apps Environment. · `infra/core/host/container-app.bicep`

### Operations

- [SRE investigation](https://github.com/dm-chelupati/grubify/blob/main/.github/workflows/sre-agent-investigate.yml): GitHub Actions workflow · Automation for Azure SRE-agent investigation scenarios. · `.github/workflows/sre-agent-investigate.yml`
- [Prerequisite check](https://github.com/dm-chelupati/grubify/blob/main/scripts/check-prerequisites.sh): shell script · Validates Docker, Azure Developer CLI, and Azure CLI prerequisites. · `scripts/check-prerequisites.sh`

## Connections

- Browser user → React entry: loads
- React entry → App routing: boots
- App routing → Delivery pages: routes to
- Delivery pages → API service: uses
- API service → API host: REST requests
- API host → Catalog endpoints: routes catalog
- API host → Cart endpoints: routes cart
- API host → Order endpoints: routes orders
- Catalog endpoints → Delivery state: reads catalog
- Cart endpoints → Delivery state: updates cart
- Order endpoints → Delivery state: creates and tracks orders
- Frontend image → Container Registry: publishes image
- API image → Container Registry: publishes image
- Container Registry → Container Apps: supplies images
- Container Apps → Frontend image: runs
- Container Apps → API image: runs
- AZD deployment → Infrastructure: provisions
- Infrastructure → Container Registry: creates
- Infrastructure → Container Apps: creates
- SRE investigation → AZD deployment: investigates deployed system
- Prerequisite check → AZD deployment: validates tooling
