# codewithyogeshh/foodbridge__v0 architecture

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

- Interactive diagram: https://gitdiagram.com/codewithyogeshh/foodbridge__v0
- Repository: https://github.com/codewithyogeshh/foodbridge__v0

## Overview

FoodBridge is a multi-role surplus food, clothing, and donation coordination platform. Its documented workflow is login, role-specific registration and dashboards, then donation or surplus rescue coordination with delivery tracking and administrative verification. The README documents Firebase synchronization with local fallback and UPI donation auditing; sampled database code confirms the central data/session engine and bank-credit handling. Dashboard-page wiring was not sampled, so links below reflect documented flows rather than inspected page calls.

Main entry points: [`js/db.js`](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/js/db.js) (Database & sessions), [`login.html`](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/login.html) (Email login), [`admin-dashboard.html`](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/admin-dashboard.html) (Admin portal), [`index.html`](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/index.html) (Platform entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access &amp; Roles"]
  node_entry["Platform entry<br/>[index.html]"]
  node_login["Email login<br/>[login.html]"]
end

subgraph group_onboarding["Registration &amp; Verification"]
  node_ngo_register["NGO registration<br/>[register-ngo.html]"]
  node_partner_register["Partner registration"]
  node_donor_register["Donor registration"]
  node_volunteer_register["Volunteer registration"]
  node_admin["Admin portal"]
end

subgraph group_rescue["Surplus Rescue"]
  node_ngo["NGO dashboard<br/>[ngo-dashboard.html]"]
  node_restaurant["Restaurant dashboard"]
  node_volunteer["Volunteer dashboard"]
  node_tracking["Delivery tracking<br/>[track.html]"]
end

subgraph group_giving["Donations &amp; Audit"]
  node_donate["UPI donation<br/>[donate.html]"]
  node_donor["Donor dashboard"]
end

subgraph group_platform["Data Platform"]
  node_db["Database &amp; sessions<br/>[db.js]"]
  node_firebase[("Firebase services")]
  node_local[("Browser LocalStorage")]
end

node_user(("Platform user"))

node_user -->|"opens"| node_entry
node_entry -->|"requires login"| node_login
node_user -->|"authenticates"| node_login
node_user -->|"registers NGO"| node_ngo_register
node_user -->|"registers partner"| node_partner_register
node_user -->|"registers donor"| node_donor_register
node_user -->|"registers volunteer"| node_volunteer_register
node_login -->|"uses sessions"| node_db
node_ngo_register -->|"stores profile"| node_db
node_partner_register -->|"stores profile"| node_db
node_donor_register -->|"stores profile"| node_db
node_volunteer_register -->|"stores profile"| node_db
node_login -->|"routes NGO"| node_ngo
node_login -->|"routes partner"| node_restaurant
node_login -->|"routes volunteer"| node_volunteer
node_login -->|"routes donor"| node_donor
node_login -->|"routes admin"| node_admin
node_admin -->|"verifies applications"| node_db
node_restaurant -->|"posts surplus"| node_db
node_ngo -->|"claims surplus"| node_db
node_volunteer -->|"updates delivery"| node_db
node_tracking -->|"reads delivery status"| node_db
node_user -->|"donates"| node_donate
node_donate -->|"records donation"| node_db
node_donor -->|"views donations"| node_db
node_admin -->|"audits bank credits"| node_db
node_db -.->|"syncs data"| node_firebase
node_db -->|"falls back"| node_local

click node_entry "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/index.html"
click node_login "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/login.html"
click node_ngo_register "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/register-ngo.html"
click node_partner_register "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/register-partner.html"
click node_donor_register "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/register-donor.html"
click node_volunteer_register "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/register-volunteer.html"
click node_admin "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/admin-dashboard.html"
click node_ngo "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/ngo-dashboard.html"
click node_restaurant "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/restaurant-dashboard.html"
click node_volunteer "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/volunteer-dashboard.html"
click node_tracking "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/track.html"
click node_donate "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/donate.html"
click node_donor "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/donor-dashboard.html"
click node_db "https://github.com/codewithyogeshh/foodbridge__v0/blob/main/js/db.js"

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_login,node_user toneBlue
class node_ngo_register,node_partner_register,node_donor_register,node_volunteer_register,node_admin toneAmber
class node_ngo,node_restaurant,node_volunteer,node_tracking toneMint
class node_donate,node_donor toneRose
class node_db,node_firebase,node_local toneIndigo
```

## Components

### Access & Roles

- [Platform entry](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/index.html): `index.html`
- [Email login](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/login.html): `login.html`

### Registration & Verification

- [NGO registration](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/register-ngo.html): `register-ngo.html`
- [Partner registration](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/register-partner.html): `register-partner.html`
- [Donor registration](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/register-donor.html): `register-donor.html`
- [Volunteer registration](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/register-volunteer.html): `register-volunteer.html`
- [Admin portal](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/admin-dashboard.html): `admin-dashboard.html`

### Surplus Rescue

- [NGO dashboard](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/ngo-dashboard.html): `ngo-dashboard.html`
- [Restaurant dashboard](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/restaurant-dashboard.html): `restaurant-dashboard.html`
- [Volunteer dashboard](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/volunteer-dashboard.html): `volunteer-dashboard.html`
- [Delivery tracking](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/track.html): `track.html`

### Donations & Audit

- [UPI donation](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/donate.html): `donate.html`
- [Donor dashboard](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/donor-dashboard.html): `donor-dashboard.html`

### Data Platform

- [Database & sessions](https://github.com/codewithyogeshh/foodbridge__v0/blob/main/js/db.js): `js/db.js`
- **Firebase services**
- **Browser LocalStorage**

### Other components

- **Platform user**

## Connections

- Platform user → Platform entry: opens
- Platform entry → Email login: requires login
- Platform user → Email login: authenticates
- Platform user → NGO registration: registers NGO
- Platform user → Partner registration: registers partner
- Platform user → Donor registration: registers donor
- Platform user → Volunteer registration: registers volunteer
- Email login → Database & sessions: uses sessions
- NGO registration → Database & sessions: stores profile
- Partner registration → Database & sessions: stores profile
- Donor registration → Database & sessions: stores profile
- Volunteer registration → Database & sessions: stores profile
- Email login → NGO dashboard: routes NGO
- Email login → Restaurant dashboard: routes partner
- Email login → Volunteer dashboard: routes volunteer
- Email login → Donor dashboard: routes donor
- Email login → Admin portal: routes admin
- Admin portal → Database & sessions: verifies applications
- Restaurant dashboard → Database & sessions: posts surplus
- NGO dashboard → Database & sessions: claims surplus
- Volunteer dashboard → Database & sessions: updates delivery
- Delivery tracking → Database & sessions: reads delivery status
- Platform user → UPI donation: donates
- UPI donation → Database & sessions: records donation
- Donor dashboard → Database & sessions: views donations
- Admin portal → Database & sessions: audits bank credits
- Database & sessions → Firebase services: syncs data
- Database & sessions → Browser LocalStorage: falls back
