# ragul-gunasekaran/agriarivuruthal architecture

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

- Interactive diagram: https://gitdiagram.com/ragul-gunasekaran/agriarivuruthal
- Repository: https://github.com/ragul-gunasekaran/agriarivuruthal

## Overview

This is a browser-based crop advisory application for small and marginal farmers. Farmers enter growing conditions and receive crop suggestions, with additional fertilizer, pest-and-disease, weather, chat, and crop-calendar capabilities. The main application is a large JavaScript module; IndexedDB persists chat, field profiles, and crop schedules, while a service worker caches the app shell for offline use. The README documents product features, but sampled application excerpts are partial, so several feature-to-feature interactions are not represented.

Main entry points: [`app.js`](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js) (Application), [`db.js`](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/db.js) (IndexedDB), [`service-worker.js`](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/service-worker.js) (Offline Cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_advisory["Farm Advisory"]
  node_app["Application<br/>[app.js]"]
  node_crop["Crop Recommendations<br/>[app.js]"]
  node_fertilizer["Fertilizer Guide<br/>[app.js]"]
  node_pests["Pest &amp; Disease Guide<br/>[app.js]"]
  node_weather["Weather Data<br/>[app.js]"]
  node_chat["AI Chat<br/>[app.js]"]
end

subgraph group_planning["Farm Planning"]
  node_calendar["Crop Calendar<br/>[app.js]"]
  node_profiles["Field Profiles<br/>[app.js]"]
end

subgraph group_platform["Browser Platform"]
  node_localdb[("IndexedDB<br/>[db.js]")]
  node_offline["Offline Cache<br/>[service-worker.js]"]
end

subgraph group_presentation["Presentation"]
  node_icons["SVG Icons<br/>[icons.js]"]
end

node_farmer(("Farmer"))
node_weather_api{{"Open-Meteo"}}
node_gemini{{"Gemini API"}}

node_farmer -->|"uses"| node_app
node_app -->|"presents"| node_crop
node_app -->|"presents"| node_fertilizer
node_app -->|"presents"| node_pests
node_app -->|"fetches"| node_weather
node_weather -->|"requests forecast"| node_weather_api
node_app -->|"supports"| node_chat
node_chat -->|"sends requests"| node_gemini
node_app -->|"initializes"| node_localdb
node_app -->|"loads schedules"| node_calendar
node_calendar -->|"reads cycles and tasks"| node_localdb
node_app -->|"loads profiles"| node_profiles
node_app -->|"loads chat logs"| node_localdb
node_offline -->|"caches shell"| node_app

click node_app "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js"
click node_crop "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js"
click node_fertilizer "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js"
click node_pests "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js"
click node_weather "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js"
click node_chat "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js"
click node_calendar "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js"
click node_profiles "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js"
click node_localdb "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/db.js"
click node_offline "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/service-worker.js"
click node_icons "https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/icons.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_app,node_crop,node_fertilizer,node_pests,node_weather,node_chat toneBlue
class node_calendar,node_profiles toneAmber
class node_localdb,node_offline,node_gemini toneMint
class node_icons toneRose
class node_farmer,node_weather_api toneIndigo
```

## Components

### Farm Advisory

- [Application](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js): `app.js`
- [Crop Recommendations](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js): `app.js`
- [Fertilizer Guide](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js): `app.js`
- [Pest & Disease Guide](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js): `app.js`
- [Weather Data](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js): `app.js`
- [AI Chat](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js): `app.js`

### Farm Planning

- [Crop Calendar](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js): `app.js`
- [Field Profiles](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/app.js): `app.js`

### Browser Platform

- [IndexedDB](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/db.js): `db.js`
- [Offline Cache](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/service-worker.js): `service-worker.js`

### Presentation

- [SVG Icons](https://github.com/ragul-gunasekaran/agriarivuruthal/blob/main/icons.js): `icons.js`

### Other components

- **Farmer**
- **Open-Meteo**
- **Gemini API**

## Connections

- Farmer → Application: uses (evidence: `README.md`)
- Application → Crop Recommendations: presents (evidence: `README.md`)
- Application → Fertilizer Guide: presents (evidence: `README.md`)
- Application → Pest & Disease Guide: presents (evidence: `app.js`)
- Application → Weather Data: fetches (evidence: `app.js`)
- Weather Data → Open-Meteo: requests forecast (evidence: `app.js`)
- Application → AI Chat: supports (evidence: `app.js`)
- AI Chat → Gemini API: sends requests (evidence: `app.js`)
- Application → IndexedDB: initializes (evidence: `app.js`)
- Application → Crop Calendar: loads schedules (evidence: `app.js`)
- Crop Calendar → IndexedDB: reads cycles and tasks (evidence: `app.js`)
- Application → Field Profiles: loads profiles (evidence: `app.js`)
- Application → IndexedDB: loads chat logs (evidence: `app.js`)
- Offline Cache → Application: caches shell (evidence: `service-worker.js`)
