# vmillion16/ebinv4 architecture

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

- Interactive diagram: https://gitdiagram.com/vmillion16/ebinv4
- Repository: https://github.com/vmillion16/ebinv4

## Overview

E-Bin is a waste-bin monitoring and management application: users sign in, view bin status and waste activity, and use operational features such as reports, settings, maintenance, user management, and collection rewards. The frontend composes these screens around shared bin/event state; its API calls connect to backend routes and persistent models. The supplied excerpts show several frontend dispatches and data-fetching relationships, but not the server’s route registration, so those wiring details are omitted. Some backend model imports use names that do not match the listed filenames; they are represented at the models-directory level.

Main entry points: [`ebin-frontend/src/components/Dashboard.js`](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Dashboard.js) (Dashboard shell), [`ebin-backend/models`](https://github.com/vmillion16/ebinv4/tree/main/ebin-backend/models) (Domain models), [`ebin-backend/middleware/auth.js`](https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/middleware/auth.js) (Token and role checks), [`ebin-frontend/src/App.js`](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/App.js) (App and auth state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["App and auth state<br/>[App.js]"]
  node_login["Login<br/>[Login.js]"]
  node_dashboard["Dashboard shell<br/>[Dashboard.js]"]
  node_context["Shared bin state<br/>[EbinContext.js]"]
  node_sidebar["Navigation<br/>[Sidebar.js]"]
end

subgraph group_operations["Operations features"]
  node_overview["Overview analytics"]
  node_binmonitor["Bin monitoring<br/>[BinMonitoring.js]"]
  node_filllogic["Fill calculations<br/>[binFill.js]"]
  node_segregation["Waste activity"]
  node_rewards["Collection rewards"]
  node_reports["Reports<br/>[Reports.js]"]
  node_settings["Settings<br/>[Settings.js]"]
  node_maintenance["Maintenance<br/>[Maintenance.js]"]
  node_users["User management<br/>[Usermanagement.jsx]"]
end

subgraph group_backend["Backend services"]
  node_api["API service"]
  node_authroutes["Authentication routes<br/>[auth.routes.js]"]
  node_authmw["Token and role checks<br/>[auth.js]"]
  node_binroutes["Bin routes<br/>[bins.js]"]
  node_wasteroutes["Waste event routes<br/>[wasteEvents.js]"]
  node_rewardroutes["Reward session routes<br/>[rewardSessions.js]"]
  node_reportroutes["Report routes<br/>[report.routes.js]"]
  node_settingsroutes["Settings routes<br/>[settings.js]"]
  node_maintenanceroutes["Maintenance routes"]
  node_esp32["Device integration<br/>[esp32routes.js]"]
end

subgraph group_data["Persistent data"]
  node_models[("Domain models")]
end

node_user(("Dashboard user"))

node_user -->|"opens app"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_users
node_dashboard -->|"renders"| node_overview
node_dashboard -->|"renders"| node_binmonitor
node_dashboard -->|"renders"| node_segregation
node_dashboard -->|"renders"| node_reports
node_dashboard -->|"renders"| node_settings
node_dashboard -->|"renders"| node_rewards
node_dashboard -->|"renders"| node_sidebar
node_overview -->|"reads state"| node_context
node_overview -->|"calculates fill"| node_filllogic
node_binmonitor -->|"reads state"| node_context
node_binmonitor -->|"uses fill logic"| node_filllogic
node_segregation -->|"reads and refreshes"| node_context
node_context -->|"fetches bins and events"| node_api
node_login -.->|"submits credentials"| node_api
node_settings -->|"reads and saves"| node_api
node_authroutes -.->|"uses user data"| node_models
node_binroutes -->|"checks access"| node_authmw
node_wasteroutes -->|"checks access"| node_authmw
node_rewardroutes -->|"checks access"| node_authmw
node_reportroutes -->|"checks access"| node_authmw
node_maintenanceroutes -->|"checks access"| node_authmw
node_reportroutes -->|"aggregates records"| node_models
node_rewardroutes -->|"reads and updates"| node_models
node_binroutes -.->|"uses bin records"| node_models
node_wasteroutes -.->|"uses event records"| node_models
node_settingsroutes -.->|"uses settings"| node_models
node_maintenanceroutes -.->|"uses requests"| node_models
node_esp32 -.->|"updates device data"| node_models

click node_app "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/App.js"
click node_login "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Login.js"
click node_dashboard "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Dashboard.js"
click node_context "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/EbinContext.js"
click node_overview "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/DashboardOverview.js"
click node_binmonitor "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/BinMonitoring.js"
click node_filllogic "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/utils/binFill.js"
click node_segregation "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/WasteSegregation.js"
click node_rewards "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/CollectionReward.js"
click node_reports "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Reports.js"
click node_settings "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Settings.js"
click node_maintenance "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Maintenance.js"
click node_users "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Usermanagement.jsx"
click node_sidebar "https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Sidebar.js"
click node_authroutes "https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/auth.routes.js"
click node_authmw "https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/middleware/auth.js"
click node_binroutes "https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/bins.js"
click node_wasteroutes "https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/wasteEvents.js"
click node_rewardroutes "https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/rewardSessions.js"
click node_reportroutes "https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/report.routes.js"
click node_settingsroutes "https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/settings.js"
click node_maintenanceroutes "https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/maintenanceRequest.js"
click node_esp32 "https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/esp32routes.js"
click node_models "https://github.com/vmillion16/ebinv4/tree/main/ebin-backend/models"

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_dashboard,node_context,node_sidebar,node_user toneBlue
class node_overview,node_binmonitor,node_filllogic,node_segregation,node_rewards,node_reports,node_settings,node_maintenance,node_users toneAmber
class node_api,node_authroutes,node_authmw,node_binroutes,node_wasteroutes,node_rewardroutes,node_reportroutes,node_settingsroutes,node_maintenanceroutes,node_esp32 toneMint
class node_models toneRose
```

## Components

### Frontend experience

- [App and auth state](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/App.js): `ebin-frontend/src/App.js`
- [Login](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Login.js): `ebin-frontend/src/components/Login.js`
- [Dashboard shell](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Dashboard.js): `ebin-frontend/src/components/Dashboard.js`
- [Shared bin state](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/EbinContext.js): `ebin-frontend/src/EbinContext.js`
- [Navigation](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Sidebar.js): `ebin-frontend/src/components/Sidebar.js`

### Operations features

- [Overview analytics](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/DashboardOverview.js): `ebin-frontend/src/components/DashboardOverview.js`
- [Bin monitoring](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/BinMonitoring.js): `ebin-frontend/src/components/BinMonitoring.js`
- [Fill calculations](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/utils/binFill.js): `ebin-frontend/src/utils/binFill.js`
- [Waste activity](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/WasteSegregation.js): `ebin-frontend/src/components/WasteSegregation.js`
- [Collection rewards](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/CollectionReward.js): `ebin-frontend/src/components/CollectionReward.js`
- [Reports](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Reports.js): `ebin-frontend/src/components/Reports.js`
- [Settings](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Settings.js): `ebin-frontend/src/components/Settings.js`
- [Maintenance](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Maintenance.js): `ebin-frontend/src/components/Maintenance.js`
- [User management](https://github.com/vmillion16/ebinv4/blob/main/ebin-frontend/src/components/Usermanagement.jsx): `ebin-frontend/src/components/Usermanagement.jsx`

### Backend services

- **API service**
- [Authentication routes](https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/auth.routes.js): `ebin-backend/routes/auth.routes.js`
- [Token and role checks](https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/middleware/auth.js): `ebin-backend/middleware/auth.js`
- [Bin routes](https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/bins.js): `ebin-backend/routes/bins.js`
- [Waste event routes](https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/wasteEvents.js): `ebin-backend/routes/wasteEvents.js`
- [Reward session routes](https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/rewardSessions.js): `ebin-backend/routes/rewardSessions.js`
- [Report routes](https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/report.routes.js): `ebin-backend/routes/report.routes.js`
- [Settings routes](https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/settings.js): `ebin-backend/routes/settings.js`
- [Maintenance routes](https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/maintenanceRequest.js): `ebin-backend/routes/maintenanceRequest.js`
- [Device integration](https://github.com/vmillion16/ebinv4/blob/main/ebin-backend/routes/esp32routes.js): `ebin-backend/routes/esp32routes.js`

### Persistent data

- [Domain models](https://github.com/vmillion16/ebinv4/tree/main/ebin-backend/models): `ebin-backend/models`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → App and auth state: opens app (evidence: `ebin-frontend/src/App.js`)
- App and auth state → Login: routes to (evidence: `ebin-frontend/src/App.js`)
- App and auth state → Dashboard shell: routes to (evidence: `ebin-frontend/src/App.js`)
- App and auth state → User management: routes to (evidence: `ebin-frontend/src/App.js`)
- Dashboard shell → Overview analytics: renders (evidence: `ebin-frontend/src/components/Dashboard.js`)
- Dashboard shell → Bin monitoring: renders (evidence: `ebin-frontend/src/components/Dashboard.js`)
- Dashboard shell → Waste activity: renders (evidence: `ebin-frontend/src/components/Dashboard.js`)
- Dashboard shell → Reports: renders (evidence: `ebin-frontend/src/components/Dashboard.js`)
- Dashboard shell → Settings: renders (evidence: `ebin-frontend/src/components/Dashboard.js`)
- Dashboard shell → Collection rewards: renders (evidence: `ebin-frontend/src/components/Dashboard.js`)
- Dashboard shell → Navigation: renders (evidence: `ebin-frontend/src/components/Dashboard.js`)
- Overview analytics → Shared bin state: reads state (evidence: `ebin-frontend/src/components/DashboardOverview.js`)
- Overview analytics → Fill calculations: calculates fill (evidence: `ebin-frontend/src/components/DashboardOverview.js`)
- Bin monitoring → Shared bin state: reads state (evidence: `ebin-frontend/src/components/BinMonitoring.js`)
- Bin monitoring → Fill calculations: uses fill logic (evidence: `ebin-frontend/src/components/BinMonitoring.js`)
- Waste activity → Shared bin state: reads and refreshes (evidence: `ebin-frontend/src/components/WasteSegregation.js`)
- Shared bin state → API service: fetches bins and events (evidence: `ebin-frontend/src/EbinContext.js`)
- Login → API service: submits credentials
- Settings → API service: reads and saves (evidence: `ebin-frontend/src/components/Settings.js`)
- Authentication routes → Domain models: uses user data
- Bin routes → Token and role checks: checks access (evidence: `ebin-backend/routes/bins.js`)
- Waste event routes → Token and role checks: checks access (evidence: `ebin-backend/routes/wasteEvents.js`)
- Reward session routes → Token and role checks: checks access (evidence: `ebin-backend/routes/rewardSessions.js`)
- Report routes → Token and role checks: checks access (evidence: `ebin-backend/routes/report.routes.js`)
- Maintenance routes → Token and role checks: checks access (evidence: `ebin-backend/routes/maintenanceRequest.js`)
- Report routes → Domain models: aggregates records (evidence: `ebin-backend/routes/report.routes.js`)
- Reward session routes → Domain models: reads and updates (evidence: `ebin-backend/routes/rewardSessions.js`)
- Bin routes → Domain models: uses bin records
- Waste event routes → Domain models: uses event records
- Settings routes → Domain models: uses settings
- Maintenance routes → Domain models: uses requests
- Device integration → Domain models: updates device data
