# sayantan-pachal/smartkrishi architecture

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

- Interactive diagram: https://gitdiagram.com/sayantan-pachal/smartkrishi
- Repository: https://github.com/sayantan-pachal/smartkrishi

## Overview

SmartKrishi is a farm and crop management web application. A farmer enters through the routed React app, signs in or creates an account, then uses protected farm-management pages; field and crop records are managed alongside dashboard and weather advisories. The README also describes image-based disease detection, while the Vision page excerpt presents that capability as forthcoming. The backend configuration excerpt sends requests to a Google Apps Script endpoint; the README identifies Google Sheets as its database. Some page implementations were not sampled, so their internal interactions are not expanded.

Main entry points: [`src/main.jsx`](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/main.jsx) (Route Application), [`src/component/FieldsTemp/Fields.jsx`](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/FieldsTemp/Fields.jsx) (Field Management), [`src/hooks/useWeather.js`](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/hooks/useWeather.js) (Weather Retrieval), [`src/appwrite/config.js`](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/appwrite/config.js) (Backend Adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_router["Route Application<br/>[main.jsx]"]
  node_layout["Page Layout<br/>[Layout.jsx]"]
end

subgraph group_farm["Farm Management"]
  node_dashboard["Farm Dashboard<br/>[Dashboard.jsx]"]
  node_fields["Field Management<br/>[Fields.jsx]"]
  node_field_forms["Field Forms<br/>[FormFieldModal.jsx]"]
  node_field_cards["Field Cards<br/>[FieldCard.jsx]"]
  node_field_data["Field Definitions<br/>[FieldsData.js]"]
  node_crops["Crop Management<br/>[Crops.jsx]"]
end

subgraph group_insights["Insights"]
  node_advisory["Weather Advisory<br/>[Advisory.jsx]"]
  node_weather_hook["Weather Retrieval<br/>[useWeather.js]"]
  node_weather_rules["Farming Advice Rules<br/>[weatherUtils.js]"]
  node_vision["Disease Detection<br/>[vision.jsx]"]
end

subgraph group_identity["Identity"]
  node_signup["Account Signup<br/>[Signup.jsx]"]
  node_login["Account Login<br/>[Login.jsx]"]
  node_guard["Session Guard<br/>[ProtectedRoute.jsx]"]
  node_profile["User Profile<br/>[Profile.jsx]"]
  node_settings["Account Settings<br/>[Settings.jsx]"]
end

subgraph group_services["Services"]
  node_backend["Backend Adapter<br/>[config.js]"]
  node_sheets[("Google Sheets")]
  node_weather_api["OpenWeather API"]
  node_geolocation["Browser Geolocation"]
end

node_farmer(("Farmer"))

node_farmer -.->|"uses"| node_router
node_router -->|"routes to"| node_signup
node_router -->|"routes to"| node_login
node_router -->|"protects pages"| node_guard
node_router -->|"wraps pages"| node_layout
node_router -->|"routes to"| node_dashboard
node_router -->|"routes to"| node_fields
node_router -->|"routes to"| node_crops
node_router -->|"routes to"| node_advisory
node_router -->|"routes to"| node_vision
node_router -->|"routes to"| node_profile
node_router -->|"routes to"| node_settings
node_guard -->|"checks session"| node_backend
node_signup -->|"creates account"| node_backend
node_profile -->|"uses account"| node_backend
node_fields -->|"reads and writes"| node_backend
node_fields -->|"uses definitions"| node_field_data
node_fields -->|"renders"| node_field_cards
node_fields -->|"uses forms"| node_field_forms
node_dashboard -->|"loads weather"| node_weather_hook
node_advisory -.->|"uses weather"| node_weather_hook
node_weather_hook -->|"gets advice"| node_weather_rules
node_weather_hook -->|"requests location"| node_geolocation
node_weather_hook -->|"fetches forecasts"| node_weather_api
node_backend -->|"sends requests"| node_sheets
node_vision -.->|"offers future detection"| node_farmer

click node_router "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/main.jsx"
click node_layout "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/Layout.jsx"
click node_dashboard "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/DashTemp/Dashboard.jsx"
click node_fields "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/FieldsTemp/Fields.jsx"
click node_field_forms "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/FieldsTemp/FormFieldModal.jsx"
click node_field_cards "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/FieldsTemp/FieldCard.jsx"
click node_field_data "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/data/FieldsData.js"
click node_crops "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Crops/Crops.jsx"
click node_advisory "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Advisory/Advisory.jsx"
click node_weather_hook "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/hooks/useWeather.js"
click node_weather_rules "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/data/weatherUtils.js"
click node_vision "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Vision/vision.jsx"
click node_signup "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Auth/Signup.jsx"
click node_login "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Auth/Login.jsx"
click node_guard "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/ProtectedRoute.jsx"
click node_profile "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Profile/Profile.jsx"
click node_settings "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Settings/Settings.jsx"
click node_backend "https://github.com/sayantan-pachal/smartkrishi/blob/main/src/appwrite/config.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_router,node_layout toneBlue
class node_dashboard,node_fields,node_field_forms,node_field_cards,node_field_data,node_crops toneAmber
class node_advisory,node_weather_hook,node_weather_rules,node_vision toneMint
class node_signup,node_login,node_guard,node_profile,node_settings toneRose
class node_backend,node_sheets,node_weather_api,node_geolocation,node_farmer toneIndigo
```

## Components

### Application

- [Route Application](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/main.jsx): `src/main.jsx`
- [Page Layout](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/Layout.jsx): `src/Layout.jsx`

### Farm Management

- [Farm Dashboard](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/DashTemp/Dashboard.jsx): `src/component/DashTemp/Dashboard.jsx`
- [Field Management](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/FieldsTemp/Fields.jsx): `src/component/FieldsTemp/Fields.jsx`
- [Field Forms](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/FieldsTemp/FormFieldModal.jsx): `src/component/FieldsTemp/FormFieldModal.jsx`
- [Field Cards](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/FieldsTemp/FieldCard.jsx): `src/component/FieldsTemp/FieldCard.jsx`
- [Field Definitions](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/data/FieldsData.js): `src/data/FieldsData.js`
- [Crop Management](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Crops/Crops.jsx): `src/component/Crops/Crops.jsx`

### Insights

- [Weather Advisory](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Advisory/Advisory.jsx): `src/component/Advisory/Advisory.jsx`
- [Weather Retrieval](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/hooks/useWeather.js): `src/hooks/useWeather.js`
- [Farming Advice Rules](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/data/weatherUtils.js): `src/data/weatherUtils.js`
- [Disease Detection](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Vision/vision.jsx): `src/component/Vision/vision.jsx`

### Identity

- [Account Signup](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Auth/Signup.jsx): `src/component/Auth/Signup.jsx`
- [Account Login](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Auth/Login.jsx): `src/component/Auth/Login.jsx`
- [Session Guard](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/ProtectedRoute.jsx): `src/ProtectedRoute.jsx`
- [User Profile](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Profile/Profile.jsx): `src/component/Profile/Profile.jsx`
- [Account Settings](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/component/Settings/Settings.jsx): `src/component/Settings/Settings.jsx`

### Services

- [Backend Adapter](https://github.com/sayantan-pachal/smartkrishi/blob/main/src/appwrite/config.js): `src/appwrite/config.js`
- **Google Sheets**
- **OpenWeather API**
- **Browser Geolocation**

### Other components

- **Farmer**

## Connections

- Farmer → Route Application: uses
- Route Application → Account Signup: routes to (evidence: `src/main.jsx`)
- Route Application → Account Login: routes to (evidence: `src/main.jsx`)
- Route Application → Session Guard: protects pages (evidence: `src/main.jsx`)
- Route Application → Page Layout: wraps pages (evidence: `src/main.jsx`)
- Route Application → Farm Dashboard: routes to (evidence: `src/main.jsx`)
- Route Application → Field Management: routes to (evidence: `src/main.jsx`)
- Route Application → Crop Management: routes to (evidence: `src/main.jsx`)
- Route Application → Weather Advisory: routes to (evidence: `src/main.jsx`)
- Route Application → Disease Detection: routes to (evidence: `src/main.jsx`)
- Route Application → User Profile: routes to (evidence: `src/main.jsx`)
- Route Application → Account Settings: routes to (evidence: `src/main.jsx`)
- Session Guard → Backend Adapter: checks session (evidence: `src/ProtectedRoute.jsx`)
- Account Signup → Backend Adapter: creates account (evidence: `src/component/Auth/Signup.jsx`)
- User Profile → Backend Adapter: uses account (evidence: `src/component/Profile/Profile.jsx`)
- Field Management → Backend Adapter: reads and writes (evidence: `src/component/FieldsTemp/Fields.jsx`)
- Field Management → Field Definitions: uses definitions (evidence: `src/component/FieldsTemp/Fields.jsx`)
- Field Management → Field Cards: renders (evidence: `src/component/FieldsTemp/Fields.jsx`)
- Field Management → Field Forms: uses forms (evidence: `src/component/FieldsTemp/Fields.jsx`)
- Farm Dashboard → Weather Retrieval: loads weather
- Weather Advisory → Weather Retrieval: uses weather
- Weather Retrieval → Farming Advice Rules: gets advice (evidence: `src/hooks/useWeather.js`)
- Weather Retrieval → Browser Geolocation: requests location (evidence: `src/hooks/useWeather.js`)
- Weather Retrieval → OpenWeather API: fetches forecasts (evidence: `src/hooks/useWeather.js`)
- Backend Adapter → Google Sheets: sends requests (evidence: `src/appwrite/config.js`)
- Disease Detection → Farmer: offers future detection
