# nikhilbogawar/farmers-connect architecture

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

- Interactive diagram: https://gitdiagram.com/nikhilbogawar/farmers-connect
- Repository: https://github.com/nikhilbogawar/farmers-connect

## Overview

FarmersConnect is a Flask agricultural assistant. Farmers register or sign in, then request crop, fertilizer, or image-based disease predictions; authenticated prediction routes save results for dashboard statistics and history. The README also documents treatment guidance and multilingual support. The graph follows relationships visible in excerpts or README statements; unsampled implementation details and integrations are omitted rather than inferred.

Main entry points: [`app/__init__.py`](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/__init__.py) (App factory), [`app/predictions/__init__.py`](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/predictions/__init__.py) (Prediction routes), [`app/main/__init__.py`](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/main/__init__.py) (Dashboard and history), [`app/auth/__init__.py`](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/auth/__init__.py) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_entry["Flask entry point<br/>[app.py]"]
  node_factory["App factory<br/>[__init__.py]"]
  node_dashboard["Dashboard and history<br/>[__init__.py]"]
  node_pages["Web pages"]
  node_language["Translation support"]
end

subgraph group_accounts["Accounts and history"]
  node_auth["Authentication<br/>[__init__.py]"]
  node_user["User accounts<br/>[models.py]"]
  node_history[("Prediction history<br/>[models.py]")]
end

subgraph group_recommendations["Agricultural recommendations"]
  node_prediction_routes["Prediction routes<br/>[__init__.py]"]
  node_crop["Crop recommendations<br/>[ml_utils.py]"]
  node_fertilizer["Fertilizer suggestions<br/>[ml_utils.py]"]
  node_disease_route["Disease upload route<br/>[__init__.py]"]
  node_disease_model["Image classifier<br/>[disease_logic.py]"]
  node_disease_guidance["Disease guidance<br/>[ml_utils.py]"]
end

subgraph group_runtime["Runtime and models"]
  node_config["Configuration<br/>[config.py]"]
  node_models["Model loading<br/>[ml_utils.py]"]
end

node_farmer(("Farmer"))

node_farmer -->|"uses"| node_entry
node_entry -->|"creates app"| node_factory
node_factory -->|"loads config"| node_config
node_factory -->|"registers"| node_auth
node_factory -->|"registers"| node_dashboard
node_factory -->|"registers"| node_prediction_routes
node_auth -->|"reads and writes"| node_user
node_dashboard -->|"queries"| node_history
node_prediction_routes -->|"requests prediction"| node_crop
node_prediction_routes -->|"requests suggestion"| node_fertilizer
node_prediction_routes -->|"records result"| node_history
node_dashboard -->|"renders"| node_pages
node_auth -->|"renders"| node_pages
node_prediction_routes -->|"renders"| node_pages
node_disease_route -->|"calls classifier"| node_disease_model
node_disease_model -->|"loads weights"| node_models
node_language -.->|"serves translations"| node_farmer
node_farmer -.->|"can receive guidance"| node_disease_guidance

