# rajath-r-prasad/agrinex architecture

> Architecture diagram of the GitHub repository rajath-r-prasad/agrinex, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rajath-r-prasad/agrinex
- Repository: https://github.com/rajath-r-prasad/agrinex

## Overview

AgriNex is a precision-farming web application for localized weather, crop and soil guidance, and irrigation decisions. Farmers enter through the routed frontend, authenticate or provide farm/location context, then use dashboard views for weather and agricultural recommendations. The backend exposes API routes and services; the sampled code confirms weather-based irrigation and crop-prediction paths. The README also describes zonal forecasts, soil NPK estimates, alerts, and ROI-oriented features. Several page implementations and route wiring were not sampled, so their internal data connections are left unspecified.

Main entry points: [`Agrinex-main/frontend/src/App.tsx`](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/App.tsx) (App shell), [`Agrinex-main/frontend/src/lib/api.ts`](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/lib/api.ts) (API client), [`Agrinex-main/frontend/src/contexts/AuthContext.tsx`](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/contexts/AuthContext.tsx) (User context), [`Agrinex-main/backend/app/services/weather_service.py`](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/services/weather_service.py) (Weather and zones)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Farmer interface"]
  node_app["App shell<br/>[App.tsx]"]
  node_authpage["Sign-in<br/>[Auth.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_weatherpage["Weather view<br/>[Weather.tsx]"]
  node_soilpage["Soil view<br/>[Soil.tsx]"]
  node_financial["Financial view<br/>[Financial.tsx]"]
  node_network["Network view<br/>[Network.tsx]"]
  node_profile["Profile view<br/>[Profile.tsx]"]
end

subgraph group_identity["Identity and farms"]
  node_authcontext["User context<br/>[AuthContext.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
  node_authroutes["Profile API<br/>[auth_routes.py]"]
  node_farms["Farm API<br/>[farm_routes.py]"]
end

subgraph group_insights["Farm intelligence"]
  node_api_main["Intelligence API<br/>[main.py]"]
  node_crop_routes["Crop endpoint<br/>[crop_routes.py]"]
  node_crop_service["Crop predictions<br/>[crop_service.py]"]
  node_irrigation_routes["Irrigation endpoint"]
  node_irrigation_service["Irrigation guidance"]
  node_weather_service["Weather and zones<br/>[weather_service.py]"]
end

subgraph group_integrations["External services"]
  node_weather_provider(("Weather providers"))
  node_supabase[("Supabase")]
end

node_farmer(("Farmer"))

node_farmer -->|"opens"| node_app
node_app -->|"routes"| node_authpage
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_weatherpage
node_app -->|"routes"| node_soilpage
node_app -->|"routes"| node_financial
node_app -->|"routes"| node_network
node_app -->|"routes"| node_profile
node_app -->|"provides context"| node_authcontext
node_authpage -->|"signs in"| node_authcontext
node_authpage -->|"authenticates"| node_supabase_client
node_authcontext -->|"uses"| node_supabase_client
node_authcontext -->|"syncs profile"| node_api_client
node_api_client -->|"sends profile"| node_authroutes
node_weatherpage -->|"requests data"| node_api_client
node_dashboard -->|"requests data"| node_api_client
node_soilpage -->|"requests data"| node_api_client
node_api_main -->|"gets weather"| node_weather_service
node_api_main -->|"requests guidance"| node_irrigation_service
node_crop_routes -->|"predicts crop"| node_crop_service
node_crop_service -->|"gets conditions"| node_weather_service
node_irrigation_service -->|"gets conditions"| node_weather_service
node_weather_service -->|"fetches forecasts"| node_weather_provider
node_farms -->|"serves farm data"| node_farmer
node_supabase_client -.->|"authenticates"| node_supabase

click node_app "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/App.tsx"
click node_authpage "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Auth.tsx"
click node_dashboard "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Dashboard.tsx"
click node_weatherpage "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Weather.tsx"
click node_soilpage "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Soil.tsx"
click node_financial "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Financial.tsx"
click node_network "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Network.tsx"
click node_profile "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Profile.tsx"
click node_authcontext "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/contexts/AuthContext.tsx"
click node_api_client "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/lib/api.ts"
click node_supabase_client "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/lib/supabase.ts"
click node_authroutes "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/api/auth_routes.py"
click node_farms "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/api/farm_routes.py"
click node_api_main "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/main.py"
click node_crop_routes "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/api/crop_routes.py"
click node_crop_service "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/services/crop_service.py"
click node_irrigation_routes "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/api/irrigation_routes.py"
click node_irrigation_service "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/services/irrigation_service.py"
click node_weather_service "https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/services/weather_service.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_app,node_authpage,node_dashboard,node_weatherpage,node_soilpage,node_financial,node_network,node_profile toneBlue
class node_authcontext,node_api_client,node_supabase_client,node_authroutes,node_farms toneAmber
class node_api_main,node_crop_routes,node_crop_service,node_irrigation_routes,node_irrigation_service,node_weather_service toneMint
class node_weather_provider,node_supabase toneRose
class node_farmer toneIndigo
```

## Components

### Farmer interface

- [App shell](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/App.tsx): `Agrinex-main/frontend/src/App.tsx`
- [Sign-in](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Auth.tsx): `Agrinex-main/frontend/src/pages/Auth.tsx`
- [Dashboard](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Dashboard.tsx): `Agrinex-main/frontend/src/pages/Dashboard.tsx`
- [Weather view](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Weather.tsx): `Agrinex-main/frontend/src/pages/Weather.tsx`
- [Soil view](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Soil.tsx): `Agrinex-main/frontend/src/pages/Soil.tsx`
- [Financial view](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Financial.tsx): `Agrinex-main/frontend/src/pages/Financial.tsx`
- [Network view](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Network.tsx): `Agrinex-main/frontend/src/pages/Network.tsx`
- [Profile view](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/pages/Profile.tsx): `Agrinex-main/frontend/src/pages/Profile.tsx`

### Identity and farms

- [User context](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/contexts/AuthContext.tsx): `Agrinex-main/frontend/src/contexts/AuthContext.tsx`
- [API client](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/lib/api.ts): `Agrinex-main/frontend/src/lib/api.ts`
- [Supabase client](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/frontend/src/lib/supabase.ts): `Agrinex-main/frontend/src/lib/supabase.ts`
- [Profile API](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/api/auth_routes.py): `Agrinex-main/backend/app/api/auth_routes.py`
- [Farm API](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/api/farm_routes.py): `Agrinex-main/backend/app/api/farm_routes.py`

### Farm intelligence

- [Intelligence API](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/main.py): `Agrinex-main/backend/app/main.py`
- [Crop endpoint](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/api/crop_routes.py): `Agrinex-main/backend/app/api/crop_routes.py`
- [Crop predictions](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/services/crop_service.py): `Agrinex-main/backend/app/services/crop_service.py`
- [Irrigation endpoint](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/api/irrigation_routes.py): `Agrinex-main/backend/app/api/irrigation_routes.py`
- [Irrigation guidance](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/services/irrigation_service.py): `Agrinex-main/backend/app/services/irrigation_service.py`
- [Weather and zones](https://github.com/rajath-r-prasad/agrinex/blob/main/Agrinex-main/backend/app/services/weather_service.py): `Agrinex-main/backend/app/services/weather_service.py`

### External services

- **Weather providers**
- **Supabase**

### Other components

- **Farmer**

## Connections

- Farmer → App shell: opens
- App shell → Sign-in: routes
- App shell → Dashboard: routes
- App shell → Weather view: routes
- App shell → Soil view: routes
- App shell → Financial view: routes
- App shell → Network view: routes
- App shell → Profile view: routes
- App shell → User context: provides context
- Sign-in → User context: signs in
- Sign-in → Supabase client: authenticates
- User context → Supabase client: uses
- User context → API client: syncs profile
- API client → Profile API: sends profile
- Weather view → API client: requests data
- Dashboard → API client: requests data
- Soil view → API client: requests data
- Intelligence API → Weather and zones: gets weather
- Intelligence API → Irrigation guidance: requests guidance
- Crop endpoint → Crop predictions: predicts crop
- Crop predictions → Weather and zones: gets conditions
- Irrigation guidance → Weather and zones: gets conditions
- Weather and zones → Weather providers: fetches forecasts
- Farm API → Farmer: serves farm data
- Supabase client → Supabase: authenticates
