# kalibbalajohnson/poultry-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/kalibbalajohnson/poultry-management-system
- Repository: https://github.com/kalibbalajohnson/poultry-management-system

## Overview

Poultry Management System combines a web dashboard, an Express API, and a separate feed-formula optimizer. The main user workflow is dashboard navigation into farm operations, with API routes handling server-side management and persistence; feed optimization is an explicit API-to-service call. The README also describes mobile access and IoT monitoring, but those implementations are absent from the supplied tree. The frontend’s API calls and the AI-Model’s role are not established by the excerpts, so those connections are omitted.

Main entry points: [`Web-App/src/App.tsx`](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/App.tsx) (Web application), [`API/app.js`](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/app.js) (Express API), [`API/config/db.js`](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/config/db.js) (MongoDB), [`API/src/users/users.controller.js`](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/users/users.controller.js) (Users and farms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web dashboard"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[dashBoard.tsx]"]
  node_flock_ui["Birds and houses<br/>[birds.tsx]"]
  node_production_ui["Production<br/>[production.tsx]"]
  node_stock_ui["Stock<br/>[stock.tsx]"]
  node_diagnosis_ui["Diagnosis<br/>[diagnosis.tsx]"]
  node_formula_ui["Feed formulas<br/>[create.tsx]"]
end

subgraph group_api["Core API"]
  node_api["Express API<br/>[app.js]"]
  node_auth["Authentication<br/>[authMiddleware.js]"]
end

subgraph group_data["Farm operations"]
  node_users["Users and farms"]
  node_flock["Batches and houses"]
  node_production["Production records"]
  node_inventory["Stock management"]
  node_health["Diagnosis and monitoring"]
  node_immunization["Immunization"]
  node_feed_api["Formula management"]
  node_mongo[("MongoDB<br/>[db.js]")]
end

subgraph group_intelligence["Optimization"]
  node_optimizer_api["Optimizer endpoint<br/>[main.py]"]
  node_optimizer["Formula generation<br/>[optimizer.py]"]
  node_ai_model["Predictive model service<br/>[main.py]"]
end

node_farmer(("Farm user"))

node_farmer -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_dashboard
node_webapp -->|"routes to"| node_flock_ui
node_webapp -->|"routes to"| node_production_ui
node_webapp -->|"routes to"| node_stock_ui
node_webapp -->|"routes to"| node_diagnosis_ui
node_webapp -->|"routes to"| node_formula_ui
node_api -->|"mounts routes"| node_users
node_api -->|"mounts routes"| node_health
node_api -->|"mounts routes"| node_flock
node_api -->|"mounts routes"| node_production
node_api -->|"mounts routes"| node_inventory
node_api -.->|"routes to"| node_feed_api
node_users -->|"uses on protected routes"| node_auth
node_flock -->|"reads and writes"| node_mongo
node_production -->|"reads and writes"| node_mongo
node_inventory -->|"reads and writes"| node_mongo
node_health -->|"reads and writes"| node_mongo
node_feed_api -->|"posts optimization request"| node_optimizer_api
node_optimizer_api -->|"calls generator"| node_optimizer

