# doctorpraveen2011-netizen/food-coverinig- architecture

> Architecture diagram of the GitHub repository doctorpraveen2011-netizen/food-coverinig-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/doctorpraveen2011-netizen/food-coverinig-
- Repository: https://github.com/doctorpraveen2011-netizen/food-coverinig-

## Overview

FoodCovering 2.0 combines role-scoped food-safety operations and community surplus donations across citizen, supermarket, and head-office dashboards. The main workflow is authentication, role-based access, then donation, complaint, inventory, and tracking activity backed by the server and persistent data. AI food-waste scanning, alerts, reporting, fleet telemetry, and telecom are additional capabilities. Edges reflect README statements or shown imports/calls; some feature implementations and server route registrations were not sampled, so their connections are omitted rather than inferred.

Main entry points: [`src/App.tsx`](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/src/App.tsx) (Role router), [`server/src/db.ts`](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/db.ts) (Application data), [`server/src/index.ts`](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/index.ts) (Express API), [`src/pages/supermarket`](https://github.com/doctorpraveen2011-netizen/food-coverinig-/tree/main/src/pages/supermarket) (Store operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Role router<br/>[App.tsx]"]
  node_login["Login and registration"]
end

subgraph group_identity["Identity and access"]
  node_authui["Auth state<br/>[useAuthStore.ts]"]
  node_auth["JWT and RBAC<br/>[auth.ts]"]
  node_authroutes["Authentication API<br/>[authRoutes.ts]"]
end

subgraph group_operations["Food operations"]
  node_userops["Citizen operations"]
  node_storeops["Store operations"]
  node_adminops["Head-office controls"]
  node_donations["Donation lifecycle<br/>[userRoutes.ts]"]
  node_complaints["Complaint handling<br/>[userRoutes.ts]"]
  node_inventory["Inventory management"]
  node_adminroutes["Administration API<br/>[adminRoutes.ts]"]
end

subgraph group_platform["Server platform"]
  node_api["Express API<br/>[index.ts]"]
  node_db[("Application data<br/>[db.ts]")]
  node_events["Live events<br/>[events.ts]"]
end

subgraph group_intelligence["Analysis and integrations"]
  node_ai["Food-waste scanning"]
  node_mlinfer["Model inference<br/>[infer.py]"]
  node_mlpipeline["Dataset pipeline"]
  node_alerts["Alerts and notifications<br/>[useAlertsStore.ts]"]
  node_telemetry["Sensor telemetry<br/>[sensorService.ts]"]
  node_telecom["Telecom service<br/>[telecomService.ts]"]
end

node_user(("Users"))

node_user -->|"uses dashboards"| node_app
node_app -->|"checks session"| node_authui
node_app -->|"routes to"| node_login
node_app -->|"routes by role"| node_userops
node_app -->|"routes by role"| node_storeops
node_app -->|"routes by role"| node_adminops
node_authui -->|"sends credentials"| node_authroutes
node_api -->|"mounts routes"| node_authroutes
node_api -->|"mounts routes"| node_adminroutes
node_authroutes -->|"uses token controls"| node_auth
node_auth -->|"looks up users"| node_db
node_userops -->|"manages donations"| node_donations
node_userops -->|"submits complaints"| node_complaints
node_storeops -->|"manages stock"| node_inventory
node_storeops -->|"queues surplus"| node_donations
node_adminops -->|"performs oversight"| node_adminroutes
node_donations -->|"reads and writes"| node_db
node_complaints -->|"reads and writes"| node_db
node_inventory -->|"reads and writes"| node_db
node_adminroutes -->|"reads and writes"| node_db
node_inventory -->|"broadcasts updates"| node_events
node_complaints -->|"broadcasts updates"| node_events
node_ai -.->|"may request inference"| node_mlinfer
node_mlpipeline -.->|"may prepare model data"| node_mlinfer
node_storeops -.->|"uses alert state"| node_alerts
node_api -->|"uses telemetry"| node_telemetry
node_api -->|"uses calling service"| node_telecom

click node_app "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/src/App.tsx"
click node_authui "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/src/store/useAuthStore.ts"
click node_login "https://github.com/doctorpraveen2011-netizen/food-coverinig-/tree/main/src/pages"
click node_userops "https://github.com/doctorpraveen2011-netizen/food-coverinig-/tree/main/src/pages/user"
click node_storeops "https://github.com/doctorpraveen2011-netizen/food-coverinig-/tree/main/src/pages/supermarket"
click node_adminops "https://github.com/doctorpraveen2011-netizen/food-coverinig-/tree/main/src/pages/admin"
click node_donations "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/routes/userRoutes.ts"
click node_complaints "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/routes/userRoutes.ts"
click node_inventory "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/routes/supermarketRoutes.ts"
click node_adminroutes "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/routes/adminRoutes.ts"
click node_ai "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/src/pages/AiFoodWasteScan.tsx"
click node_mlinfer "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/ml/infer.py"
click node_mlpipeline "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/ml/dataset_pipeline.py"
click node_alerts "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/src/store/useAlertsStore.ts"
click node_telemetry "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/sensorService.ts"
click node_telecom "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/services/telecomService.ts"
click node_api "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/index.ts"
click node_auth "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/auth.ts"
click node_authroutes "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/routes/authRoutes.ts"
click node_db "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/db.ts"
click node_events "https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/events.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_app,node_login,node_user toneBlue
class node_authui,node_auth,node_authroutes toneAmber
class node_userops,node_storeops,node_adminops,node_donations,node_complaints,node_inventory,node_adminroutes toneMint
class node_api,node_db,node_events toneRose
class node_ai,node_mlinfer,node_mlpipeline,node_alerts,node_telemetry,node_telecom toneIndigo
```

## Components

### Web application

- [Role router](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/src/App.tsx): `src/App.tsx`
- [Login and registration](https://github.com/doctorpraveen2011-netizen/food-coverinig-/tree/main/src/pages): `src/pages`

### Identity and access

- [Auth state](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/src/store/useAuthStore.ts): `src/store/useAuthStore.ts`
- [JWT and RBAC](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/auth.ts): `server/src/auth.ts`
- [Authentication API](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/routes/authRoutes.ts): `server/src/routes/authRoutes.ts`

### Food operations

- [Citizen operations](https://github.com/doctorpraveen2011-netizen/food-coverinig-/tree/main/src/pages/user): `src/pages/user`
- [Store operations](https://github.com/doctorpraveen2011-netizen/food-coverinig-/tree/main/src/pages/supermarket): `src/pages/supermarket`
- [Head-office controls](https://github.com/doctorpraveen2011-netizen/food-coverinig-/tree/main/src/pages/admin): `src/pages/admin`
- [Donation lifecycle](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/routes/userRoutes.ts): `server/src/routes/userRoutes.ts`
- [Complaint handling](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/routes/userRoutes.ts): `server/src/routes/userRoutes.ts`
- [Inventory management](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/routes/supermarketRoutes.ts): `server/src/routes/supermarketRoutes.ts`
- [Administration API](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/routes/adminRoutes.ts): `server/src/routes/adminRoutes.ts`

### Server platform

- [Express API](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/index.ts): `server/src/index.ts`
- [Application data](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/db.ts): `server/src/db.ts`
- [Live events](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/events.ts): `server/src/events.ts`

### Analysis and integrations

- [Food-waste scanning](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/src/pages/AiFoodWasteScan.tsx): `src/pages/AiFoodWasteScan.tsx`
- [Model inference](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/ml/infer.py): `ml/infer.py`
- [Dataset pipeline](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/ml/dataset_pipeline.py): `ml/dataset_pipeline.py`
- [Alerts and notifications](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/src/store/useAlertsStore.ts): `src/store/useAlertsStore.ts`
- [Sensor telemetry](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/sensorService.ts): `server/src/sensorService.ts`
- [Telecom service](https://github.com/doctorpraveen2011-netizen/food-coverinig-/blob/main/server/src/services/telecomService.ts): `server/src/services/telecomService.ts`

### Other components

- **Users**

## Connections

- Users → Role router: uses dashboards
- Role router → Auth state: checks session (evidence: `src/App.tsx`)
- Role router → Login and registration: routes to (evidence: `src/App.tsx`)
- Role router → Citizen operations: routes by role (evidence: `src/App.tsx`)
- Role router → Store operations: routes by role (evidence: `src/App.tsx`)
- Role router → Head-office controls: routes by role (evidence: `src/App.tsx`)
- Auth state → Authentication API: sends credentials (evidence: `src/store/useAuthStore.ts`)
- Express API → Authentication API: mounts routes (evidence: `server/src/index.ts`)
- Express API → Administration API: mounts routes (evidence: `server/src/index.ts`)
- Authentication API → JWT and RBAC: uses token controls (evidence: `server/src/routes/authRoutes.ts`)
- JWT and RBAC → Application data: looks up users (evidence: `server/src/auth.ts`)
- Citizen operations → Donation lifecycle: manages donations
- Citizen operations → Complaint handling: submits complaints
- Store operations → Inventory management: manages stock
- Store operations → Donation lifecycle: queues surplus
- Head-office controls → Administration API: performs oversight
- Donation lifecycle → Application data: reads and writes (evidence: `server/src/routes/userRoutes.ts`)
- Complaint handling → Application data: reads and writes (evidence: `server/src/routes/userRoutes.ts`)
- Inventory management → Application data: reads and writes (evidence: `server/src/routes/supermarketRoutes.ts`)
- Administration API → Application data: reads and writes (evidence: `server/src/routes/adminRoutes.ts`)
- Inventory management → Live events: broadcasts updates (evidence: `server/src/routes/supermarketRoutes.ts`)
- Complaint handling → Live events: broadcasts updates (evidence: `server/src/routes/userRoutes.ts`)
- Food-waste scanning → Model inference: may request inference
- Dataset pipeline → Model inference: may prepare model data
- Store operations → Alerts and notifications: uses alert state
- Express API → Sensor telemetry: uses telemetry (evidence: `server/src/index.ts`)
- Express API → Telecom service: uses calling service (evidence: `server/src/index.ts`)
