# mohitsinghs0/foodfax-shop architecture

> Architecture diagram of the GitHub repository mohitsinghs0/foodfax-shop, 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-shop
- Repository: https://github.com/mohitsinghs0/foodfax-shop

## Overview

FoodFax is a shop-owner dashboard for onboarding and verifying a merchant, then managing its menu, orders, sales, and shop settings. The browser app routes users through authentication and setup into operational screens; shared owner state coordinates much of the application and accesses Supabase. The README describes only a generic AI Studio app, so product capabilities are inferred from the source index and excerpts. Unsampled screens are represented by their paths, but only evidenced relationships are drawn.

Main entry points: [`src/context/OwnerAppContext.tsx`](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/context/OwnerAppContext.tsx) (Owner app state), [`src/App.tsx`](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/App.tsx) (Screen routing), [`src/lib/supabaseClient.ts`](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/lib/supabaseClient.ts) (Supabase client), [`src/screens/ShopSetupScreen.tsx`](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/ShopSetupScreen.tsx) (Shop setup and KYC)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_entry["Web entry<br/>[main.tsx]"]
  node_routing["Screen routing<br/>[App.tsx]"]
end

subgraph group_merchant["Merchant operations"]
  node_auth["Sign-in and registration<br/>[LoginScreen.tsx]"]
  node_setup["Shop setup and KYC"]
  node_kyc["KYC status"]
  node_dashboard["Dashboard"]
  node_menu["Menu management"]
  node_categories["Menu categories"]
  node_orders["Order management<br/>[OrdersScreen.tsx]"]
  node_sales["Sales reporting<br/>[SalesScreen.tsx]"]
  node_shop_profile["Shop profile"]
  node_shop_settings["Shop settings"]
  node_shop_qr["Shop QR<br/>[ShopQrScreen.tsx]"]
  node_analytics["Fulfillment analytics"]
  node_discovery["Customer discovery map"]
  node_proximity["Customer proximity"]
  node_optimization["Optimization diagnostics"]
end

subgraph group_services["State and services"]
  node_owner_state["Owner app state"]
  node_supabase_client["Supabase client<br/>[supabaseClient.ts]"]
  node_supabase[("Supabase")]
  node_order_service["Order service<br/>[orderService.ts]"]
  node_shop_service["Shop service<br/>[shopService.ts]"]
  node_storage["Document and image storage<br/>[storageService.ts]"]
  node_cache["API cache<br/>[apiCache.ts]"]
  node_notifications["Notifications"]
  node_sound["Sound feedback<br/>[soundService.ts]"]
end

subgraph group_security["Security and media"]
  node_auth_security["Authentication safeguards"]
  node_security_utils["Tenant and file validation<br/>[security.ts]"]
  node_image_compression["Image compression"]
end

node_owner(("Shop owner"))

node_owner -->|"opens app"| node_entry
node_entry -->|"renders"| node_routing
node_routing -->|"provides state"| node_owner_state
node_routing -->|"routes to"| node_auth
node_routing -->|"routes to"| node_setup
node_routing -->|"routes to"| node_kyc
node_routing -->|"routes to"| node_dashboard
node_routing -->|"routes to"| node_orders
node_routing -->|"routes to"| node_sales
node_owner_state -->|"gets client"| node_supabase_client
node_supabase_client -->|"connects to"| node_supabase
node_owner_state -->|"validates inputs"| node_security_utils
node_setup -->|"submits shop data"| node_owner_state
node_setup -->|"validates KYC file"| node_security_utils
node_setup -->|"compresses uploads"| node_image_compression
node_storage -->|"validates document"| node_security_utils
node_storage -->|"compresses image"| node_image_compression
node_storage -->|"uploads to"| node_supabase_client
node_orders -->|"uses shared state"| node_owner_state
node_owner_state -.->|"uses service"| node_order_service
node_order_service -->|"queries data"| node_supabase_client
node_shop_service -->|"queries data"| node_supabase_client
node_owner_state -->|"uses notifications"| node_notifications
node_owner_state -->|"uses sound"| node_sound
node_optimization -->|"reads diagnostics"| node_owner_state
node_optimization -->|"inspects cache"| node_cache

