# manavarya09/restaurant-ai architecture

> Architecture diagram of the GitHub repository manavarya09/restaurant-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manavarya09/restaurant-ai
- Repository: https://github.com/manavarya09/restaurant-ai

## Overview

Restaurant AI is a computer-vision analytics system for turning CCTV or recorded video into customer-flow and service insights. Its principal runtime path is a video-analysis request to the FastAPI backend, which processes frames with person detection and tracking, then exposes analytics through API routes and a dashboard. Domain stages include footfall, zones, staff activity, and wait-time analysis; supporting branches cover advanced AI capabilities, dataset preparation and model training, and edge deployment. The README documents the workflow, but sampled backend excerpts omit much of the frame-processing implementation, so some internal links remain unverified.

Main entry points: [`app/main.py`](https://github.com/manavarya09/restaurant-ai/blob/main/app/main.py) (FastAPI backend), [`utils/analytics.py`](https://github.com/manavarya09/restaurant-ai/blob/main/utils/analytics.py) (Flow analytics), [`utils/deployment.py`](https://github.com/manavarya09/restaurant-ai/blob/main/utils/deployment.py) (Edge deployment), [`app/pro.html`](https://github.com/manavarya09/restaurant-ai/blob/main/app/pro.html) (Web dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and dashboard"]
  node_backend["FastAPI backend<br/>[main.py]"]
  node_dashboard["Web dashboard<br/>[pro.html]"]
end

subgraph group_vision["Video analysis"]
  node_detector["Person detection<br/>[detection.py]"]
  node_tracker["Object tracking<br/>[tracking.py]"]
end

subgraph group_insights["Restaurant insights"]
  node_analytics["Flow analytics<br/>[analytics.py]"]
  node_advanced["Advanced analytics"]
  node_visualization["Plots and heatmaps<br/>[visualization.py]"]
end

subgraph group_model["AI and training"]
  node_ai_features["AI features<br/>[ai_features.py]"]
  node_more_ai["Extended AI<br/>[more_ai.py]"]
  node_dataset["Dataset tools<br/>[dataset.py]"]
  node_training["Model training<br/>[train.py]"]
end

subgraph group_operations["Deployment and storage"]
  node_deployment["Edge deployment<br/>[deployment.py]"]
  node_storage[("Analytics storage<br/>[storage.py]")]
end

node_operator(("Restaurant operator"))
node_video["Video feed"]

node_operator -->|"requests analysis"| node_backend
node_video -->|"submits frames"| node_backend
node_backend -->|"detects people"| node_detector
node_backend -->|"tracks people"| node_tracker
node_backend -->|"computes insights"| node_analytics
node_backend -->|"serves dashboard"| node_dashboard
node_operator -.->|"views results"| node_dashboard
node_analytics -.->|"visualizes results"| node_visualization
node_backend -.->|"may use"| node_advanced
node_backend -.->|"may use"| node_ai_features
node_backend -.->|"may use"| node_more_ai
node_dataset -.->|"prepares data"| node_training
node_deployment -.->|"integrates"| node_detector
node_deployment -.->|"integrates"| node_tracker
node_deployment -.->|"integrates"| node_analytics
node_analytics -.->|"persists metrics"| node_storage

click node_backend "https://github.com/manavarya09/restaurant-ai/blob/main/app/main.py"
click node_dashboard "https://github.com/manavarya09/restaurant-ai/blob/main/app/pro.html"
click node_detector "https://github.com/manavarya09/restaurant-ai/blob/main/utils/detection.py"
click node_tracker "https://github.com/manavarya09/restaurant-ai/blob/main/utils/tracking.py"
click node_analytics "https://github.com/manavarya09/restaurant-ai/blob/main/utils/analytics.py"
click node_advanced "https://github.com/manavarya09/restaurant-ai/blob/main/utils/advanced_analytics.py"
click node_visualization "https://github.com/manavarya09/restaurant-ai/blob/main/utils/visualization.py"
click node_ai_features "https://github.com/manavarya09/restaurant-ai/blob/main/utils/ai_features.py"
click node_more_ai "https://github.com/manavarya09/restaurant-ai/blob/main/utils/more_ai.py"
click node_dataset "https://github.com/manavarya09/restaurant-ai/blob/main/utils/dataset.py"
click node_training "https://github.com/manavarya09/restaurant-ai/blob/main/utils/train.py"
click node_deployment "https://github.com/manavarya09/restaurant-ai/blob/main/utils/deployment.py"
click node_storage "https://github.com/manavarya09/restaurant-ai/blob/main/utils/storage.py"

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_backend,node_dashboard toneBlue
class node_detector,node_tracker toneAmber
class node_analytics,node_advanced,node_visualization toneMint
class node_ai_features,node_more_ai,node_dataset,node_training toneRose
class node_deployment,node_storage,node_operator,node_video toneIndigo
```

## Components

### API and dashboard

- [FastAPI backend](https://github.com/manavarya09/restaurant-ai/blob/main/app/main.py): `app/main.py`
- [Web dashboard](https://github.com/manavarya09/restaurant-ai/blob/main/app/pro.html): `app/pro.html`

### Video analysis

- [Person detection](https://github.com/manavarya09/restaurant-ai/blob/main/utils/detection.py): `utils/detection.py`
- [Object tracking](https://github.com/manavarya09/restaurant-ai/blob/main/utils/tracking.py): `utils/tracking.py`

### Restaurant insights

- [Flow analytics](https://github.com/manavarya09/restaurant-ai/blob/main/utils/analytics.py): `utils/analytics.py`
- [Advanced analytics](https://github.com/manavarya09/restaurant-ai/blob/main/utils/advanced_analytics.py): `utils/advanced_analytics.py`
- [Plots and heatmaps](https://github.com/manavarya09/restaurant-ai/blob/main/utils/visualization.py): `utils/visualization.py`

### AI and training

- [AI features](https://github.com/manavarya09/restaurant-ai/blob/main/utils/ai_features.py): `utils/ai_features.py`
- [Extended AI](https://github.com/manavarya09/restaurant-ai/blob/main/utils/more_ai.py): `utils/more_ai.py`
- [Dataset tools](https://github.com/manavarya09/restaurant-ai/blob/main/utils/dataset.py): `utils/dataset.py`
- [Model training](https://github.com/manavarya09/restaurant-ai/blob/main/utils/train.py): `utils/train.py`

### Deployment and storage

- [Edge deployment](https://github.com/manavarya09/restaurant-ai/blob/main/utils/deployment.py): `utils/deployment.py`
- [Analytics storage](https://github.com/manavarya09/restaurant-ai/blob/main/utils/storage.py): `utils/storage.py`

### Other components

- **Restaurant operator**
- **Video feed**

## Connections

- Restaurant operator → FastAPI backend: requests analysis (evidence: `README.md`)
- Video feed → FastAPI backend: submits frames (evidence: `README.md`)
- FastAPI backend → Person detection: detects people (evidence: `README.md`)
- FastAPI backend → Object tracking: tracks people (evidence: `README.md`)
- FastAPI backend → Flow analytics: computes insights (evidence: `README.md`)
- FastAPI backend → Web dashboard: serves dashboard (evidence: `app/main.py`)
- Restaurant operator → Web dashboard: views results (evidence: `README.md`)
- Flow analytics → Plots and heatmaps: visualizes results (evidence: `README.md`)
- FastAPI backend → Advanced analytics: may use
- FastAPI backend → AI features: may use
- FastAPI backend → Extended AI: may use
- Dataset tools → Model training: prepares data
- Edge deployment → Person detection: integrates (evidence: `utils/deployment.py`)
- Edge deployment → Object tracking: integrates (evidence: `utils/deployment.py`)
- Edge deployment → Flow analytics: integrates (evidence: `utils/deployment.py`)
- Flow analytics → Analytics storage: persists metrics
