# kadamyogiraj/crop-disease-detection-app- architecture

> Architecture diagram of the GitHub repository kadamyogiraj/crop-disease-detection-app-, 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/kadamyogiraj/crop-disease-detection-app-
- Repository: https://github.com/kadamyogiraj/crop-disease-detection-app-

## Overview

PlantCare AI is a Flask plant-care application with an Expo mobile shell that opens the hosted web app in a WebView. Users reach the Flask server, authenticate, submit plant images for diagnosis, and can use chat and review saved records. The sampled server excerpt shows diagnosis through Gemini and persistence through SQLite; the repository also contains a separate model-based prediction service and image-processing layer, but no sampled evidence connects that service to the Flask request flow. The tree lists page templates and model assets; their internal wiring is not shown.

Main entry points: [`PlantAppFlask/app.py`](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/app.py) (Flask routes), [`PlantAppFlask/database.py`](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/database.py) (SQLite records), [`PlantAppFlask/predict.py`](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/predict.py) (Disease prediction), [`PlantAppMobile/App.js`](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppMobile/App.js) (Mobile WebView)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client apps"]
  node_mobile["Mobile WebView<br/>[App.js]"]
end

subgraph group_web["Web application"]
  node_pages["Web pages"]
  node_server["Flask routes<br/>[app.py]"]
  node_auth["Account operations<br/>[app.py]"]
  node_chat["Plant chat<br/>[app.py]"]
  node_diagnosis_route["Image diagnosis route<br/>[app.py]"]
end

subgraph group_diagnosis["Diagnosis services"]
  node_gemini["Gemini Vision"]
  node_predict["Disease prediction<br/>[predict.py]"]
  node_image_processing["Image processing<br/>[image_processor.py]"]
  node_model_assets["Model assets"]
end

subgraph group_data["Persistence"]
  node_sqlite[("SQLite records<br/>[database.py]")]
end

node_farmer(("Plant-care user"))

node_farmer -->|"opens app"| node_mobile
node_mobile -->|"loads hosted site"| node_server
node_farmer -.->|"uses web app"| node_server
node_server -->|"routes account requests"| node_auth
node_server -->|"routes chat requests"| node_chat
node_server -->|"routes image requests"| node_diagnosis_route
node_diagnosis_route -->|"analyzes image"| node_gemini
node_auth -->|"reads and writes"| node_sqlite
node_diagnosis_route -->|"saves diagnosis"| node_sqlite
node_chat -->|"saves conversation"| node_sqlite
node_predict -->|"uses processing"| node_image_processing
node_predict -.->|"loads model"| node_model_assets
node_server -.->|"serves pages"| node_pages

click node_mobile "https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppMobile/App.js"
click node_pages "https://github.com/kadamyogiraj/crop-disease-detection-app-/tree/main/PlantAppFlask/templates"
click node_server "https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/app.py"
click node_auth "https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/app.py"
click node_chat "https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/app.py"
click node_diagnosis_route "https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/app.py"
click node_predict "https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/predict.py"
click node_image_processing "https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/image_processor.py"
click node_model_assets "https://github.com/kadamyogiraj/crop-disease-detection-app-/tree/main/PlantAppFlask/model"
click node_sqlite "https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/database.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_mobile,node_farmer toneBlue
class node_pages,node_server,node_auth,node_chat,node_diagnosis_route toneAmber
class node_gemini,node_predict,node_image_processing,node_model_assets toneMint
class node_sqlite toneRose
```

## Components

### Client apps

- [Mobile WebView](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppMobile/App.js): `PlantAppMobile/App.js`

### Web application

- [Web pages](https://github.com/kadamyogiraj/crop-disease-detection-app-/tree/main/PlantAppFlask/templates): `PlantAppFlask/templates`
- [Flask routes](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/app.py): `PlantAppFlask/app.py`
- [Account operations](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/app.py): `PlantAppFlask/app.py`
- [Plant chat](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/app.py): `PlantAppFlask/app.py`
- [Image diagnosis route](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/app.py): `PlantAppFlask/app.py`

### Diagnosis services

- **Gemini Vision**
- [Disease prediction](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/predict.py): `PlantAppFlask/predict.py`
- [Image processing](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/image_processor.py): `PlantAppFlask/image_processor.py`
- [Model assets](https://github.com/kadamyogiraj/crop-disease-detection-app-/tree/main/PlantAppFlask/model): `PlantAppFlask/model`

### Persistence

- [SQLite records](https://github.com/kadamyogiraj/crop-disease-detection-app-/blob/main/PlantAppFlask/database.py): `PlantAppFlask/database.py`

### Other components

- **Plant-care user**

## Connections

- Plant-care user → Mobile WebView: opens app (evidence: `PlantAppMobile/App.js`)
- Mobile WebView → Flask routes: loads hosted site (evidence: `PlantAppMobile/App.js`)
- Plant-care user → Flask routes: uses web app
- Flask routes → Account operations: routes account requests (evidence: `PlantAppFlask/app.py`)
- Flask routes → Plant chat: routes chat requests (evidence: `PlantAppFlask/app.py`)
- Flask routes → Image diagnosis route: routes image requests (evidence: `PlantAppFlask/app.py`)
- Image diagnosis route → Gemini Vision: analyzes image (evidence: `PlantAppFlask/app.py`)
- Account operations → SQLite records: reads and writes (evidence: `PlantAppFlask/app.py`)
- Image diagnosis route → SQLite records: saves diagnosis (evidence: `PlantAppFlask/app.py`)
- Plant chat → SQLite records: saves conversation (evidence: `PlantAppFlask/app.py`)
- Disease prediction → Image processing: uses processing (evidence: `PlantAppFlask/predict.py`)
- Disease prediction → Model assets: loads model
- Flask routes → Web pages: serves pages
