# gopi45-gk/uzhavan-ai-1 architecture

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

- Interactive diagram: https://gitdiagram.com/gopi45-gk/uzhavan-ai-1
- Repository: https://github.com/gopi45-gk/uzhavan-ai-1

## Overview

Uzhavan AI is a multilingual agricultural assistant for farmers, combining a web app, personalized agricultural guidance, market/weather/news information, disease diagnosis, and voice interaction. The main user journey runs from the app shell and dashboard into a chosen advisory feature; chat and the call bot add AI-generated responses and speech. The README documents broader call-bot routing and model fallbacks, but the sampled source does not verify all of those runtime links. The graph therefore preserves those capabilities while limiting source-level edges to shown references and calls.

Main entry points: [`services/api.ts`](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/api.ts) (Backend API client), [`services/geminiService.ts`](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/geminiService.ts) (AI response service), [`screens/PhoneCall.tsx`](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/PhoneCall.tsx) (Voice call bot), [`App.tsx`](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/App.tsx) (App navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and identity"]
  node_app_shell["App navigation<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_auth_ui["Sign-in and registration<br/>[Login.tsx]"]
end

subgraph group_advisory["Farmer advisories"]
  node_data_context["Dashboard data context<br/>[DataContext.tsx]"]
  node_weather_ui["Weather advisories<br/>[Weather.tsx]"]
  node_market_ui["Market prices"]
  node_news_ui["Agriculture news"]
  node_crop_ui["Crop recommendations"]
  node_disease_ui["Disease diagnosis"]
end

subgraph group_intelligence["AI and voice"]
  node_chat_ui["Agriculture chat<br/>[Chat.tsx]"]
  node_call_ui["Voice call bot<br/>[PhoneCall.tsx]"]
  node_ai_service["AI response service<br/>[geminiService.ts]"]
  node_offline_ai["Offline agricultural intelligence"]
  node_speech["Speech synthesis<br/>[ttsService.ts]"]
  node_farmer_context["Live farmer context"]
end

subgraph group_backend["Backend data services"]
  node_api_client["Backend API client<br/>[api.ts]"]
  node_backend_api["Agricultural API<br/>[main.py]"]
end

subgraph group_persistence["Profiles and state"]
  node_auth_service["Authentication service<br/>[firebaseAuth.ts]"]
  node_firebase[("Firebase Auth and Firestore<br/>[firebase.ts]")]
  node_profile_store[("Farmer profiles")]
end

node_farmer(("Farmer"))
node_weather_provider["Open-Meteo"]

node_farmer -->|"uses"| node_app_shell
node_app_shell -->|"routes to"| node_dashboard
node_app_shell -->|"routes to"| node_auth_ui
node_auth_ui -->|"authenticates through"| node_auth_service
node_auth_service -->|"uses"| node_firebase
node_auth_service -->|"loads profile"| node_profile_store
node_dashboard -->|"reads dashboard data"| node_data_context
node_data_context -->|"fetches dashboard"| node_api_client
node_api_client -->|"requests data"| node_backend_api
node_weather_ui -->|"reads weather"| node_data_context
node_market_ui -->|"requests prices"| node_api_client
node_news_ui -->|"requests news"| node_api_client
node_crop_ui -->|"requests recommendations"| node_api_client
node_disease_ui -->|"requests diagnosis"| node_ai_service
node_disease_ui -->|"loads crop profile"| node_profile_store
node_chat_ui -->|"requests answers"| node_ai_service
node_chat_ui -->|"speaks replies"| node_speech
node_call_ui -->|"speaks replies"| node_speech
node_call_ui -->|"loads farmer profile"| node_profile_store
node_ai_service -->|"loads live context"| node_farmer_context
node_farmer_context -->|"fetches live data"| node_api_client
node_ai_service -->|"uses offline fallback"| node_offline_ai
node_backend_api -->|"fetches forecasts"| node_weather_provider
node_call_ui -.->|"routes agricultural queries"| node_backend_api

click node_app_shell "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/App.tsx"
click node_dashboard "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/Dashboard.tsx"
click node_auth_ui "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/Login.tsx"
click node_auth_service "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/firebaseAuth.ts"
click node_firebase "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/firebase.ts"
click node_profile_store "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/firestoreProfile.ts"
click node_data_context "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/context/DataContext.tsx"
click node_weather_ui "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/Weather.tsx"
click node_market_ui "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/DailyPricePredictions.tsx"
click node_news_ui "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/AgricultureNews.tsx"
click node_crop_ui "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/CropRecommendation.tsx"
click node_disease_ui "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/DiseasePrediction.tsx"
click node_chat_ui "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/Chat.tsx"
click node_call_ui "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/PhoneCall.tsx"
click node_ai_service "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/geminiService.ts"
click node_offline_ai "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/offlineIntelligenceService.ts"
click node_speech "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/ttsService.ts"
click node_farmer_context "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/farmerContextService.ts"
click node_api_client "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/api.ts"
click node_backend_api "https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/backend/main.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_shell,node_dashboard,node_auth_ui toneBlue
class node_data_context,node_weather_ui,node_market_ui,node_news_ui,node_crop_ui,node_disease_ui toneAmber
class node_chat_ui,node_call_ui,node_ai_service,node_offline_ai,node_speech,node_farmer_context toneMint
class node_api_client,node_backend_api toneRose
class node_auth_service,node_firebase,node_profile_store,node_farmer,node_weather_provider toneIndigo
```

## Components

### App and identity

- [App navigation](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/App.tsx): `App.tsx`
- [Dashboard](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/Dashboard.tsx): `screens/Dashboard.tsx`
- [Sign-in and registration](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/Login.tsx): `screens/Login.tsx`

### Farmer advisories

- [Dashboard data context](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/context/DataContext.tsx): `context/DataContext.tsx`
- [Weather advisories](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/Weather.tsx): `screens/Weather.tsx`
- [Market prices](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/DailyPricePredictions.tsx): `screens/DailyPricePredictions.tsx`
- [Agriculture news](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/AgricultureNews.tsx): `screens/AgricultureNews.tsx`
- [Crop recommendations](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/CropRecommendation.tsx): `screens/CropRecommendation.tsx`
- [Disease diagnosis](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/DiseasePrediction.tsx): `screens/DiseasePrediction.tsx`

### AI and voice

- [Agriculture chat](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/Chat.tsx): `screens/Chat.tsx`
- [Voice call bot](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/screens/PhoneCall.tsx): `screens/PhoneCall.tsx`
- [AI response service](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/geminiService.ts): `services/geminiService.ts`
- [Offline agricultural intelligence](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/offlineIntelligenceService.ts): `services/offlineIntelligenceService.ts`
- [Speech synthesis](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/ttsService.ts): `services/ttsService.ts`
- [Live farmer context](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/farmerContextService.ts): `services/farmerContextService.ts`

### Backend data services

- [Backend API client](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/api.ts): `services/api.ts`
- [Agricultural API](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/backend/main.py): `backend/main.py`

### Profiles and state

- [Authentication service](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/firebaseAuth.ts): `services/firebaseAuth.ts`
- [Firebase Auth and Firestore](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/firebase.ts): `services/firebase.ts`
- [Farmer profiles](https://github.com/gopi45-gk/uzhavan-ai-1/blob/main/services/firestoreProfile.ts): `services/firestoreProfile.ts`

### Other components

- **Farmer**
- **Open-Meteo**

## Connections

- Farmer → App navigation: uses
- App navigation → Dashboard: routes to (evidence: `App.tsx`)
- App navigation → Sign-in and registration: routes to (evidence: `App.tsx`)
- Sign-in and registration → Authentication service: authenticates through (evidence: `services/firebaseAuth.ts`)
- Authentication service → Firebase Auth and Firestore: uses (evidence: `services/firebaseAuth.ts`)
- Authentication service → Farmer profiles: loads profile (evidence: `services/firebaseAuth.ts`)
- Dashboard → Dashboard data context: reads dashboard data
- Dashboard data context → Backend API client: fetches dashboard (evidence: `context/DataContext.tsx`)
- Backend API client → Agricultural API: requests data (evidence: `services/api.ts`)
- Weather advisories → Dashboard data context: reads weather (evidence: `screens/Weather.tsx`)
- Market prices → Backend API client: requests prices (evidence: `services/api.ts`)
- Agriculture news → Backend API client: requests news (evidence: `screens/AgricultureNews.tsx`)
- Crop recommendations → Backend API client: requests recommendations (evidence: `services/api.ts`)
- Disease diagnosis → AI response service: requests diagnosis (evidence: `screens/DiseasePrediction.tsx`)
- Disease diagnosis → Farmer profiles: loads crop profile (evidence: `screens/DiseasePrediction.tsx`)
- Agriculture chat → AI response service: requests answers (evidence: `screens/Chat.tsx`)
- Agriculture chat → Speech synthesis: speaks replies (evidence: `screens/Chat.tsx`)
- Voice call bot → Speech synthesis: speaks replies (evidence: `screens/PhoneCall.tsx`)
- Voice call bot → Farmer profiles: loads farmer profile (evidence: `screens/PhoneCall.tsx`)
- AI response service → Live farmer context: loads live context (evidence: `services/geminiService.ts`)
- Live farmer context → Backend API client: fetches live data (evidence: `services/farmerContextService.ts`)
- AI response service → Offline agricultural intelligence: uses offline fallback (evidence: `services/geminiService.ts`)
- Agricultural API → Open-Meteo: fetches forecasts (evidence: `backend/main.py`)
- Voice call bot → Agricultural API: routes agricultural queries