click node_entry "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/main.tsx"
click node_routing "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/App.tsx"
click node_auth "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/LoginScreen.tsx"
click node_setup "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/ShopSetupScreen.tsx"
click node_kyc "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/KycStatusScreen.tsx"
click node_dashboard "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/DashboardScreen.tsx"
click node_menu "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/AddEditMenuItemModal.tsx"
click node_categories "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/CategoryManagerModal.tsx"
click node_orders "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/OrdersScreen.tsx"
click node_sales "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/SalesScreen.tsx"
click node_shop_profile "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/ShopProfileModal.tsx"
click node_shop_settings "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/ShopSettingsModal.tsx"
click node_shop_qr "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/ShopQrScreen.tsx"
click node_owner_state "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/context/OwnerAppContext.tsx"
click node_supabase_client "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/lib/supabaseClient.ts"
click node_order_service "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/orderService.ts"
click node_shop_service "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/shopService.ts"
click node_storage "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/storageService.ts"
click node_auth_security "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/authSecurityService.ts"
click node_security_utils "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/utils/security.ts"
click node_image_compression "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/utils/imageCompression.ts"
click node_analytics "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/components/FulfillmentAnalyticsChart.tsx"
click node_discovery "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/components/CustomerDiscoveryMapWidget.tsx"
click node_proximity "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/components/CustomerProximityRadar.tsx"
click node_optimization "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/components/OptimizationDiagnosticsModal.tsx"
click node_cache "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/apiCache.ts"
click node_notifications "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/notificationService.ts"
click node_sound "https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/soundService.ts"

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_entry,node_routing toneBlue
class node_auth,node_setup,node_kyc,node_dashboard,node_menu,node_categories,node_orders,node_sales,node_shop_profile,node_shop_settings,node_shop_qr,node_analytics,node_discovery,node_proximity,node_optimization toneAmber
class node_owner_state,node_supabase_client,node_supabase,node_order_service,node_shop_service,node_storage,node_cache,node_notifications,node_sound toneMint
class node_auth_security,node_security_utils,node_image_compression toneRose
class node_owner toneIndigo
```

## Components

### Application shell

- [Web entry](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/main.tsx): `src/main.tsx`
- [Screen routing](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/App.tsx): `src/App.tsx`

### Merchant operations

- [Sign-in and registration](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/LoginScreen.tsx): `src/screens/LoginScreen.tsx`
- [Shop setup and KYC](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/ShopSetupScreen.tsx): `src/screens/ShopSetupScreen.tsx`
- [KYC status](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/KycStatusScreen.tsx): `src/screens/KycStatusScreen.tsx`
- [Dashboard](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/DashboardScreen.tsx): `src/screens/DashboardScreen.tsx`
- [Menu management](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/AddEditMenuItemModal.tsx): `src/screens/AddEditMenuItemModal.tsx`
- [Menu categories](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/CategoryManagerModal.tsx): `src/screens/CategoryManagerModal.tsx`
- [Order management](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/OrdersScreen.tsx): `src/screens/OrdersScreen.tsx`
- [Sales reporting](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/SalesScreen.tsx): `src/screens/SalesScreen.tsx`
- [Shop profile](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/ShopProfileModal.tsx): `src/screens/ShopProfileModal.tsx`
- [Shop settings](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/ShopSettingsModal.tsx): `src/screens/ShopSettingsModal.tsx`
- [Shop QR](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/screens/ShopQrScreen.tsx): `src/screens/ShopQrScreen.tsx`
- [Fulfillment analytics](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/components/FulfillmentAnalyticsChart.tsx): `src/components/FulfillmentAnalyticsChart.tsx`
- [Customer discovery map](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/components/CustomerDiscoveryMapWidget.tsx): `src/components/CustomerDiscoveryMapWidget.tsx`
- [Customer proximity](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/components/CustomerProximityRadar.tsx): `src/components/CustomerProximityRadar.tsx`
- [Optimization diagnostics](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/components/OptimizationDiagnosticsModal.tsx): `src/components/OptimizationDiagnosticsModal.tsx`

### State and services

- [Owner app state](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/context/OwnerAppContext.tsx): `src/context/OwnerAppContext.tsx`
- [Supabase client](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/lib/supabaseClient.ts): `src/lib/supabaseClient.ts`
- **Supabase**
- [Order service](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/orderService.ts): `src/services/orderService.ts`
- [Shop service](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/shopService.ts): `src/services/shopService.ts`
- [Document and image storage](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/storageService.ts): `src/services/storageService.ts`
- [API cache](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/apiCache.ts): `src/services/apiCache.ts`
- [Notifications](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/notificationService.ts): `src/services/notificationService.ts`
- [Sound feedback](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/soundService.ts): `src/services/soundService.ts`

### Security and media

- [Authentication safeguards](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/services/authSecurityService.ts): `src/services/authSecurityService.ts`
- [Tenant and file validation](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/utils/security.ts): `src/utils/security.ts`
- [Image compression](https://github.com/mohitsinghs0/foodfax-shop/blob/main/src/utils/imageCompression.ts): `src/utils/imageCompression.ts`

### Other components

- **Shop owner**

## Connections

- Shop owner → Web entry: opens app (evidence: `src/main.tsx`)
- Web entry → Screen routing: renders (evidence: `src/main.tsx`)
- Screen routing → Owner app state: provides state (evidence: `src/App.tsx`)
- Screen routing → Sign-in and registration: routes to (evidence: `src/App.tsx`)
- Screen routing → Shop setup and KYC: routes to (evidence: `src/App.tsx`)
- Screen routing → KYC status: routes to (evidence: `src/App.tsx`)
- Screen routing → Dashboard: routes to (evidence: `src/App.tsx`)
- Screen routing → Order management: routes to (evidence: `src/App.tsx`)
- Screen routing → Sales reporting: routes to (evidence: `src/App.tsx`)
- Owner app state → Supabase client: gets client (evidence: `src/context/OwnerAppContext.tsx`)
- Supabase client → Supabase: connects to (evidence: `src/lib/supabaseClient.ts`)
- Owner app state → Tenant and file validation: validates inputs (evidence: `src/context/OwnerAppContext.tsx`)
- Shop setup and KYC → Owner app state: submits shop data (evidence: `src/screens/ShopSetupScreen.tsx`)
- Shop setup and KYC → Tenant and file validation: validates KYC file (evidence: `src/screens/ShopSetupScreen.tsx`)
- Shop setup and KYC → Image compression: compresses uploads (evidence: `src/screens/ShopSetupScreen.tsx`)
- Document and image storage → Tenant and file validation: validates document (evidence: `src/services/storageService.ts`)
- Document and image storage → Image compression: compresses image (evidence: `src/services/storageService.ts`)
- Document and image storage → Supabase client: uploads to (evidence: `src/services/storageService.ts`)
- Order management → Owner app state: uses shared state (evidence: `src/screens/OrdersScreen.tsx`)
- Owner app state → Order service: uses service
- Order service → Supabase client: queries data (evidence: `src/services/orderService.ts`)
- Shop service → Supabase client: queries data (evidence: `src/services/shopService.ts`)
- Owner app state → Notifications: uses notifications (evidence: `src/context/OwnerAppContext.tsx`)
- Owner app state → Sound feedback: uses sound (evidence: `src/context/OwnerAppContext.tsx`)
- Optimization diagnostics → Owner app state: reads diagnostics (evidence: `src/components/OptimizationDiagnosticsModal.tsx`)
- Optimization diagnostics → API cache: inspects cache (evidence: `src/components/OptimizationDiagnosticsModal.tsx`)
