# asshzzz/breedify architecture

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

- Interactive diagram: https://gitdiagram.com/asshzzz/breedify
- Repository: https://github.com/asshzzz/breedify

## Overview

Breedify is a cattle and buffalo evaluation product whose main workflow is capturing or uploading an animal image, predicting its breed, and presenting a saved classification record. The web app also provides records, reports, accounts/settings, and a livestock marketplace with chats. The graph reflects the sampled Express routes/controllers and documented frontend capabilities; several frontend-to-API links and unsampled subsystems are documented or indicated as unverified rather than inferred from names alone.

Main entry points: [`frontend/src/api.js`](https://github.com/asshzzz/breedify/blob/main/frontend/src/api.js) (API client), [`frontend/src/App.jsx`](https://github.com/asshzzz/breedify/blob/main/frontend/src/App.jsx) (Web routes), [`backend/src/app.js`](https://github.com/asshzzz/breedify/blob/main/backend/src/app.js) (API route mounting), [`backend/src/models/record.model.js`](https://github.com/asshzzz/breedify/blob/main/backend/src/models/record.model.js) (Animal records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Web routes<br/>[App.jsx]"]
  node_capture["Camera capture<br/>[Capture.jsx]"]
  node_upload["Image upload<br/>[UploadImage.jsx]"]
  node_result["Classification result<br/>[Result.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_recordsui["Records browser<br/>[Records.jsx]"]
  node_reportsui["Analytics reports<br/>[Reports.jsx]"]
  node_accountui["Accounts and settings<br/>[Register.jsx]"]
  node_clientapi["API client<br/>[api.js]"]
end

subgraph group_evaluation["Animal evaluation"]
  node_predict["Breed prediction"]
  node_imageops["Image processing"]
  node_roboflow{{"Roboflow workflow"}}
  node_cloudinary{{"Cloudinary images<br/>[cloudinary.js]"}}
end

subgraph group_backend["API and persistence"]
  node_records[("Animal records<br/>[record.model.js]")]
  node_recordroutes["Record endpoints<br/>[record.routes.js]"]
  node_authroutes["Account endpoints<br/>[user.routes.js]"]
  node_authlogic["Account services<br/>[user.controller.js]"]
  node_authmw["JWT authentication<br/>[auth.middleware.js]"]
  node_reportlogic["Report generation"]
  node_reports[("Report data<br/>[report.model.js]")]
  node_approuter["API route mounting<br/>[app.js]"]
end

subgraph group_marketplace["Marketplace and chat"]
  node_sellui["Listing management<br/>[SellAnimal.jsx]"]
  node_chatui["Marketplace chats<br/>[Chats.jsx]"]
  node_listingroutes["Listing and chat routes<br/>[listing.routes.js]"]
  node_listingdata[("Listings<br/>[listing.model.js]")]
  node_socket["Realtime chat<br/>[socket.js]"]
end

node_user(("Animal evaluator"))
node_seller(("Livestock seller or buyer"))
node_bpa{{"Bharat Pashudhan App"}}

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_capture
node_webapp -->|"routes to"| node_upload
node_webapp -->|"routes to"| node_result
node_webapp -->|"routes to"| node_dashboard
node_webapp -->|"routes to"| node_recordsui
node_webapp -->|"routes to"| node_reportsui
node_webapp -->|"routes to"| node_accountui
node_capture -.->|"submits details"| node_clientapi
node_upload -.->|"requests prediction"| node_clientapi
node_recordsui -.->|"fetches records"| node_clientapi
node_reportsui -.->|"requests reports"| node_clientapi
node_clientapi -->|"calls records API"| node_recordroutes
node_clientapi -->|"calls account API"| node_authroutes
node_clientapi -->|"requests reports"| node_reportlogic
node_approuter -->|"mounts"| node_recordroutes
node_approuter -->|"mounts"| node_authroutes
node_approuter -->|"mounts report routes"| node_reportlogic
node_approuter -->|"mounts"| node_listingroutes
node_approuter -->|"mounts prediction route"| node_predict
node_recordroutes -->|"reads and writes"| node_records
node_recordroutes -->|"authenticates"| node_authmw
node_authroutes -->|"dispatches"| node_authlogic
node_authroutes -->|"authenticates"| node_authmw
node_authlogic -.->|"uses account model"| node_records
node_authmw -.->|"loads user"| node_authlogic
node_predict -->|"classifies image"| node_roboflow
node_predict -->|"uploads image"| node_cloudinary
node_predict -->|"creates evaluation"| node_records
node_imageops -->|"uploads image"| node_cloudinary
node_imageops -->|"updates evaluation"| node_records
node_reportlogic -->|"reads report data"| node_reports
node_seller -.->|"creates listings"| node_sellui
node_seller -.->|"uses marketplace"| node_chatui
node_sellui -->|"uses listing API"| node_clientapi
node_chatui -.->|"uses chat API"| node_clientapi
node_listingroutes -->|"reads and writes"| node_listingdata
node_listingroutes -->|"authenticates"| node_authmw
node_listingroutes -.->|"dispatches chat"| node_socket
node_records -.->|"exports records"| node_bpa

click node_webapp "https://github.com/asshzzz/breedify/blob/main/frontend/src/App.jsx"
click node_capture "https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Capture.jsx"
click node_upload "https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/UploadImage.jsx"
click node_result "https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Result.jsx"
click node_dashboard "https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Dashboard.jsx"
click node_recordsui "https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Records.jsx"
click node_reportsui "https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Reports.jsx"
click node_accountui "https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Register.jsx"
click node_clientapi "https://github.com/asshzzz/breedify/blob/main/frontend/src/api.js"
click node_predict "https://github.com/asshzzz/breedify/blob/main/backend/src/controllers/predict.controller.js"
click node_imageops "https://github.com/asshzzz/breedify/blob/main/backend/src/controllers/image.controller.js"
click node_cloudinary "https://github.com/asshzzz/breedify/blob/main/backend/src/utils/cloudinary.js"
click node_records "https://github.com/asshzzz/breedify/blob/main/backend/src/models/record.model.js"
click node_recordroutes "https://github.com/asshzzz/breedify/blob/main/backend/src/routes/record.routes.js"
click node_authroutes "https://github.com/asshzzz/breedify/blob/main/backend/src/routes/user.routes.js"
click node_authlogic "https://github.com/asshzzz/breedify/blob/main/backend/src/controllers/user.controller.js"
click node_authmw "https://github.com/asshzzz/breedify/blob/main/backend/src/middlewares/auth.middleware.js"
click node_reportlogic "https://github.com/asshzzz/breedify/blob/main/backend/src/controllers/report.controller.js"
click node_reports "https://github.com/asshzzz/breedify/blob/main/backend/src/models/report.model.js"
click node_approuter "https://github.com/asshzzz/breedify/blob/main/backend/src/app.js"
click node_sellui "https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/SellAnimal.jsx"
click node_chatui "https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Chats.jsx"
click node_listingroutes "https://github.com/asshzzz/breedify/blob/main/backend/src/routes/listing.routes.js"
click node_listingdata "https://github.com/asshzzz/breedify/blob/main/backend/src/models/listing.model.js"
click node_socket "https://github.com/asshzzz/breedify/blob/main/backend/src/socket.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_webapp,node_capture,node_upload,node_result,node_dashboard,node_recordsui,node_reportsui,node_accountui,node_clientapi toneBlue
class node_predict,node_imageops,node_roboflow,node_cloudinary toneAmber
class node_records,node_recordroutes,node_authroutes,node_authlogic,node_authmw,node_reportlogic,node_reports,node_approuter toneMint
class node_sellui,node_chatui,node_listingroutes,node_listingdata,node_socket toneRose
class node_user,node_seller,node_bpa toneIndigo
```

## Components

### Web application

- [Web routes](https://github.com/asshzzz/breedify/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Camera capture](https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Capture.jsx): `frontend/src/pages/Capture.jsx`
- [Image upload](https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/UploadImage.jsx): `frontend/src/pages/UploadImage.jsx`
- [Classification result](https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Result.jsx): `frontend/src/pages/Result.jsx`
- [Dashboard](https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Records browser](https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Records.jsx): `frontend/src/pages/Records.jsx`
- [Analytics reports](https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Reports.jsx): `frontend/src/pages/Reports.jsx`
- [Accounts and settings](https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Register.jsx): `frontend/src/pages/Register.jsx`
- [API client](https://github.com/asshzzz/breedify/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Animal evaluation

- [Breed prediction](https://github.com/asshzzz/breedify/blob/main/backend/src/controllers/predict.controller.js): `backend/src/controllers/predict.controller.js`
- [Image processing](https://github.com/asshzzz/breedify/blob/main/backend/src/controllers/image.controller.js): `backend/src/controllers/image.controller.js`
- **Roboflow workflow**
- [Cloudinary images](https://github.com/asshzzz/breedify/blob/main/backend/src/utils/cloudinary.js): `backend/src/utils/cloudinary.js`

### API and persistence

- [Animal records](https://github.com/asshzzz/breedify/blob/main/backend/src/models/record.model.js): `backend/src/models/record.model.js`
- [Record endpoints](https://github.com/asshzzz/breedify/blob/main/backend/src/routes/record.routes.js): `backend/src/routes/record.routes.js`
- [Account endpoints](https://github.com/asshzzz/breedify/blob/main/backend/src/routes/user.routes.js): `backend/src/routes/user.routes.js`
- [Account services](https://github.com/asshzzz/breedify/blob/main/backend/src/controllers/user.controller.js): `backend/src/controllers/user.controller.js`
- [JWT authentication](https://github.com/asshzzz/breedify/blob/main/backend/src/middlewares/auth.middleware.js): `backend/src/middlewares/auth.middleware.js`
- [Report generation](https://github.com/asshzzz/breedify/blob/main/backend/src/controllers/report.controller.js): `backend/src/controllers/report.controller.js`
- [Report data](https://github.com/asshzzz/breedify/blob/main/backend/src/models/report.model.js): `backend/src/models/report.model.js`
- [API route mounting](https://github.com/asshzzz/breedify/blob/main/backend/src/app.js): `backend/src/app.js`

### Marketplace and chat

- [Listing management](https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/SellAnimal.jsx): `frontend/src/pages/SellAnimal.jsx`
- [Marketplace chats](https://github.com/asshzzz/breedify/blob/main/frontend/src/pages/Chats.jsx): `frontend/src/pages/Chats.jsx`
- [Listing and chat routes](https://github.com/asshzzz/breedify/blob/main/backend/src/routes/listing.routes.js): `backend/src/routes/listing.routes.js`
- [Listings](https://github.com/asshzzz/breedify/blob/main/backend/src/models/listing.model.js): `backend/src/models/listing.model.js`
- [Realtime chat](https://github.com/asshzzz/breedify/blob/main/backend/src/socket.js): `backend/src/socket.js`

### Other components

- **Animal evaluator**
- **Livestock seller or buyer**
- **Bharat Pashudhan App**

## Connections

- Animal evaluator → Web routes: uses (evidence: `frontend/src/App.jsx`)
- Web routes → Camera capture: routes to (evidence: `frontend/src/App.jsx`)
- Web routes → Image upload: routes to (evidence: `frontend/src/App.jsx`)
- Web routes → Classification result: routes to (evidence: `frontend/src/App.jsx`)
- Web routes → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Web routes → Records browser: routes to (evidence: `frontend/src/App.jsx`)
- Web routes → Analytics reports: routes to (evidence: `frontend/src/App.jsx`)
- Web routes → Accounts and settings: routes to (evidence: `frontend/src/App.jsx`)
- Camera capture → API client: submits details
- Image upload → API client: requests prediction
- Records browser → API client: fetches records
- Analytics reports → API client: requests reports
- API client → Record endpoints: calls records API (evidence: `README.md`)
- API client → Account endpoints: calls account API (evidence: `README.md`)
- API client → Report generation: requests reports (evidence: `README.md`)
- API route mounting → Record endpoints: mounts (evidence: `backend/src/app.js`)
- API route mounting → Account endpoints: mounts (evidence: `backend/src/app.js`)
- API route mounting → Report generation: mounts report routes (evidence: `backend/src/app.js`)
- API route mounting → Listing and chat routes: mounts (evidence: `backend/src/app.js`)
- API route mounting → Breed prediction: mounts prediction route (evidence: `backend/src/app.js`)
- Record endpoints → Animal records: reads and writes (evidence: `backend/src/routes/record.routes.js`)
- Record endpoints → JWT authentication: authenticates (evidence: `backend/src/routes/record.routes.js`)
- Account endpoints → Account services: dispatches (evidence: `backend/src/routes/user.routes.js`)
- Account endpoints → JWT authentication: authenticates (evidence: `backend/src/routes/user.routes.js`)
- Account services → Animal records: uses account model
- JWT authentication → Account services: loads user
- Breed prediction → Roboflow workflow: classifies image (evidence: `backend/src/controllers/predict.controller.js`)
- Breed prediction → Cloudinary images: uploads image (evidence: `backend/src/controllers/predict.controller.js`)
- Breed prediction → Animal records: creates evaluation (evidence: `backend/src/controllers/predict.controller.js`)
- Image processing → Cloudinary images: uploads image (evidence: `backend/src/controllers/image.controller.js`)
- Image processing → Animal records: updates evaluation (evidence: `backend/src/controllers/image.controller.js`)
- Report generation → Report data: reads report data (evidence: `backend/src/controllers/report.controller.js`)
- Livestock seller or buyer → Listing management: creates listings
- Livestock seller or buyer → Marketplace chats: uses marketplace
- Listing management → API client: uses listing API (evidence: `frontend/src/pages/SellAnimal.jsx`)
- Marketplace chats → API client: uses chat API
- Listing and chat routes → Listings: reads and writes (evidence: `backend/src/routes/listing.routes.js`)
- Listing and chat routes → JWT authentication: authenticates (evidence: `backend/src/routes/listing.routes.js`)
- Listing and chat routes → Realtime chat: dispatches chat
- Animal records → Bharat Pashudhan App: exports records (evidence: `README.md`)