click node_webapp "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/App.tsx"
click node_dashboard "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/dashBoard.tsx"
click node_flock_ui "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/birds.tsx"
click node_production_ui "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/production.tsx"
click node_stock_ui "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/stock.tsx"
click node_diagnosis_ui "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/diagnosis/diagnosis.tsx"
click node_formula_ui "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/feed-formula/create.tsx"
click node_api "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/app.js"
click node_auth "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/config/authMiddleware.js"
click node_users "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/users/users.controller.js"
click node_flock "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/batch/batch.controller.js"
click node_production "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/production/production.controller.js"
click node_inventory "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/stock/stock.controller.js"
click node_health "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/diagnosis/diagnosis.controller.js"
click node_immunization "https://github.com/kalibbalajohnson/poultry-management-system/tree/main/API/src/immunization"
click node_feed_api "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/feed-formula/feed-formula.controller.js"
click node_mongo "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/config/db.js"
click node_optimizer_api "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/FeedOptimizer/main.py"
click node_optimizer "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/FeedOptimizer/optimizer/optimizer.py"
click node_ai_model "https://github.com/kalibbalajohnson/poultry-management-system/blob/main/AI-Model/main.py"

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_dashboard,node_flock_ui,node_production_ui,node_stock_ui,node_diagnosis_ui,node_formula_ui,node_farmer toneBlue
class node_api,node_auth toneAmber
class node_users,node_flock,node_production,node_inventory,node_health,node_immunization,node_feed_api,node_mongo toneMint
class node_optimizer_api,node_optimizer,node_ai_model toneRose
```

## Components

### Web dashboard

- [Web application](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/App.tsx): `Web-App/src/App.tsx`
- [Dashboard](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/dashBoard.tsx): `Web-App/src/pages/dashBoard.tsx`
- [Birds and houses](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/birds.tsx): `Web-App/src/pages/birds.tsx`
- [Production](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/production.tsx): `Web-App/src/pages/production.tsx`
- [Stock](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/stock.tsx): `Web-App/src/pages/stock.tsx`
- [Diagnosis](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/diagnosis/diagnosis.tsx): `Web-App/src/pages/diagnosis/diagnosis.tsx`
- [Feed formulas](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/Web-App/src/pages/feed-formula/create.tsx): `Web-App/src/pages/feed-formula/create.tsx`

### Core API

- [Express API](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/app.js): `API/app.js`
- [Authentication](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/config/authMiddleware.js): `API/config/authMiddleware.js`

### Farm operations

- [Users and farms](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/users/users.controller.js): `API/src/users/users.controller.js`
- [Batches and houses](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/batch/batch.controller.js): `API/src/batch/batch.controller.js`
- [Production records](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/production/production.controller.js): `API/src/production/production.controller.js`
- [Stock management](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/stock/stock.controller.js): `API/src/stock/stock.controller.js`
- [Diagnosis and monitoring](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/diagnosis/diagnosis.controller.js): `API/src/diagnosis/diagnosis.controller.js`
- [Immunization](https://github.com/kalibbalajohnson/poultry-management-system/tree/main/API/src/immunization): `API/src/immunization`
- [Formula management](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/src/feed-formula/feed-formula.controller.js): `API/src/feed-formula/feed-formula.controller.js`
- [MongoDB](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/API/config/db.js): `API/config/db.js`

### Optimization

- [Optimizer endpoint](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/FeedOptimizer/main.py): `FeedOptimizer/main.py`
- [Formula generation](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/FeedOptimizer/optimizer/optimizer.py): `FeedOptimizer/optimizer/optimizer.py`
- [Predictive model service](https://github.com/kalibbalajohnson/poultry-management-system/blob/main/AI-Model/main.py): `AI-Model/main.py`

### Other components

- **Farm user**

## Connections

- Farm user → Web application: uses (evidence: `README.md`)
- Web application → Dashboard: routes to (evidence: `Web-App/src/App.tsx`)
- Web application → Birds and houses: routes to (evidence: `Web-App/src/App.tsx`)
- Web application → Production: routes to (evidence: `Web-App/src/App.tsx`)
- Web application → Stock: routes to (evidence: `Web-App/src/App.tsx`)
- Web application → Diagnosis: routes to (evidence: `Web-App/src/App.tsx`)
- Web application → Feed formulas: routes to (evidence: `Web-App/src/App.tsx`)
- Express API → Users and farms: mounts routes (evidence: `API/app.js`)
- Express API → Diagnosis and monitoring: mounts routes (evidence: `API/app.js`)
- Express API → Batches and houses: mounts routes (evidence: `API/app.js`)
- Express API → Production records: mounts routes (evidence: `API/app.js`)
- Express API → Stock management: mounts routes (evidence: `API/app.js`)
- Express API → Formula management: routes to
- Users and farms → Authentication: uses on protected routes (evidence: `API/src/users/users.routes.js`)
- Batches and houses → MongoDB: reads and writes (evidence: `API/src/batch/batch.controller.js`)
- Production records → MongoDB: reads and writes (evidence: `API/src/production/production.controller.js`)
- Stock management → MongoDB: reads and writes (evidence: `API/src/stock/stock.controller.js`)
- Diagnosis and monitoring → MongoDB: reads and writes (evidence: `API/src/diagnosis/diagnosis.controller.js`)
- Formula management → Optimizer endpoint: posts optimization request (evidence: `API/src/feed-formula/feed-formula.controller.js`)
- Optimizer endpoint → Formula generation: calls generator (evidence: `FeedOptimizer/main.py`)
