# meet-jethwa/devops-project architecture

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

- Interactive diagram: https://gitdiagram.com/meet-jethwa/devops-project
- Repository: https://github.com/meet-jethwa/devops-project

## Overview

This repository is an educational sugarcane irrigation advisory lab: one farmer-facing chat workflow shown in monolithic, three-tier, and microservice deployments. The microservice flow is documented as browser → nginx → gateway → NLP → recommendation → advisory, with feedback stored separately; the monolith and three-tier versions provide parallel implementations. Source excerpts verify key monolith and microservice calls, but not every service boundary or the three-tier wiring, so undocumented arrows are omitted. Sensor and weather inputs are simulated, not a real controller.

Main entry points: [`3-microservices/services/gateway/main.py`](https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/gateway/main.py) (API gateway), [`1-monolith/api.py`](https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/api.py) (Monolith API), [`app/static/chat.js`](https://github.com/meet-jethwa/devops-project/blob/main/app/static/chat.js) (Chat frontend), [`3-microservices/services/advisory-service/main.py`](https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/advisory-service/main.py) (Advisory service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Farmer interface"]
  node_frontend["Chat frontend<br/>[chat.js]"]
end

subgraph group_mono["Monolith runtime"]
  node_mono_api["Monolith API<br/>[api.py]"]
  node_mono_pipeline["Query pipeline<br/>[pipeline.py]"]
  node_gazetteer["Slot extraction<br/>[gazetteer.py]"]
  node_templates["Advisory templates<br/>[templates.py]"]
  node_gemini_helper["Gemini helper<br/>[gemini.py]"]
  node_monolith_feedback["Feedback log<br/>[api.py]"]
end

subgraph group_tier["Three-tier runtime"]
  node_three_logic["Logic API<br/>[main.py]"]
  node_three_db[("Feedback database<br/>[init.sql]")]
end

subgraph group_micro["Microservice runtime"]
  node_nginx["Nginx proxy<br/>[nginx.conf]"]
  node_gateway["API gateway<br/>[main.py]"]
  node_nlp["NLP service<br/>[main.py]"]
  node_recommendation["Recommendation service<br/>[main.py]"]
  node_advisory["Advisory service<br/>[main.py]"]
  node_feedback["Feedback service<br/>[main.py]"]
  node_micro_db[("Feedback database<br/>[docker-compose.yml]")]
end

subgraph group_external["External services"]
  node_gemini["Gemini API"]
  node_postgres[("PostgreSQL")]
end

node_farmer(("Farmer"))

node_farmer -->|"asks question"| node_frontend
node_frontend -->|"submits chat"| node_gateway
node_gateway -->|"analyzes query"| node_nlp
node_gateway -->|"requests recommendation"| node_recommendation
node_gateway -->|"requests advisory"| node_advisory
node_gateway -->|"forwards feedback"| node_feedback
node_feedback -->|"stores feedback"| node_micro_db
node_nginx -->|"proxies requests"| node_gateway
node_farmer -->|"uses chat"| node_frontend
node_frontend -->|"posts chat"| node_mono_api
node_mono_api -->|"processes query"| node_mono_pipeline
node_mono_pipeline -->|"extracts slots"| node_gazetteer
node_mono_api -->|"generates advisory"| node_gemini_helper
node_mono_api -->|"appends feedback"| node_monolith_feedback
node_three_logic -->|"stores feedback"| node_three_db
node_three_logic -->|"generates advisory"| node_gemini_helper
node_advisory -->|"renders text"| node_templates
node_advisory -.->|"requests generation"| node_gemini
node_gemini_helper -->|"requests generation"| node_gemini
node_three_db -.->|"runs on"| node_postgres
node_micro_db -.->|"runs on"| node_postgres

click node_frontend "https://github.com/meet-jethwa/devops-project/blob/main/app/static/chat.js"
click node_mono_api "https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/api.py"
click node_mono_pipeline "https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/pipeline.py"
click node_gazetteer "https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/gazetteer.py"
click node_templates "https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/templates.py"
click node_gemini_helper "https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/gemini.py"
click node_monolith_feedback "https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/api.py"
click node_three_logic "https://github.com/meet-jethwa/devops-project/blob/main/2-three-tier/logic/main.py"
click node_three_db "https://github.com/meet-jethwa/devops-project/blob/main/2-three-tier/data/init.sql"
click node_nginx "https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/nginx/nginx.conf"
click node_gateway "https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/gateway/main.py"
click node_nlp "https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/nlp-service/main.py"
click node_recommendation "https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/recommendation-service/main.py"
click node_advisory "https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/advisory-service/main.py"
click node_feedback "https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/feedback-service/main.py"
click node_micro_db "https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/docker-compose.yml"

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_frontend toneBlue
class node_mono_api,node_mono_pipeline,node_gazetteer,node_templates,node_gemini_helper,node_monolith_feedback toneAmber
class node_three_logic,node_three_db toneMint
class node_nginx,node_gateway,node_nlp,node_recommendation,node_advisory,node_feedback,node_micro_db toneRose
class node_gemini,node_postgres,node_farmer toneIndigo
```

## Components

### Farmer interface

- [Chat frontend](https://github.com/meet-jethwa/devops-project/blob/main/app/static/chat.js): `app/static/chat.js`

### Monolith runtime

- [Monolith API](https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/api.py): `1-monolith/api.py`
- [Query pipeline](https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/pipeline.py): `1-monolith/pipeline.py`
- [Slot extraction](https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/gazetteer.py): `1-monolith/gazetteer.py`
- [Advisory templates](https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/templates.py): `1-monolith/templates.py`
- [Gemini helper](https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/gemini.py): `1-monolith/gemini.py`
- [Feedback log](https://github.com/meet-jethwa/devops-project/blob/main/1-monolith/api.py): `1-monolith/api.py`

### Three-tier runtime

- [Logic API](https://github.com/meet-jethwa/devops-project/blob/main/2-three-tier/logic/main.py): `2-three-tier/logic/main.py`
- [Feedback database](https://github.com/meet-jethwa/devops-project/blob/main/2-three-tier/data/init.sql): `2-three-tier/data/init.sql`

### Microservice runtime

- [Nginx proxy](https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/nginx/nginx.conf): `3-microservices/nginx/nginx.conf`
- [API gateway](https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/gateway/main.py): `3-microservices/services/gateway/main.py`
- [NLP service](https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/nlp-service/main.py): `3-microservices/services/nlp-service/main.py`
- [Recommendation service](https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/recommendation-service/main.py): `3-microservices/services/recommendation-service/main.py`
- [Advisory service](https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/advisory-service/main.py): `3-microservices/services/advisory-service/main.py`
- [Feedback service](https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/services/feedback-service/main.py): `3-microservices/services/feedback-service/main.py`
- [Feedback database](https://github.com/meet-jethwa/devops-project/blob/main/3-microservices/docker-compose.yml): `3-microservices/docker-compose.yml`

### External services

- **Gemini API**
- **PostgreSQL**

### Other components

- **Farmer**

## Connections

- Farmer → Chat frontend: asks question (evidence: `README.md`)
- Chat frontend → API gateway: submits chat (evidence: `README.md`)
- API gateway → NLP service: analyzes query (evidence: `README.md`)
- API gateway → Recommendation service: requests recommendation (evidence: `README.md`)
- API gateway → Advisory service: requests advisory (evidence: `README.md`)
- API gateway → Feedback service: forwards feedback (evidence: `README.md`)
- Feedback service → Feedback database: stores feedback (evidence: `README.md`)
- Nginx proxy → API gateway: proxies requests (evidence: `README.md`)
- Farmer → Chat frontend: uses chat
- Chat frontend → Monolith API: posts chat
- Monolith API → Query pipeline: processes query (evidence: `1-monolith/api.py`)
- Query pipeline → Slot extraction: extracts slots (evidence: `1-monolith/pipeline.py`)
- Monolith API → Gemini helper: generates advisory (evidence: `1-monolith/api.py`)
- Monolith API → Feedback log: appends feedback (evidence: `1-monolith/api.py`)
- Logic API → Feedback database: stores feedback (evidence: `README.md`)
- Logic API → Gemini helper: generates advisory (evidence: `2-three-tier/logic/main.py`)
- Advisory service → Advisory templates: renders text (evidence: `3-microservices/services/advisory-service/main.py`)
- Advisory service → Gemini API: requests generation (evidence: `3-microservices/services/advisory-service/main.py`)
- Gemini helper → Gemini API: requests generation (evidence: `1-monolith/gemini.py`)
- Feedback database → PostgreSQL: runs on (evidence: `README.md`)
- Feedback database → PostgreSQL: runs on (evidence: `README.md`)
