# ganeshvidela26/revastra architecture

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

- Interactive diagram: https://gitdiagram.com/ganeshvidela26/revastra
- Repository: https://github.com/ganeshvidela26/revastra

## Overview

REVastra is a multi-role circular-economy platform. Its central lifecycle spans waste-giver collection requests, collector pickup and QR verification, recovery-centre segregation and weighing, then traceable material sales to buyers; a parallel food-donation flow connects givers with NGOs. Green Coins reward participation, while civic reporting and admin analytics provide additional capabilities. The excerpts show shared state and persistence boundaries; several role pages and integrations are documented but unsampled, so their links rely on README statements rather than inspected implementation.

Main entry points: [`src/context/DataContext.jsx`](https://github.com/ganeshvidela26/revastra/blob/main/src/context/DataContext.jsx) (Shared application state), [`src/services/qrService.js`](https://github.com/ganeshvidela26/revastra/blob/main/src/services/qrService.js) (QR traceability), [`src/pages/collector/Routes.jsx`](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/collector/Routes.jsx) (Pickup and routes), [`src/pages/recoveryCentre/SegregationWeighing.jsx`](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/recoveryCentre/SegregationWeighing.jsx) (Segregation and weighing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engage["User access"]
  node_app_routes["Role routing<br/>[App.jsx]"]
  node_auth["Authentication<br/>[AuthContext.jsx]"]
end

subgraph group_operations["Waste operations"]
  node_giver_collection["Collection requests"]
  node_collector_ops["Pickup and routes<br/>[Routes.jsx]"]
  node_qr["QR traceability<br/>[qrService.js]"]
  node_recovery_ops["Segregation and weighing"]
end

subgraph group_exchange["Food and materials exchange"]
  node_marketplace["Material marketplace<br/>[Marketplace.jsx]"]
  node_orders["Buyer orders<br/>[Orders.jsx]"]
  node_food_donation["Food donation<br/>[DonateFoodPage.jsx]"]
  node_ngo_pickups["NGO pickups<br/>[FoodDonations.jsx]"]
end

subgraph group_insight["Oversight and impact"]
  node_civic["Civic reporting"]
  node_admin_oversight["Admin oversight<br/>[Overview.jsx]"]
  node_analytics["Impact analytics"]
end

subgraph group_platform["Shared platform services"]
  node_green_coins["Green Coin rewards"]
  node_state["Shared application state<br/>[DataContext.jsx]"]
  node_persistence[("Local persistence adapter<br/>[apiService.js]")]
  node_firebase[("Firebase sync<br/>[firebase.js]")]
  node_charts["Analytics charts"]
end

node_waste_giver(("Waste giver"))
node_collector(("Collector"))
node_recovery(("Recovery centre"))
node_buyer(("Buyer"))
node_ngo(("NGO"))
node_admin(("Admin"))
node_public(("Public visitor"))

node_public -->|"enters platform"| node_app_routes
node_app_routes -->|"provides auth"| node_auth
node_waste_giver -->|"requests pickup"| node_giver_collection
node_giver_collection -.->|"assigns pickup"| node_collector_ops
node_collector -->|"manages pickups"| node_collector_ops
node_collector_ops -->|"scans source"| node_qr
node_qr -->|"tracks batches"| node_recovery_ops
node_recovery -->|"weighs materials"| node_recovery_ops
node_recovery_ops -.->|"releases materials"| node_marketplace
node_buyer -->|"browses materials"| node_marketplace
node_buyer -->|"places orders"| node_orders
node_waste_giver -->|"donates surplus"| node_food_donation
node_ngo -->|"manages pickups"| node_ngo_pickups
node_food_donation -->|"offers donations"| node_ngo_pickups
node_public -->|"files reports"| node_civic
node_admin -->|"oversees platform"| node_admin_oversight
node_admin -->|"reviews impact"| node_analytics
node_waste_giver -->|"earns rewards"| node_green_coins
node_state -->|"saves state"| node_persistence
node_state -->|"syncs records"| node_firebase
node_state -->|"calculates rewards"| node_green_coins
node_analytics -->|"visualizes metrics"| node_charts
node_qr -->|"enables verification"| node_public

click node_app_routes "https://github.com/ganeshvidela26/revastra/blob/main/src/App.jsx"
click node_auth "https://github.com/ganeshvidela26/revastra/blob/main/src/context/AuthContext.jsx"
click node_giver_collection "https://github.com/ganeshvidela26/revastra/blob/main/src/pages/wasteGiver/RequestCollection.jsx"
click node_collector_ops "https://github.com/ganeshvidela26/revastra/blob/main/src/pages/collector/Routes.jsx"
click node_qr "https://github.com/ganeshvidela26/revastra/blob/main/src/services/qrService.js"
click node_recovery_ops "https://github.com/ganeshvidela26/revastra/blob/main/src/pages/recoveryCentre/SegregationWeighing.jsx"
click node_marketplace "https://github.com/ganeshvidela26/revastra/blob/main/src/pages/buyer/Marketplace.jsx"
click node_orders "https://github.com/ganeshvidela26/revastra/blob/main/src/pages/buyer/Orders.jsx"
click node_food_donation "https://github.com/ganeshvidela26/revastra/blob/main/src/pages/wasteGiver/DonateFoodPage.jsx"
click node_ngo_pickups "https://github.com/ganeshvidela26/revastra/blob/main/src/pages/ngo/FoodDonations.jsx"
click node_civic "https://github.com/ganeshvidela26/revastra/blob/main/src/pages/civicWatch/CivicWatchReport.jsx"
click node_admin_oversight "https://github.com/ganeshvidela26/revastra/blob/main/src/pages/admin/Overview.jsx"
click node_analytics "https://github.com/ganeshvidela26/revastra/blob/main/src/pages/admin/ImpactAnalytics.jsx"
click node_green_coins "https://github.com/ganeshvidela26/revastra/blob/main/src/services/greenCoinService.js"
click node_state "https://github.com/ganeshvidela26/revastra/blob/main/src/context/DataContext.jsx"
click node_persistence "https://github.com/ganeshvidela26/revastra/blob/main/src/services/apiService.js"
click node_firebase "https://github.com/ganeshvidela26/revastra/blob/main/src/services/firebase.js"
click node_charts "https://github.com/ganeshvidela26/revastra/blob/main/src/components/charts/MaterialDistributionChart.jsx"

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_routes,node_auth toneBlue
class node_giver_collection,node_collector_ops,node_qr,node_recovery_ops toneAmber
class node_marketplace,node_orders,node_food_donation,node_ngo_pickups toneMint
class node_civic,node_admin_oversight,node_analytics toneRose
class node_green_coins,node_state,node_persistence,node_firebase,node_charts,node_waste_giver,node_collector,node_recovery,node_buyer,node_ngo,node_admin,node_public toneIndigo
```

## Components

### User access

- [Role routing](https://github.com/ganeshvidela26/revastra/blob/main/src/App.jsx): `src/App.jsx`
- [Authentication](https://github.com/ganeshvidela26/revastra/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`

### Waste operations

- [Collection requests](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/wasteGiver/RequestCollection.jsx): `src/pages/wasteGiver/RequestCollection.jsx`
- [Pickup and routes](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/collector/Routes.jsx): `src/pages/collector/Routes.jsx`
- [QR traceability](https://github.com/ganeshvidela26/revastra/blob/main/src/services/qrService.js): `src/services/qrService.js`
- [Segregation and weighing](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/recoveryCentre/SegregationWeighing.jsx): `src/pages/recoveryCentre/SegregationWeighing.jsx`

### Food and materials exchange

- [Material marketplace](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/buyer/Marketplace.jsx): `src/pages/buyer/Marketplace.jsx`
- [Buyer orders](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/buyer/Orders.jsx): `src/pages/buyer/Orders.jsx`
- [Food donation](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/wasteGiver/DonateFoodPage.jsx): `src/pages/wasteGiver/DonateFoodPage.jsx`
- [NGO pickups](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/ngo/FoodDonations.jsx): `src/pages/ngo/FoodDonations.jsx`

### Oversight and impact

- [Civic reporting](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/civicWatch/CivicWatchReport.jsx): `src/pages/civicWatch/CivicWatchReport.jsx`
- [Admin oversight](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/admin/Overview.jsx): `src/pages/admin/Overview.jsx`
- [Impact analytics](https://github.com/ganeshvidela26/revastra/blob/main/src/pages/admin/ImpactAnalytics.jsx): `src/pages/admin/ImpactAnalytics.jsx`

### Shared platform services

- [Green Coin rewards](https://github.com/ganeshvidela26/revastra/blob/main/src/services/greenCoinService.js): `src/services/greenCoinService.js`
- [Shared application state](https://github.com/ganeshvidela26/revastra/blob/main/src/context/DataContext.jsx): `src/context/DataContext.jsx`
- [Local persistence adapter](https://github.com/ganeshvidela26/revastra/blob/main/src/services/apiService.js): `src/services/apiService.js`
- [Firebase sync](https://github.com/ganeshvidela26/revastra/blob/main/src/services/firebase.js): `src/services/firebase.js`
- [Analytics charts](https://github.com/ganeshvidela26/revastra/blob/main/src/components/charts/MaterialDistributionChart.jsx): `src/components/charts/MaterialDistributionChart.jsx`

### Other components

- **Waste giver**
- **Collector**
- **Recovery centre**
- **Buyer**
- **NGO**
- **Admin**
- **Public visitor**

## Connections

- Public visitor → Role routing: enters platform (evidence: `src/App.jsx`)
- Role routing → Authentication: provides auth (evidence: `src/App.jsx`)
- Waste giver → Collection requests: requests pickup (evidence: `README.md`)
- Collection requests → Pickup and routes: assigns pickup
- Collector → Pickup and routes: manages pickups (evidence: `README.md`)
- Pickup and routes → QR traceability: scans source (evidence: `README.md`)
- QR traceability → Segregation and weighing: tracks batches (evidence: `README.md`)
- Recovery centre → Segregation and weighing: weighs materials (evidence: `README.md`)
- Segregation and weighing → Material marketplace: releases materials
- Buyer → Material marketplace: browses materials (evidence: `README.md`)
- Buyer → Buyer orders: places orders (evidence: `README.md`)
- Waste giver → Food donation: donates surplus (evidence: `README.md`)
- NGO → NGO pickups: manages pickups (evidence: `README.md`)
- Food donation → NGO pickups: offers donations (evidence: `README.md`)
- Public visitor → Civic reporting: files reports
- Admin → Admin oversight: oversees platform (evidence: `README.md`)
- Admin → Impact analytics: reviews impact (evidence: `README.md`)
- Waste giver → Green Coin rewards: earns rewards (evidence: `README.md`)
- Shared application state → Local persistence adapter: saves state (evidence: `src/context/DataContext.jsx`)
- Shared application state → Firebase sync: syncs records (evidence: `src/context/DataContext.jsx`)
- Shared application state → Green Coin rewards: calculates rewards (evidence: `src/context/DataContext.jsx`)
- Impact analytics → Analytics charts: visualizes metrics (evidence: `README.md`)
- QR traceability → Public visitor: enables verification (evidence: `README.md`)
