# sumanth015/agrigenie-your-smart-farming-partner architecture

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

- Interactive diagram: https://gitdiagram.com/sumanth015/agrigenie-your-smart-farming-partner
- Repository: https://github.com/sumanth015/agrigenie-your-smart-farming-partner

## Overview

AgriGenie is a farmer-facing agricultural advisory app. A farmer enters through the landing page, registers or logs in, then uses a dashboard for farm records, soil and crop advice, weather, market, sustainability, and crop-history information. Authentication and profile data use Supabase; crop suggestions have a sampled invocation of a Supabase Edge Function. Disease detection and soil scanning are also product capabilities, but their client-to-function wiring is not shown in the excerpts. The README is empty, so these limits are reflected in the graph.

Main entry points: [`src/components/Dashboard.tsx`](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/Dashboard.tsx) (Farmer dashboard), [`src/integrations/supabase/client.ts`](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/integrations/supabase/client.ts) (Supabase client), [`src/pages/Index.tsx`](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/pages/Index.tsx) (View controller), [`src/components/dashboard/FarmDataInput.tsx`](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/FarmDataInput.tsx) (Farm data input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and access"]
  node_app["App shell<br/>[App.tsx]"]
  node_index["View controller<br/>[Index.tsx]"]
  node_landing["Landing page<br/>[LandingPage.tsx]"]
  node_registration["Registration page"]
  node_authpage["Login and signup<br/>[AuthPage.tsx]"]
  node_authstate["Auth state<br/>[useAuth.tsx]"]
end

subgraph group_farm["Farm advisory"]
  node_dashboard["Farmer dashboard<br/>[Dashboard.tsx]"]
  node_farminput["Farm data input<br/>[FarmDataInput.tsx]"]
  node_locationadvisor["Location crop advisor"]
  node_croprecommendations["Crop recommendations"]
  node_soilsensor["Soil scanner<br/>[SoilScanner.tsx]"]
  node_disease["Disease detector"]
  node_chat["Chat assistant<br/>[ChatAssistant.tsx]"]
end

subgraph group_insights["Farm insights"]
  node_soilcard["Soil data card<br/>[SoilDataCard.tsx]"]
  node_weathercard["Weather card<br/>[WeatherCard.tsx]"]
  node_marketcard["Market insights"]
  node_historycard["Crop history"]
  node_sustainability["Sustainability card"]
  node_notifications["Notifications"]
end

subgraph group_backend["Data and services"]
  node_profile["Profile access<br/>[useProfile.tsx]"]
  node_location["Location lookup<br/>[useLocation.tsx]"]
  node_recommendhook["Recommendation data"]
  node_marketdata["Market data"]
  node_weatherdata["Weather data<br/>[useWeather.tsx]"]
  node_supabaseclient["Supabase client<br/>[client.ts]"]
  node_suggestfn["Crop suggestion function<br/>[index.ts]"]
  node_soilfn["Soil scan function<br/>[index.ts]"]
  node_diseasefn["Disease detection function<br/>[index.ts]"]
end

node_farmer(("Farmer"))
node_supabase[("Supabase")]
node_geolocation["Browser geolocation"]
node_nominatim["Nominatim"]

node_farmer -->|"starts at"| node_landing
node_app -->|"routes to"| node_index
node_index -->|"checks session"| node_authstate
node_index -->|"shows"| node_landing
node_index -->|"shows"| node_registration
node_index -->|"shows"| node_authpage
node_index -->|"shows"| node_dashboard
node_authpage -->|"authenticates with"| node_supabaseclient
node_authstate -->|"reads auth state"| node_supabaseclient
node_supabaseclient -.->|"connects to"| node_supabase
node_dashboard -->|"renders"| node_farminput
node_dashboard -->|"renders"| node_locationadvisor
node_dashboard -->|"renders"| node_croprecommendations
node_dashboard -->|"renders"| node_soilsensor
node_dashboard -->|"renders"| node_disease
node_dashboard -->|"renders"| node_chat
node_dashboard -->|"renders"| node_soilcard
node_dashboard -->|"renders"| node_weathercard
node_dashboard -->|"renders"| node_marketcard
node_dashboard -->|"renders"| node_historycard
node_dashboard -->|"renders"| node_sustainability
node_dashboard -->|"renders"| node_notifications
node_farminput -->|"uses user"| node_authstate
node_farminput -->|"loads profile"| node_profile
node_farminput -->|"uses location"| node_location
node_farminput -->|"reads and writes"| node_supabaseclient
node_farminput -->|"invokes"| node_suggestfn
node_locationadvisor -->|"uses"| node_recommendhook
node_locationadvisor -->|"renders"| node_croprecommendations
node_profile -->|"reads and updates"| node_supabaseclient
node_recommendhook -->|"queries"| node_supabaseclient
node_marketdata -->|"queries"| node_supabaseclient
node_weatherdata -.->|"fetches forecast"| node_supabase
node_location -->|"requests coordinates"| node_geolocation
node_location -->|"reverse geocodes"| node_nominatim
node_soilsensor -->|"uses client"| node_supabaseclient
node_soilsensor -.->|"may invoke"| node_soilfn
node_disease -.->|"may invoke"| node_diseasefn

click node_app "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/App.tsx"
click node_index "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/pages/Index.tsx"
click node_landing "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/LandingPage.tsx"
click node_registration "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/RegistrationPage.tsx"
click node_authpage "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/AuthPage.tsx"
click node_authstate "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useAuth.tsx"
click node_dashboard "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/Dashboard.tsx"
click node_farminput "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/FarmDataInput.tsx"
click node_locationadvisor "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/LocationCropAdvisor.tsx"
click node_croprecommendations "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/CropRecommendations.tsx"
click node_soilsensor "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/SoilScanner.tsx"
click node_disease "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/DiseaseDetector.tsx"
click node_chat "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/ChatAssistant.tsx"
click node_soilcard "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/SoilDataCard.tsx"
click node_weathercard "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/WeatherCard.tsx"
click node_marketcard "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/MarketInsightsCard.tsx"
click node_historycard "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/CropHistoryCard.tsx"
click node_sustainability "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/SustainabilityCard.tsx"
click node_notifications "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/NotificationsPanel.tsx"
click node_profile "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useProfile.tsx"
click node_location "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useLocation.tsx"
click node_recommendhook "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useCropRecommendations.tsx"
click node_marketdata "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useMarketPrices.tsx"
click node_weatherdata "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useWeather.tsx"
click node_supabaseclient "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/integrations/supabase/client.ts"
click node_suggestfn "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/supabase/functions/suggest-crops/index.ts"
click node_soilfn "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/supabase/functions/scan-soil/index.ts"
click node_diseasefn "https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/supabase/functions/detect-disease/index.ts"

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_index,node_landing,node_registration,node_authpage,node_authstate,node_geolocation toneBlue
class node_dashboard,node_farminput,node_locationadvisor,node_croprecommendations,node_soilsensor,node_disease,node_chat,node_supabase toneAmber
class node_soilcard,node_weathercard,node_marketcard,node_historycard,node_sustainability,node_notifications toneMint
class node_profile,node_location,node_recommendhook,node_marketdata,node_weatherdata,node_supabaseclient,node_suggestfn,node_soilfn,node_diseasefn toneRose
class node_farmer,node_nominatim toneIndigo
```

## Components

### App and access

- [App shell](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/App.tsx): `src/App.tsx`
- [View controller](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Landing page](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/LandingPage.tsx): `src/components/LandingPage.tsx`
- [Registration page](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/RegistrationPage.tsx): `src/components/RegistrationPage.tsx`
- [Login and signup](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/AuthPage.tsx): `src/components/AuthPage.tsx`
- [Auth state](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useAuth.tsx): `src/hooks/useAuth.tsx`

### Farm advisory

- [Farmer dashboard](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`
- [Farm data input](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/FarmDataInput.tsx): `src/components/dashboard/FarmDataInput.tsx`
- [Location crop advisor](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/LocationCropAdvisor.tsx): `src/components/dashboard/LocationCropAdvisor.tsx`
- [Crop recommendations](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/CropRecommendations.tsx): `src/components/dashboard/CropRecommendations.tsx`
- [Soil scanner](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/SoilScanner.tsx): `src/components/SoilScanner.tsx`
- [Disease detector](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/DiseaseDetector.tsx): `src/components/DiseaseDetector.tsx`
- [Chat assistant](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/ChatAssistant.tsx): `src/components/ChatAssistant.tsx`

### Farm insights

- [Soil data card](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/SoilDataCard.tsx): `src/components/dashboard/SoilDataCard.tsx`
- [Weather card](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/WeatherCard.tsx): `src/components/dashboard/WeatherCard.tsx`
- [Market insights](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/MarketInsightsCard.tsx): `src/components/dashboard/MarketInsightsCard.tsx`
- [Crop history](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/CropHistoryCard.tsx): `src/components/dashboard/CropHistoryCard.tsx`
- [Sustainability card](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/dashboard/SustainabilityCard.tsx): `src/components/dashboard/SustainabilityCard.tsx`
- [Notifications](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/components/NotificationsPanel.tsx): `src/components/NotificationsPanel.tsx`

### Data and services

- [Profile access](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useProfile.tsx): `src/hooks/useProfile.tsx`
- [Location lookup](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useLocation.tsx): `src/hooks/useLocation.tsx`
- [Recommendation data](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useCropRecommendations.tsx): `src/hooks/useCropRecommendations.tsx`
- [Market data](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useMarketPrices.tsx): `src/hooks/useMarketPrices.tsx`
- [Weather data](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/hooks/useWeather.tsx): `src/hooks/useWeather.tsx`
- [Supabase client](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Crop suggestion function](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/supabase/functions/suggest-crops/index.ts): `supabase/functions/suggest-crops/index.ts`
- [Soil scan function](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/supabase/functions/scan-soil/index.ts): `supabase/functions/scan-soil/index.ts`
- [Disease detection function](https://github.com/sumanth015/agrigenie-your-smart-farming-partner/blob/main/supabase/functions/detect-disease/index.ts): `supabase/functions/detect-disease/index.ts`

### Other components

- **Farmer**
- **Supabase**
- **Browser geolocation**
- **Nominatim**

## Connections

- Farmer → Landing page: starts at
- App shell → View controller: routes to (evidence: `src/App.tsx`)
- View controller → Auth state: checks session (evidence: `src/pages/Index.tsx`)
- View controller → Landing page: shows (evidence: `src/pages/Index.tsx`)
- View controller → Registration page: shows (evidence: `src/pages/Index.tsx`)
- View controller → Login and signup: shows (evidence: `src/pages/Index.tsx`)
- View controller → Farmer dashboard: shows (evidence: `src/pages/Index.tsx`)
- Login and signup → Supabase client: authenticates with (evidence: `src/components/AuthPage.tsx`)
- Auth state → Supabase client: reads auth state (evidence: `src/hooks/useAuth.tsx`)
- Supabase client → Supabase: connects to
- Farmer dashboard → Farm data input: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Location crop advisor: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Crop recommendations: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Soil scanner: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Disease detector: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Chat assistant: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Soil data card: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Weather card: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Market insights: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Crop history: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Sustainability card: renders (evidence: `src/components/Dashboard.tsx`)
- Farmer dashboard → Notifications: renders (evidence: `src/components/Dashboard.tsx`)
- Farm data input → Auth state: uses user (evidence: `src/components/dashboard/FarmDataInput.tsx`)
- Farm data input → Profile access: loads profile (evidence: `src/components/dashboard/FarmDataInput.tsx`)
- Farm data input → Location lookup: uses location (evidence: `src/components/dashboard/FarmDataInput.tsx`)
- Farm data input → Supabase client: reads and writes (evidence: `src/components/dashboard/FarmDataInput.tsx`)
- Farm data input → Crop suggestion function: invokes (evidence: `src/components/dashboard/FarmDataInput.tsx`)
- Location crop advisor → Recommendation data: uses (evidence: `src/components/dashboard/LocationCropAdvisor.tsx`)
- Location crop advisor → Crop recommendations: renders (evidence: `src/components/dashboard/LocationCropAdvisor.tsx`)
- Profile access → Supabase client: reads and updates (evidence: `src/hooks/useProfile.tsx`)
- Recommendation data → Supabase client: queries (evidence: `src/hooks/useCropRecommendations.tsx`)
- Market data → Supabase client: queries (evidence: `src/hooks/useMarketPrices.tsx`)
- Weather data → Supabase: fetches forecast
- Location lookup → Browser geolocation: requests coordinates (evidence: `src/hooks/useLocation.tsx`)
- Location lookup → Nominatim: reverse geocodes (evidence: `src/hooks/useLocation.tsx`)
- Soil scanner → Supabase client: uses client (evidence: `src/components/SoilScanner.tsx`)
- Soil scanner → Soil scan function: may invoke
- Disease detector → Disease detection function: may invoke
