# mohitsinghs0/foodfax architecture

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

- Interactive diagram: https://gitdiagram.com/mohitsinghs0/foodfax
- Repository: https://github.com/mohitsinghs0/foodfax

## Overview

FoodFax is a customer-facing counter-ordering app for nearby food stalls, with cart, checkout, token tracking, and order history. Its documented product also includes stall operations, payments, accessibility, location tools, reviews, and spending analytics. The graph emphasizes the customer workflow and major documented capabilities; unsampled features are included where the tree or README supports them. Some subsystem links are omitted because the available excerpts do not establish their runtime callers.

Main entry points: [`src/services/orderService.ts`](https://github.com/mohitsinghs0/foodfax/blob/main/src/services/orderService.ts) (Order Lifecycle), [`src/services/shopService.ts`](https://github.com/mohitsinghs0/foodfax/blob/main/src/services/shopService.ts) (Stall and Location Data), [`src/App.tsx`](https://github.com/mohitsinghs0/foodfax/blob/main/src/App.tsx) (App Shell and Routing), [`src/views/SearchView.tsx`](https://github.com/mohitsinghs0/foodfax/blob/main/src/views/SearchView.tsx) (Search Stalls and Dishes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Customer App"]
  node_app["App Shell and Routing<br/>[App.tsx]"]
  node_discovery["Browse and Discover<br/>[HomeView.tsx]"]
  node_search["Search Stalls and Dishes<br/>[SearchView.tsx]"]
  node_shop["Stall Menu<br/>[ShopDetailView.tsx]"]
end

subgraph group_commerce["Ordering and Tracking"]
  node_cart["Cart State<br/>[CartContext.tsx]"]
  node_checkout["Checkout<br/>[CheckoutView.tsx]"]
  node_orders["Order Lifecycle<br/>[orderService.ts]"]
  node_tracking["Live Token Tracker"]
  node_history["History and Spending"]
  node_reviews["Ratings and Reviews"]
end

subgraph group_data["Data and Identity"]
  node_shops["Stall and Location Data<br/>[shopService.ts]"]
  node_menus["Menu Data<br/>[menuService.ts]"]
  node_sync["Supabase Data Access"]
  node_database[("Supabase<br/>[supabase.ts]")]
  node_auth["Authentication and Profiles<br/>[authService.ts]"]
  node_payment["Payment APIs and Handler<br/>[create-order.ts]"]
  node_cancel["Order Cancellation API<br/>[cancel.ts]"]
end

subgraph group_capabilities["Product Capabilities"]
  node_kitchen["Stall Kitchen Terminal"]
  node_accessibility["Accessibility and Audio"]
  node_qr["QR Counter Ordering<br/>[QRScanModal.tsx]"]
  node_avatar["Camera Profile Avatar"]
  node_maps["Stall Navigation"]
end

node_customer(("Customer"))

node_customer -->|"uses"| node_app
node_app -->|"routes to"| node_discovery
node_app -->|"routes to"| node_search
node_app -->|"routes to"| node_shop
node_discovery -.->|"browses"| node_shops
node_search -->|"queries"| node_shops
node_search -->|"queries"| node_menus
node_shop -.->|"loads menu"| node_menus
node_customer -->|"adds items"| node_cart
node_cart -.->|"continues to"| node_checkout
node_checkout -.->|"places order"| node_orders
node_cart -->|"creates order"| node_orders
node_orders -->|"uses"| node_sync
node_sync -->|"reads and writes"| node_database
node_orders -.->|"updates status"| node_tracking
node_customer -->|"tracks token"| node_tracking
node_customer -->|"reviews spending"| node_history
node_customer -->|"submits feedback"| node_reviews
node_reviews -->|"submits review"| node_orders
node_customer -.->|"pays by UPI"| node_payment
node_customer -.->|"requests cancellation"| node_cancel
node_customer -.->|"stall operations"| node_kitchen
node_customer -->|"sets preferences"| node_accessibility
node_customer -->|"scans stall QR"| node_qr
node_customer -->|"captures profile photo"| node_avatar
node_customer -->|"opens directions"| node_maps
node_auth -->|"loads owner shop"| node_shops
node_shops -->|"uses"| node_sync
node_shops -->|"checks configuration"| node_database

click node_app "https://github.com/mohitsinghs0/foodfax/blob/main/src/App.tsx"
click node_discovery "https://github.com/mohitsinghs0/foodfax/blob/main/src/views/HomeView.tsx"
click node_search "https://github.com/mohitsinghs0/foodfax/blob/main/src/views/SearchView.tsx"
click node_shop "https://github.com/mohitsinghs0/foodfax/blob/main/src/views/ShopDetailView.tsx"
click node_cart "https://github.com/mohitsinghs0/foodfax/blob/main/src/context/CartContext.tsx"
click node_checkout "https://github.com/mohitsinghs0/foodfax/blob/main/src/views/CheckoutView.tsx"
click node_orders "https://github.com/mohitsinghs0/foodfax/blob/main/src/services/orderService.ts"
click node_tracking "https://github.com/mohitsinghs0/foodfax/blob/main/src/components/order/LiveOrderTracker.tsx"
click node_history "https://github.com/mohitsinghs0/foodfax/blob/main/src/views/OrdersHistoryView.tsx"
click node_reviews "https://github.com/mohitsinghs0/foodfax/blob/main/src/components/order/OrderRatingReview.tsx"
click node_shops "https://github.com/mohitsinghs0/foodfax/blob/main/src/services/shopService.ts"
click node_menus "https://github.com/mohitsinghs0/foodfax/blob/main/src/services/menuService.ts"
click node_sync "https://github.com/mohitsinghs0/foodfax/blob/main/src/services/firestoreSyncService.ts"
click node_database "https://github.com/mohitsinghs0/foodfax/blob/main/src/supabase.ts"
click node_auth "https://github.com/mohitsinghs0/foodfax/blob/main/src/services/authService.ts"
click node_payment "https://github.com/mohitsinghs0/foodfax/blob/main/api/payment/create-order.ts"
click node_cancel "https://github.com/mohitsinghs0/foodfax/blob/main/api/order/cancel.ts"
click node_kitchen "https://github.com/mohitsinghs0/foodfax/tree/main/src"
click node_accessibility "https://github.com/mohitsinghs0/foodfax/blob/main/src/context/AccessibilityContext.tsx"
click node_qr "https://github.com/mohitsinghs0/foodfax/blob/main/src/components/common/QRScanModal.tsx"
click node_avatar "https://github.com/mohitsinghs0/foodfax/blob/main/src/components/profile/CameraAvatarModal.tsx"
click node_maps "https://github.com/mohitsinghs0/foodfax/blob/main/src/components/order/ShopDirectionMap.tsx"

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_app,node_discovery,node_search,node_shop toneBlue
class node_cart,node_checkout,node_orders,node_tracking,node_history,node_reviews toneAmber
class node_shops,node_menus,node_sync,node_database,node_auth,node_payment,node_cancel toneMint
class node_kitchen,node_accessibility,node_qr,node_avatar,node_maps toneRose
class node_customer toneIndigo
```

## Components

### Customer App

- [App Shell and Routing](https://github.com/mohitsinghs0/foodfax/blob/main/src/App.tsx): `src/App.tsx`
- [Browse and Discover](https://github.com/mohitsinghs0/foodfax/blob/main/src/views/HomeView.tsx): `src/views/HomeView.tsx`
- [Search Stalls and Dishes](https://github.com/mohitsinghs0/foodfax/blob/main/src/views/SearchView.tsx): `src/views/SearchView.tsx`
- [Stall Menu](https://github.com/mohitsinghs0/foodfax/blob/main/src/views/ShopDetailView.tsx): `src/views/ShopDetailView.tsx`

### Ordering and Tracking

- [Cart State](https://github.com/mohitsinghs0/foodfax/blob/main/src/context/CartContext.tsx): `src/context/CartContext.tsx`
- [Checkout](https://github.com/mohitsinghs0/foodfax/blob/main/src/views/CheckoutView.tsx): `src/views/CheckoutView.tsx`
- [Order Lifecycle](https://github.com/mohitsinghs0/foodfax/blob/main/src/services/orderService.ts): `src/services/orderService.ts`
- [Live Token Tracker](https://github.com/mohitsinghs0/foodfax/blob/main/src/components/order/LiveOrderTracker.tsx): `src/components/order/LiveOrderTracker.tsx`
- [History and Spending](https://github.com/mohitsinghs0/foodfax/blob/main/src/views/OrdersHistoryView.tsx): `src/views/OrdersHistoryView.tsx`
- [Ratings and Reviews](https://github.com/mohitsinghs0/foodfax/blob/main/src/components/order/OrderRatingReview.tsx): `src/components/order/OrderRatingReview.tsx`

### Data and Identity

- [Stall and Location Data](https://github.com/mohitsinghs0/foodfax/blob/main/src/services/shopService.ts): `src/services/shopService.ts`
- [Menu Data](https://github.com/mohitsinghs0/foodfax/blob/main/src/services/menuService.ts): `src/services/menuService.ts`
- [Supabase Data Access](https://github.com/mohitsinghs0/foodfax/blob/main/src/services/firestoreSyncService.ts): `src/services/firestoreSyncService.ts`
- [Supabase](https://github.com/mohitsinghs0/foodfax/blob/main/src/supabase.ts): `src/supabase.ts`
- [Authentication and Profiles](https://github.com/mohitsinghs0/foodfax/blob/main/src/services/authService.ts): `src/services/authService.ts`
- [Payment APIs and Handler](https://github.com/mohitsinghs0/foodfax/blob/main/api/payment/create-order.ts): `api/payment/create-order.ts`
- [Order Cancellation API](https://github.com/mohitsinghs0/foodfax/blob/main/api/order/cancel.ts): `api/order/cancel.ts`

### Product Capabilities

- [Stall Kitchen Terminal](https://github.com/mohitsinghs0/foodfax/tree/main/src): `src`
- [Accessibility and Audio](https://github.com/mohitsinghs0/foodfax/blob/main/src/context/AccessibilityContext.tsx): `src/context/AccessibilityContext.tsx`
- [QR Counter Ordering](https://github.com/mohitsinghs0/foodfax/blob/main/src/components/common/QRScanModal.tsx): `src/components/common/QRScanModal.tsx`
- [Camera Profile Avatar](https://github.com/mohitsinghs0/foodfax/blob/main/src/components/profile/CameraAvatarModal.tsx): `src/components/profile/CameraAvatarModal.tsx`
- [Stall Navigation](https://github.com/mohitsinghs0/foodfax/blob/main/src/components/order/ShopDirectionMap.tsx): `src/components/order/ShopDirectionMap.tsx`

### Other components

- **Customer**

## Connections

- Customer → App Shell and Routing: uses
- App Shell and Routing → Browse and Discover: routes to (evidence: `src/App.tsx`)
- App Shell and Routing → Search Stalls and Dishes: routes to (evidence: `src/App.tsx`)
- App Shell and Routing → Stall Menu: routes to (evidence: `src/App.tsx`)
- Browse and Discover → Stall and Location Data: browses
- Search Stalls and Dishes → Stall and Location Data: queries (evidence: `src/views/SearchView.tsx`)
- Search Stalls and Dishes → Menu Data: queries (evidence: `src/views/SearchView.tsx`)
- Stall Menu → Menu Data: loads menu
- Customer → Cart State: adds items
- Cart State → Checkout: continues to
- Checkout → Order Lifecycle: places order
- Cart State → Order Lifecycle: creates order (evidence: `src/context/CartContext.tsx`)
- Order Lifecycle → Supabase Data Access: uses (evidence: `src/services/orderService.ts`)
- Supabase Data Access → Supabase: reads and writes (evidence: `src/services/firestoreSyncService.ts`)
- Order Lifecycle → Live Token Tracker: updates status
- Customer → Live Token Tracker: tracks token
- Customer → History and Spending: reviews spending
- Customer → Ratings and Reviews: submits feedback (evidence: `src/components/order/OrderRatingReview.tsx`)
- Ratings and Reviews → Order Lifecycle: submits review (evidence: `src/components/order/OrderRatingReview.tsx`)
- Customer → Payment APIs and Handler: pays by UPI
- Customer → Order Cancellation API: requests cancellation
- Customer → Stall Kitchen Terminal: stall operations
- Customer → Accessibility and Audio: sets preferences
- Customer → QR Counter Ordering: scans stall QR
- Customer → Camera Profile Avatar: captures profile photo
- Customer → Stall Navigation: opens directions
- Authentication and Profiles → Stall and Location Data: loads owner shop (evidence: `src/services/authService.ts`)
- Stall and Location Data → Supabase Data Access: uses (evidence: `src/services/shopService.ts`)
- Stall and Location Data → Supabase: checks configuration (evidence: `src/services/shopService.ts`)
