# appireddy-hemanth/agriconnect architecture

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

- Interactive diagram: https://gitdiagram.com/appireddy-hemanth/agriconnect
- Repository: https://github.com/appireddy-hemanth/agriconnect

## Overview

AgriLink Pro connects farmers who post labour or machinery jobs with labour teams and machine owners who browse and accept assignments. Its dashboards also support negotiation, payment tracking, reviews, profiles, and administration. The backend exposes these domains through Express routes backed by PostgreSQL; the frontend provides role-based dashboards and voice-assisted, multilingual forms. Dashboard-to-API links are shown as unverified because the excerpts do not expose their HTTP calls; documented product stages and backend route registrations are retained.

Main entry points: [`backend/src/app.js`](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/app.js) (Express API), [`frontend/src/App.jsx`](https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/App.jsx) (Role-based routing), [`backend/src/db/pool.js`](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/db/pool.js) (PostgreSQL connection pool), [`frontend/src/routes/FarmerDashboard.jsx`](https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/FarmerDashboard.jsx) (Farmer dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Role-based routing<br/>[App.jsx]"]
  node_voice["Voice input<br/>[useSpeechToText.js]"]
end

subgraph group_workforce["Work matching"]
  node_farmer["Farmer dashboard"]
  node_labour["Labour dashboard"]
  node_machine["Machine dashboard"]
  node_works["Work listings<br/>[works.js]"]
end

subgraph group_transactions["Work transactions"]
  node_negotiation["Negotiations<br/>[negotiations.js]"]
  node_payments["Payments<br/>[payments.js]"]
  node_reviews["Reviews and ratings<br/>[reviews.js]"]
end

subgraph group_identity["Accounts and administration"]
  node_profileui["Profile settings"]
  node_authui["Login and registration<br/>[Login.jsx]"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_authroutes["Authentication routes<br/>[auth.js]"]
  node_profileroutes["Profile routes<br/>[profile.js]"]
  node_adminroutes["Admin routes<br/>[admin.js]"]
end

subgraph group_backend["API and persistence"]
  node_api["Express API<br/>[app.js]"]
  node_auth["JWT authentication<br/>[auth.js]"]
  node_dbpool["PostgreSQL connection pool<br/>[pool.js]"]
end

node_user(("Farm users"))
node_postgres[("PostgreSQL database")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_farmer
node_app -->|"routes to"| node_labour
node_app -->|"routes to"| node_machine
node_app -->|"routes to"| node_adminui
node_farmer -.->|"posts work"| node_works
node_labour -.->|"browses and accepts"| node_works
node_machine -.->|"browses and accepts"| node_works
node_farmer -.->|"negotiates"| node_negotiation
node_labour -.->|"negotiates"| node_negotiation
node_machine -.->|"negotiates"| node_negotiation
node_farmer -.->|"tracks payments"| node_payments
node_farmer -.->|"submits reviews"| node_reviews
node_labour -.->|"views ratings"| node_reviews
node_machine -.->|"views ratings"| node_reviews
node_farmer -->|"uses voice input"| node_voice
node_app -.->|"calls API"| node_api
node_api -->|"routes requests"| node_authroutes
node_api -->|"routes requests"| node_works
node_api -->|"routes requests"| node_adminroutes
node_api -->|"routes requests"| node_profileroutes
node_api -->|"routes requests"| node_negotiation
node_api -->|"routes requests"| node_payments
node_api -->|"routes requests"| node_reviews
node_authroutes -->|"authenticates"| node_auth
node_works -->|"authenticates"| node_auth
node_negotiation -->|"authenticates"| node_auth
node_payments -->|"authenticates"| node_auth
node_reviews -->|"authenticates"| node_auth
node_adminroutes -->|"authenticates"| node_auth
node_profileroutes -->|"authenticates"| node_auth
node_authroutes -->|"queries"| node_dbpool
node_works -->|"queries"| node_dbpool
node_negotiation -->|"queries"| node_dbpool
node_payments -->|"queries"| node_dbpool
node_reviews -->|"queries"| node_dbpool
node_adminroutes -->|"queries"| node_dbpool
node_profileroutes -->|"queries"| node_dbpool
node_dbpool -->|"connects to"| node_postgres

click node_app "https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/App.jsx"
click node_farmer "https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/FarmerDashboard.jsx"
click node_labour "https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/LabourDashboard.jsx"
click node_machine "https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/MachineDashboard.jsx"
click node_voice "https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/hooks/useSpeechToText.js"
click node_negotiation "https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/negotiations.js"
click node_payments "https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/payments.js"
click node_reviews "https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/reviews.js"
click node_profileui "https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/ProfileSettings.jsx"
click node_authui "https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/Login.jsx"
click node_adminui "https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/AdminDashboard.jsx"
click node_api "https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/app.js"
click node_auth "https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/middleware/auth.js"
click node_authroutes "https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/auth.js"
click node_works "https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/works.js"
click node_profileroutes "https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/profile.js"
click node_adminroutes "https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/admin.js"
click node_dbpool "https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/db/pool.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_app,node_voice,node_user toneBlue
class node_farmer,node_labour,node_machine,node_works,node_postgres toneAmber
class node_negotiation,node_payments,node_reviews toneMint
class node_profileui,node_authui,node_adminui,node_authroutes,node_profileroutes,node_adminroutes toneRose
class node_api,node_auth,node_dbpool toneIndigo
```

## Components

### Web application

- [Role-based routing](https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Voice input](https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/hooks/useSpeechToText.js): `frontend/src/hooks/useSpeechToText.js`

### Work matching

- [Farmer dashboard](https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/FarmerDashboard.jsx): `frontend/src/routes/FarmerDashboard.jsx`
- [Labour dashboard](https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/LabourDashboard.jsx): `frontend/src/routes/LabourDashboard.jsx`
- [Machine dashboard](https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/MachineDashboard.jsx): `frontend/src/routes/MachineDashboard.jsx`
- [Work listings](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/works.js): `backend/src/routes/works.js`

### Work transactions

- [Negotiations](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/negotiations.js): `backend/src/routes/negotiations.js`
- [Payments](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/payments.js): `backend/src/routes/payments.js`
- [Reviews and ratings](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/reviews.js): `backend/src/routes/reviews.js`

### Accounts and administration

- [Profile settings](https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/ProfileSettings.jsx): `frontend/src/routes/ProfileSettings.jsx`
- [Login and registration](https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/Login.jsx): `frontend/src/routes/Login.jsx`
- [Admin dashboard](https://github.com/appireddy-hemanth/agriconnect/blob/main/frontend/src/routes/AdminDashboard.jsx): `frontend/src/routes/AdminDashboard.jsx`
- [Authentication routes](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [Profile routes](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/profile.js): `backend/src/routes/profile.js`
- [Admin routes](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/routes/admin.js): `backend/src/routes/admin.js`

### API and persistence

- [Express API](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/app.js): `backend/src/app.js`
- [JWT authentication](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [PostgreSQL connection pool](https://github.com/appireddy-hemanth/agriconnect/blob/main/backend/src/db/pool.js): `backend/src/db/pool.js`

### Other components

- **Farm users**
- **PostgreSQL database**

## Connections

- Farm users → Role-based routing: uses (evidence: `frontend/src/App.jsx`)
- Role-based routing → Login and registration: routes to (evidence: `frontend/src/App.jsx`)
- Role-based routing → Farmer dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Role-based routing → Labour dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Role-based routing → Machine dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Role-based routing → Admin dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Farmer dashboard → Work listings: posts work
- Labour dashboard → Work listings: browses and accepts
- Machine dashboard → Work listings: browses and accepts
- Farmer dashboard → Negotiations: negotiates
- Labour dashboard → Negotiations: negotiates
- Machine dashboard → Negotiations: negotiates
- Farmer dashboard → Payments: tracks payments
- Farmer dashboard → Reviews and ratings: submits reviews
- Labour dashboard → Reviews and ratings: views ratings
- Machine dashboard → Reviews and ratings: views ratings
- Farmer dashboard → Voice input: uses voice input (evidence: `frontend/src/routes/FarmerDashboard.jsx`)
- Role-based routing → Express API: calls API
- Express API → Authentication routes: routes requests (evidence: `backend/src/app.js`)
- Express API → Work listings: routes requests (evidence: `backend/src/app.js`)
- Express API → Admin routes: routes requests (evidence: `backend/src/app.js`)
- Express API → Profile routes: routes requests (evidence: `backend/src/app.js`)
- Express API → Negotiations: routes requests (evidence: `backend/src/app.js`)
- Express API → Payments: routes requests (evidence: `backend/src/app.js`)
- Express API → Reviews and ratings: routes requests (evidence: `backend/src/app.js`)
- Authentication routes → JWT authentication: authenticates (evidence: `backend/src/routes/auth.js`)
- Work listings → JWT authentication: authenticates (evidence: `backend/src/routes/works.js`)
- Negotiations → JWT authentication: authenticates (evidence: `backend/src/routes/negotiations.js`)
- Payments → JWT authentication: authenticates (evidence: `backend/src/routes/payments.js`)
- Reviews and ratings → JWT authentication: authenticates (evidence: `backend/src/routes/reviews.js`)
- Admin routes → JWT authentication: authenticates (evidence: `backend/src/routes/admin.js`)
- Profile routes → JWT authentication: authenticates (evidence: `backend/src/routes/profile.js`)
- Authentication routes → PostgreSQL connection pool: queries (evidence: `backend/src/routes/auth.js`)
- Work listings → PostgreSQL connection pool: queries (evidence: `backend/src/routes/works.js`)
- Negotiations → PostgreSQL connection pool: queries (evidence: `backend/src/routes/negotiations.js`)
- Payments → PostgreSQL connection pool: queries (evidence: `backend/src/routes/payments.js`)
- Reviews and ratings → PostgreSQL connection pool: queries (evidence: `backend/src/routes/reviews.js`)
- Admin routes → PostgreSQL connection pool: queries (evidence: `backend/src/routes/admin.js`)
- Profile routes → PostgreSQL connection pool: queries (evidence: `backend/src/routes/profile.js`)
- PostgreSQL connection pool → PostgreSQL database: connects to (evidence: `backend/src/db/pool.js`)
