# abhinavadeep/agriwaste architecture

> Architecture diagram of the GitHub repository abhinavadeep/agriwaste, 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/abhinavadeep/agriwaste
- Repository: https://github.com/abhinavadeep/agriwaste

## Overview

This is a farmer agricultural-waste submission and admin-review application. Farmers register or sign in, upload a waste image, and receive detected waste types and indicative prices. The backend stores submissions for admins to inspect, approve or reject; approval updates status and attempts an SMS notification. The frontend also derives waste-count analytics from submissions. Source excerpts show the browser and backend workflows, but no README or frontend HTML was provided, so page wiring beyond the named entry pages is not inferred.

Main entry points: [`Frontend/script.js`](https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/script.js) (Browser workflows), [`Backend/app.py`](https://github.com/abhinavadeep/agriwaste/blob/main/Backend/app.py) (Submission review routes), [`Frontend/admin.html`](https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/admin.html) (Admin pages), [`Frontend/farmer.html`](https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/farmer.html) (Farmer pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_farmer_pages["Farmer pages<br/>[farmer.html]"]
  node_admin_pages["Admin pages<br/>[admin.html]"]
  node_browser_logic["Browser workflows<br/>[script.js]"]
  node_farmer_auth["Farmer registration and login<br/>[script.js]"]
  node_admin_auth["Admin registration and login<br/>[script.js]"]
  node_analytics["Waste-count analytics<br/>[script.js]"]
end

subgraph group_backend["Submission backend"]
  node_detect_route["Image detection route<br/>[app.py]"]
  node_review_routes["Submission review routes<br/>[app.py]"]
end

subgraph group_integrations["Models and services"]
  node_pricing["Waste price table<br/>[waste_prices.py]"]
  node_yolo["YOLO model<br/>[best.pt]"]
  node_mongo[("Submission store")]
  node_twilio["SMS service"]
end

node_farmer(("Farmer"))
node_admin(("Admin"))

node_farmer -->|"uses"| node_farmer_pages
node_admin -->|"uses"| node_admin_pages
node_farmer_pages -->|"registers or signs in"| node_farmer_auth
node_admin_pages -->|"registers or signs in"| node_admin_auth
node_farmer_auth -->|"stores session"| node_browser_logic
node_admin_auth -->|"stores session"| node_browser_logic
node_farmer_pages -->|"uploads image"| node_browser_logic
node_browser_logic -->|"posts image and details"| node_detect_route
node_detect_route -->|"runs inference"| node_yolo
node_detect_route -->|"looks up prices"| node_pricing
node_detect_route -->|"inserts submission"| node_mongo
node_detect_route -->|"returns detections and prices"| node_browser_logic
node_admin_pages -->|"requests review data"| node_browser_logic
node_browser_logic -->|"fetches submissions"| node_review_routes
node_review_routes -->|"reads submissions"| node_mongo
node_review_routes -->|"returns submissions"| node_browser_logic
node_browser_logic -->|"posts approval or rejection"| node_review_routes
node_review_routes -->|"updates or deletes"| node_mongo
node_review_routes -.->|"sends approval SMS"| node_twilio
node_admin_pages -->|"views analytics"| node_analytics
node_analytics -->|"fetches submissions"| node_review_routes

click node_farmer_pages "https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/farmer.html"
click node_admin_pages "https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/admin.html"
click node_browser_logic "https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/script.js"
click node_farmer_auth "https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/script.js"
click node_admin_auth "https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/script.js"
click node_detect_route "https://github.com/abhinavadeep/agriwaste/blob/main/Backend/app.py"
click node_review_routes "https://github.com/abhinavadeep/agriwaste/blob/main/Backend/app.py"
click node_analytics "https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/script.js"
click node_pricing "https://github.com/abhinavadeep/agriwaste/blob/main/Backend/waste_prices.py"
click node_yolo "https://github.com/abhinavadeep/agriwaste/blob/main/Backend/best.pt"

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_farmer_pages,node_admin_pages,node_browser_logic,node_farmer_auth,node_admin_auth,node_analytics toneBlue
class node_detect_route,node_review_routes toneAmber
class node_pricing,node_yolo,node_mongo,node_twilio toneMint
class node_farmer,node_admin toneIndigo
```

## Components

### Web application

- [Farmer pages](https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/farmer.html): `Frontend/farmer.html`
- [Admin pages](https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/admin.html): `Frontend/admin.html`
- [Browser workflows](https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/script.js): `Frontend/script.js`
- [Farmer registration and login](https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/script.js): `Frontend/script.js`
- [Admin registration and login](https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/script.js): `Frontend/script.js`
- [Waste-count analytics](https://github.com/abhinavadeep/agriwaste/blob/main/Frontend/script.js): `Frontend/script.js`

### Submission backend

- [Image detection route](https://github.com/abhinavadeep/agriwaste/blob/main/Backend/app.py): `Backend/app.py`
- [Submission review routes](https://github.com/abhinavadeep/agriwaste/blob/main/Backend/app.py): `Backend/app.py`

### Models and services

- [Waste price table](https://github.com/abhinavadeep/agriwaste/blob/main/Backend/waste_prices.py): `Backend/waste_prices.py`
- [YOLO model](https://github.com/abhinavadeep/agriwaste/blob/main/Backend/best.pt): `Backend/best.pt`
- **Submission store**
- **SMS service**

### Other components

- **Farmer**
- **Admin**

## Connections

- Farmer → Farmer pages: uses
- Admin → Admin pages: uses
- Farmer pages → Farmer registration and login: registers or signs in
- Admin pages → Admin registration and login: registers or signs in
- Farmer registration and login → Browser workflows: stores session
- Admin registration and login → Browser workflows: stores session
- Farmer pages → Browser workflows: uploads image
- Browser workflows → Image detection route: posts image and details
- Image detection route → YOLO model: runs inference
- Image detection route → Waste price table: looks up prices
- Image detection route → Submission store: inserts submission
- Image detection route → Browser workflows: returns detections and prices
- Admin pages → Browser workflows: requests review data
- Browser workflows → Submission review routes: fetches submissions
- Submission review routes → Submission store: reads submissions
- Submission review routes → Browser workflows: returns submissions
- Browser workflows → Submission review routes: posts approval or rejection
- Submission review routes → Submission store: updates or deletes
- Submission review routes → SMS service: sends approval SMS
- Admin pages → Waste-count analytics: views analytics
- Waste-count analytics → Submission review routes: fetches submissions