click node_entry "https://github.com/nikhilbogawar/farmers-connect/blob/main/app.py"
click node_factory "https://github.com/nikhilbogawar/farmers-connect/blob/main/app/__init__.py"
click node_auth "https://github.com/nikhilbogawar/farmers-connect/blob/main/app/auth/__init__.py"
click node_user "https://github.com/nikhilbogawar/farmers-connect/blob/main/app/models.py"
click node_history "https://github.com/nikhilbogawar/farmers-connect/blob/main/app/models.py"
click node_dashboard "https://github.com/nikhilbogawar/farmers-connect/blob/main/app/main/__init__.py"
click node_prediction_routes "https://github.com/nikhilbogawar/farmers-connect/blob/main/app/predictions/__init__.py"
click node_crop "https://github.com/nikhilbogawar/farmers-connect/blob/main/ml_utils.py"
click node_fertilizer "https://github.com/nikhilbogawar/farmers-connect/blob/main/ml_utils.py"
click node_disease_route "https://github.com/nikhilbogawar/farmers-connect/blob/main/app/main/__init__.py"
click node_disease_model "https://github.com/nikhilbogawar/farmers-connect/blob/main/app/predictions/disease_logic.py"
click node_disease_guidance "https://github.com/nikhilbogawar/farmers-connect/blob/main/ml_utils.py"
click node_config "https://github.com/nikhilbogawar/farmers-connect/blob/main/config.py"
click node_models "https://github.com/nikhilbogawar/farmers-connect/blob/main/ml_utils.py"
click node_pages "https://github.com/nikhilbogawar/farmers-connect/tree/main/templates"
click node_language "https://github.com/nikhilbogawar/farmers-connect/tree/main/templates"

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_entry,node_factory,node_dashboard,node_pages,node_language toneBlue
class node_auth,node_user,node_history toneAmber
class node_prediction_routes,node_crop,node_fertilizer,node_disease_route,node_disease_model,node_disease_guidance toneMint
class node_config,node_models toneRose
class node_farmer toneIndigo
```

## Components

### Web application

- [Flask entry point](https://github.com/nikhilbogawar/farmers-connect/blob/main/app.py): `app.py`
- [App factory](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/__init__.py): `app/__init__.py`
- [Dashboard and history](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/main/__init__.py): `app/main/__init__.py`
- [Web pages](https://github.com/nikhilbogawar/farmers-connect/tree/main/templates): `templates`
- [Translation support](https://github.com/nikhilbogawar/farmers-connect/tree/main/templates): `templates`

### Accounts and history

- [Authentication](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/auth/__init__.py): `app/auth/__init__.py`
- [User accounts](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/models.py): `app/models.py`
- [Prediction history](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/models.py): `app/models.py`

### Agricultural recommendations

- [Prediction routes](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/predictions/__init__.py): `app/predictions/__init__.py`
- [Crop recommendations](https://github.com/nikhilbogawar/farmers-connect/blob/main/ml_utils.py): `ml_utils.py`
- [Fertilizer suggestions](https://github.com/nikhilbogawar/farmers-connect/blob/main/ml_utils.py): `ml_utils.py`
- [Disease upload route](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/main/__init__.py): `app/main/__init__.py`
- [Image classifier](https://github.com/nikhilbogawar/farmers-connect/blob/main/app/predictions/disease_logic.py): `app/predictions/disease_logic.py`
- [Disease guidance](https://github.com/nikhilbogawar/farmers-connect/blob/main/ml_utils.py): `ml_utils.py`

### Runtime and models

- [Configuration](https://github.com/nikhilbogawar/farmers-connect/blob/main/config.py): `config.py`
- [Model loading](https://github.com/nikhilbogawar/farmers-connect/blob/main/ml_utils.py): `ml_utils.py`

### Other components

- **Farmer**

## Connections

- Farmer → Flask entry point: uses (evidence: `README.md`)
- Flask entry point → App factory: creates app (evidence: `app.py`)
- App factory → Configuration: loads config (evidence: `app/__init__.py`)
- App factory → Authentication: registers (evidence: `app/__init__.py`)
- App factory → Dashboard and history: registers (evidence: `app/__init__.py`)
- App factory → Prediction routes: registers (evidence: `app/__init__.py`)
- Authentication → User accounts: reads and writes (evidence: `app/auth/__init__.py`)
- Dashboard and history → Prediction history: queries (evidence: `app/main/__init__.py`)
- Prediction routes → Crop recommendations: requests prediction (evidence: `app/predictions/__init__.py`)
- Prediction routes → Fertilizer suggestions: requests suggestion (evidence: `app/predictions/__init__.py`)
- Prediction routes → Prediction history: records result (evidence: `app/predictions/__init__.py`)
- Dashboard and history → Web pages: renders (evidence: `app/main/__init__.py`)
- Authentication → Web pages: renders (evidence: `app/auth/__init__.py`)
- Prediction routes → Web pages: renders (evidence: `app/predictions/__init__.py`)
- Disease upload route → Image classifier: calls classifier (evidence: `app/main/__init__.py`)
- Image classifier → Model loading: loads weights (evidence: `app/predictions/disease_logic.py`)
- Translation support → Farmer: serves translations (evidence: `README.md`)
- Farmer → Disease guidance: can receive guidance (evidence: `README.md`)
