# ash-718/smart-waste-pickup-rewards architecture

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

- Interactive diagram: https://gitdiagram.com/ash-718/smart-waste-pickup-rewards
- Repository: https://github.com/ash-718/smart-waste-pickup-rewards

## Overview

This is a citizen recycling-pickup and rewards platform: citizens book and track collections in the mobile app, while administrators manage pickups and platform activity in a dashboard. Both clients use the REST API, which handles authentication, pickup operations, points, badges, rewards, and persistence. The README documents PostgreSQL and the client/API workflow; source-index references and excerpts support the shown backend routing and selected controller interactions. Several client and backend feature modules are unsampled, so their internal calls are not expanded.

Main entry points: [`admin-dashboard/src/App.jsx`](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/admin-dashboard/src/App.jsx) (Admin workspace), [`mobile-app/src/navigation`](https://github.com/ash-718/smart-waste-pickup-rewards/tree/main/mobile-app/src/navigation) (Mobile experience), [`backend/src/app.js`](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/app.js) (REST API), [`backend/src/controllers/pickupController.js`](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/controllers/pickupController.js) (Pickup lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_citizen["Citizen app"]
  node_mobile["Mobile experience"]
  node_mobileauth["Mobile authentication<br/>[AuthContext.js]"]
  node_mobilepickup["Booking and tracking"]
  node_mobileimpact["Impact and rewards"]
end

subgraph group_admin["Admin dashboard"]
  node_dashboard["Admin workspace<br/>[App.jsx]"]
  node_adminauth["Admin authentication<br/>[AuthContext.jsx]"]
  node_adminpickup["Pickup management"]
  node_admininsights["Users and analytics"]
  node_adminrewards["Reward administration"]
end

subgraph group_api["Backend API"]
  node_rest["REST API<br/>[app.js]"]
  node_authroutes["Authentication routes<br/>[authRoutes.js]"]
end

subgraph group_operations["Pickup operations"]
  node_pickuproutes["Pickup routes<br/>[pickupRoutes.js]"]
  node_pickup["Pickup lifecycle"]
  node_adminroutes["Admin routes<br/>[adminRoutes.js]"]
  node_userops["User operations"]
  node_analytics["Platform analytics"]
end

subgraph group_engagement["Points and rewards"]
  node_points["Points ledger<br/>[pointsService.js]"]
  node_badges["Badge system<br/>[badgeService.js]"]
  node_rewards["Rewards catalogue"]
end

node_citizen(("Citizen"))
node_adminuser(("Administrator"))
node_database[("PostgreSQL")]

node_citizen -->|"uses"| node_mobile
node_mobile -->|"authenticates through"| node_mobileauth
node_mobile -->|"books and tracks"| node_mobilepickup
node_mobile -->|"views points and rewards"| node_mobileimpact
node_adminuser -->|"manages through"| node_dashboard
node_dashboard -->|"provides protected access"| node_adminauth
node_dashboard -->|"manages pickups"| node_adminpickup
node_dashboard -->|"views activity"| node_admininsights
node_dashboard -->|"manages rewards"| node_adminrewards
node_mobile -->|"sends REST requests"| node_rest
node_dashboard -->|"sends REST requests"| node_rest
node_rest -->|"mounts"| node_authroutes
node_rest -->|"mounts"| node_pickuproutes
node_rest -->|"mounts"| node_adminroutes
node_pickuproutes -->|"routes to"| node_pickup
node_adminroutes -->|"routes to"| node_userops
node_adminroutes -->|"routes to"| node_analytics
node_pickup -->|"reads and writes"| node_database
node_userops -->|"reads and writes"| node_database
node_pickup -->|"awards on completion"| node_points
node_points -->|"uses badge service"| node_badges
node_points -.->|"records ledger"| node_database
node_rewards -.->|"persists redemptions"| node_database

click node_mobile "https://github.com/ash-718/smart-waste-pickup-rewards/tree/main/mobile-app/src/navigation"
click node_mobileauth "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/mobile-app/src/context/AuthContext.js"
click node_mobilepickup "https://github.com/ash-718/smart-waste-pickup-rewards/tree/main/mobile-app/src/screens"
click node_mobileimpact "https://github.com/ash-718/smart-waste-pickup-rewards/tree/main/mobile-app/src/screens"
click node_dashboard "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/admin-dashboard/src/App.jsx"
click node_adminauth "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/admin-dashboard/src/context/AuthContext.jsx"
click node_adminpickup "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/admin-dashboard/src/pages/PickupDetailPage.jsx"
click node_admininsights "https://github.com/ash-718/smart-waste-pickup-rewards/tree/main/admin-dashboard/src/pages"
click node_adminrewards "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/admin-dashboard/src/pages/RewardsBadgesPage.jsx"
click node_rest "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/app.js"
click node_authroutes "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/routes/authRoutes.js"
click node_pickuproutes "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/routes/pickupRoutes.js"
click node_pickup "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/controllers/pickupController.js"
click node_adminroutes "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/routes/adminRoutes.js"
click node_userops "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/controllers/userManagementController.js"
click node_analytics "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/controllers/analyticsController.js"
click node_points "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/services/pointsService.js"
click node_badges "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/services/badgeService.js"
click node_rewards "https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/controllers/rewardController.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_mobile,node_mobileauth,node_mobilepickup,node_mobileimpact toneBlue
class node_dashboard,node_adminauth,node_adminpickup,node_admininsights,node_adminrewards,node_database toneAmber
class node_rest,node_authroutes toneMint
class node_pickuproutes,node_pickup,node_adminroutes,node_userops,node_analytics toneRose
class node_points,node_badges,node_rewards,node_citizen,node_adminuser toneIndigo
```

## Components

### Citizen app

- [Mobile experience](https://github.com/ash-718/smart-waste-pickup-rewards/tree/main/mobile-app/src/navigation): `mobile-app/src/navigation`
- [Mobile authentication](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/mobile-app/src/context/AuthContext.js): `mobile-app/src/context/AuthContext.js`
- [Booking and tracking](https://github.com/ash-718/smart-waste-pickup-rewards/tree/main/mobile-app/src/screens): `mobile-app/src/screens`
- [Impact and rewards](https://github.com/ash-718/smart-waste-pickup-rewards/tree/main/mobile-app/src/screens): `mobile-app/src/screens`

### Admin dashboard

- [Admin workspace](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/admin-dashboard/src/App.jsx): `admin-dashboard/src/App.jsx`
- [Admin authentication](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/admin-dashboard/src/context/AuthContext.jsx): `admin-dashboard/src/context/AuthContext.jsx`
- [Pickup management](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/admin-dashboard/src/pages/PickupDetailPage.jsx): `admin-dashboard/src/pages/PickupDetailPage.jsx`
- [Users and analytics](https://github.com/ash-718/smart-waste-pickup-rewards/tree/main/admin-dashboard/src/pages): `admin-dashboard/src/pages`
- [Reward administration](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/admin-dashboard/src/pages/RewardsBadgesPage.jsx): `admin-dashboard/src/pages/RewardsBadgesPage.jsx`

### Backend API

- [REST API](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/app.js): `backend/src/app.js`
- [Authentication routes](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/routes/authRoutes.js): `backend/src/routes/authRoutes.js`

### Pickup operations

- [Pickup routes](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/routes/pickupRoutes.js): `backend/src/routes/pickupRoutes.js`
- [Pickup lifecycle](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/controllers/pickupController.js): `backend/src/controllers/pickupController.js`
- [Admin routes](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/routes/adminRoutes.js): `backend/src/routes/adminRoutes.js`
- [User operations](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/controllers/userManagementController.js): `backend/src/controllers/userManagementController.js`
- [Platform analytics](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/controllers/analyticsController.js): `backend/src/controllers/analyticsController.js`

### Points and rewards

- [Points ledger](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/services/pointsService.js): `backend/src/services/pointsService.js`
- [Badge system](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/services/badgeService.js): `backend/src/services/badgeService.js`
- [Rewards catalogue](https://github.com/ash-718/smart-waste-pickup-rewards/blob/main/backend/src/controllers/rewardController.js): `backend/src/controllers/rewardController.js`

### Other components

- **Citizen**
- **Administrator**
- **PostgreSQL**

## Connections

- Citizen → Mobile experience: uses (evidence: `README.md`)
- Mobile experience → Mobile authentication: authenticates through (evidence: `mobile-app/App.js`)
- Mobile experience → Booking and tracking: books and tracks (evidence: `README.md`)
- Mobile experience → Impact and rewards: views points and rewards (evidence: `README.md`)
- Administrator → Admin workspace: manages through (evidence: `README.md`)
- Admin workspace → Admin authentication: provides protected access (evidence: `admin-dashboard/src/App.jsx`)
- Admin workspace → Pickup management: manages pickups (evidence: `admin-dashboard/src/App.jsx`)
- Admin workspace → Users and analytics: views activity (evidence: `admin-dashboard/src/App.jsx`)
- Admin workspace → Reward administration: manages rewards (evidence: `admin-dashboard/src/App.jsx`)
- Mobile experience → REST API: sends REST requests (evidence: `README.md`)
- Admin workspace → REST API: sends REST requests (evidence: `README.md`)
- REST API → Authentication routes: mounts (evidence: `backend/src/app.js`)
- REST API → Pickup routes: mounts (evidence: `backend/src/app.js`)
- REST API → Admin routes: mounts (evidence: `backend/src/app.js`)
- Pickup routes → Pickup lifecycle: routes to (evidence: `backend/src/routes/pickupRoutes.js`)
- Admin routes → User operations: routes to (evidence: `backend/src/routes/adminRoutes.js`)
- Admin routes → Platform analytics: routes to (evidence: `backend/src/routes/adminRoutes.js`)
- Pickup lifecycle → PostgreSQL: reads and writes (evidence: `backend/src/controllers/pickupController.js`)
- User operations → PostgreSQL: reads and writes (evidence: `backend/src/controllers/userManagementController.js`)
- Pickup lifecycle → Points ledger: awards on completion (evidence: `backend/src/controllers/pickupController.js`)
- Points ledger → Badge system: uses badge service (evidence: `backend/src/services/pointsService.js`)
- Points ledger → PostgreSQL: records ledger
- Rewards catalogue → PostgreSQL: persists redemptions
