# manishkudtarkar/eco-stat architecture

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

- Interactive diagram: https://gitdiagram.com/manishkudtarkar/eco-stat
- Repository: https://github.com/manishkudtarkar/eco-stat

## Overview

EcoPredict takes users from sign-in and region/species selection to biodiversity risk predictions, then supports monitoring through analytics, hotspots, maps, and search; a separate document-grounded chatbot answers PDF questions. The graph preserves the documented prediction, analytics, auth, and chatbot stages and principal UI surfaces. Some backend relationships are evidenced only by README or SOURCE INDEX references; uncertain links are omitted rather than inferred.

Main entry points: [`frontend/src/App.tsx`](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/App.tsx) (Web app routes), [`frontend/src/services/api.ts`](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/services/api.ts) (HTTP API client), [`backend/main.py`](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/main.py) (FastAPI application), [`backend/routes/predictions.py`](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/routes/predictions.py) (Prediction routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User application"]
  node_app["Web app routes<br/>[App.tsx]"]
  node_authui["Auth context<br/>[AuthContext.tsx]"]
  node_authclient["Auth client<br/>[auth.ts]"]
  node_dashboardui["Dashboard<br/>[DashboardPage.tsx]"]
  node_dashboardclient["Dashboard client<br/>[dashboard.ts]"]
  node_searchui["Search page<br/>[SearchPage.tsx]"]
  node_searchclient["Search client<br/>[search.ts]"]
  node_mapui["Risk map<br/>[RiskMapPage.tsx]"]
  node_analyticsui["Analytics page<br/>[AnalyticsPage.tsx]"]
  node_chatui["Chatbot UI<br/>[ChatbotPage.tsx]"]
  node_api_client["HTTP API client<br/>[api.ts]"]
end

subgraph group_api["API and identity"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_authroutes["Auth routes<br/>[auth.py]"]
  node_authservice["Auth service<br/>[auth_service.py]"]
  node_jwt["JWT validation<br/>[auth.py]"]
  node_database[("MongoDB manager<br/>[database.py]")]
end

subgraph group_risk["Risk intelligence"]
  node_predroutes["Prediction routes<br/>[predictions.py]"]
  node_pipeline["Data pipeline<br/>[data_pipeline.py]"]
  node_gbif["GBIF client<br/>[gbif_client.py]"]
  node_nasa["NASA client<br/>[nasa_client.py]"]
  node_weather["Weather client"]
  node_ml["Risk scoring<br/>[ml_module.py]"]
  node_gbif_api["GBIF API"]
  node_nasa_api["NASA POWER API"]
  node_weather_api["OpenWeather API"]
end

subgraph group_monitor["Monitoring"]
  node_analyticsroutes["Analytics routes<br/>[analytics.py]"]
end

subgraph group_chat["Document Q&amp;A"]
  node_chatroutes["Chatbot routes<br/>[chatbot.py]"]
  node_pdfservice["PDF Q&amp;A service"]
  node_knowledge["Website knowledge"]
  node_supabase[("Supabase vectors")]
  node_groq["Groq LLM"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_authui
node_app -->|"routes to"| node_dashboardui
node_app -->|"routes to"| node_searchui
node_app -->|"routes to"| node_mapui
node_app -->|"routes to"| node_analyticsui
node_authui -->|"calls"| node_authclient
node_authclient -->|"uses"| node_api_client
node_dashboardui -->|"calls"| node_dashboardclient
node_dashboardclient -.->|"uses"| node_api_client
node_searchui -->|"calls"| node_searchclient
node_searchclient -->|"uses"| node_api_client
node_mapui -.->|"loads data"| node_dashboardclient
node_analyticsui -.->|"requests data"| node_api_client
node_chatui -.->|"requests answers"| node_api_client
node_api_client -.->|"HTTP requests"| node_backend
node_backend -->|"registers"| node_authroutes
node_backend -->|"registers"| node_predroutes
node_backend -->|"registers"| node_analyticsroutes
node_backend -->|"registers"| node_chatroutes
node_authroutes -->|"calls"| node_authservice
node_authservice -.->|"accesses users"| node_database
node_authroutes -.->|"protects profile"| node_jwt
node_predroutes -.->|"requires token"| node_jwt
node_predroutes -->|"fetches data"| node_pipeline
node_pipeline -->|"fetches occurrences"| node_gbif
node_pipeline -->|"fetches metrics"| node_nasa
node_pipeline -->|"fetches weather"| node_weather
node_gbif -.->|"queries"| node_gbif_api
node_nasa -.->|"queries"| node_nasa_api
node_weather -.->|"queries"| node_weather_api
node_predroutes -->|"scores risk"| node_ml
node_predroutes -->|"persists results"| node_database
node_analyticsroutes -->|"reads analytics"| node_database
node_analyticsroutes -->|"uses client"| node_weather
node_chatroutes -.->|"protects queries"| node_jwt
node_chatroutes -->|"processes questions"| node_pdfservice
node_chatroutes -->|"uses knowledge"| node_knowledge
node_chatroutes -.->|"stores history"| node_database
node_pdfservice -.->|"retrieves chunks"| node_supabase
node_pdfservice -.->|"generates answer"| node_groq

click node_app "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/contexts/AuthContext.tsx"
click node_authclient "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/services/auth.ts"
click node_dashboardui "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/components/Dashboard/DashboardPage.tsx"
click node_dashboardclient "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/services/dashboard.ts"
click node_searchui "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/components/Search/SearchPage.tsx"
click node_searchclient "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/services/search.ts"
click node_mapui "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/components/RiskMap/RiskMapPage.tsx"
click node_analyticsui "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/components/Analytics/AnalyticsPage.tsx"
click node_chatui "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/components/Chatbot/ChatbotPage.tsx"
click node_api_client "https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/services/api.ts"
click node_backend "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/main.py"
click node_authroutes "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/routes/auth.py"
click node_authservice "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/auth_service.py"
click node_jwt "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/middleware/auth.py"
click node_predroutes "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/routes/predictions.py"
click node_pipeline "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/data_pipeline.py"
click node_gbif "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/external_apis/gbif_client.py"
click node_nasa "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/external_apis/nasa_client.py"
click node_weather "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/external_apis/openweather_client.py"
click node_ml "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/ml_module.py"
click node_analyticsroutes "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/routes/analytics.py"
click node_database "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/database.py"
click node_chatroutes "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/routes/chatbot.py"
click node_pdfservice "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/pdf_chatbot_service.py"
click node_knowledge "https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/website_knowledge_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_authui,node_authclient,node_dashboardui,node_dashboardclient,node_searchui,node_searchclient,node_mapui,node_analyticsui,node_chatui,node_api_client,node_user toneBlue
class node_backend,node_authroutes,node_authservice,node_jwt,node_database toneAmber
class node_predroutes,node_pipeline,node_gbif,node_nasa,node_weather,node_ml,node_gbif_api,node_nasa_api,node_weather_api toneMint
class node_analyticsroutes toneRose
class node_chatroutes,node_pdfservice,node_knowledge,node_supabase,node_groq toneIndigo
```

## Components

### User application

- [Web app routes](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Auth context](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/contexts/AuthContext.tsx): `frontend/src/contexts/AuthContext.tsx`
- [Auth client](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/services/auth.ts): `frontend/src/services/auth.ts`
- [Dashboard](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/components/Dashboard/DashboardPage.tsx): `frontend/src/components/Dashboard/DashboardPage.tsx`
- [Dashboard client](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/services/dashboard.ts): `frontend/src/services/dashboard.ts`
- [Search page](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/components/Search/SearchPage.tsx): `frontend/src/components/Search/SearchPage.tsx`
- [Search client](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/services/search.ts): `frontend/src/services/search.ts`
- [Risk map](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/components/RiskMap/RiskMapPage.tsx): `frontend/src/components/RiskMap/RiskMapPage.tsx`
- [Analytics page](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/components/Analytics/AnalyticsPage.tsx): `frontend/src/components/Analytics/AnalyticsPage.tsx`
- [Chatbot UI](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/components/Chatbot/ChatbotPage.tsx): `frontend/src/components/Chatbot/ChatbotPage.tsx`
- [HTTP API client](https://github.com/manishkudtarkar/eco-stat/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### API and identity

- [FastAPI application](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/main.py): `backend/main.py`
- [Auth routes](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [Auth service](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/auth_service.py): `backend/services/auth_service.py`
- [JWT validation](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/middleware/auth.py): `backend/middleware/auth.py`
- [MongoDB manager](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/database.py): `backend/database.py`

### Risk intelligence

- [Prediction routes](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/routes/predictions.py): `backend/routes/predictions.py`
- [Data pipeline](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/data_pipeline.py): `backend/services/data_pipeline.py`
- [GBIF client](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/external_apis/gbif_client.py): `backend/services/external_apis/gbif_client.py`
- [NASA client](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/external_apis/nasa_client.py): `backend/services/external_apis/nasa_client.py`
- [Weather client](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/external_apis/openweather_client.py): `backend/services/external_apis/openweather_client.py`
- [Risk scoring](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/ml_module.py): `backend/services/ml_module.py`
- **GBIF API**
- **NASA POWER API**
- **OpenWeather API**

### Monitoring

- [Analytics routes](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/routes/analytics.py): `backend/routes/analytics.py`

### Document Q&A

- [Chatbot routes](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/routes/chatbot.py): `backend/routes/chatbot.py`
- [PDF Q&A service](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/pdf_chatbot_service.py): `backend/services/pdf_chatbot_service.py`
- [Website knowledge](https://github.com/manishkudtarkar/eco-stat/blob/main/backend/services/website_knowledge_service.py): `backend/services/website_knowledge_service.py`
- **Supabase vectors**
- **Groq LLM**

### Other components

- **User**

## Connections

- User → Web app routes: uses (evidence: `frontend/src/App.tsx`)
- Web app routes → Auth context: provides auth (evidence: `frontend/src/App.tsx`)
- Web app routes → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Search page: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Risk map: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Analytics page: routes to (evidence: `frontend/src/App.tsx`)
- Auth context → Auth client: calls (evidence: `frontend/src/contexts/AuthContext.tsx`)
- Auth client → HTTP API client: uses (evidence: `frontend/src/services/auth.ts`)
- Dashboard → Dashboard client: calls (evidence: `frontend/src/components/Dashboard/DashboardPage.tsx`)
- Dashboard client → HTTP API client: uses
- Search page → Search client: calls (evidence: `frontend/src/components/Search/SearchPage.tsx`)
- Search client → HTTP API client: uses (evidence: `frontend/src/services/search.ts`)
- Risk map → Dashboard client: loads data (evidence: `frontend/src/components/RiskMap/RiskMapPage.tsx`)
- Analytics page → HTTP API client: requests data
- Chatbot UI → HTTP API client: requests answers
- HTTP API client → FastAPI application: HTTP requests
- FastAPI application → Auth routes: registers (evidence: `backend/main.py`)
- FastAPI application → Prediction routes: registers (evidence: `backend/main.py`)
- FastAPI application → Analytics routes: registers (evidence: `backend/main.py`)
- FastAPI application → Chatbot routes: registers (evidence: `backend/main.py`)
- Auth routes → Auth service: calls (evidence: `backend/routes/auth.py`)
- Auth service → MongoDB manager: accesses users
- Auth routes → JWT validation: protects profile (evidence: `backend/routes/auth.py`)
- Prediction routes → JWT validation: requires token (evidence: `backend/routes/predictions.py`)
- Prediction routes → Data pipeline: fetches data (evidence: `backend/routes/predictions.py`)
- Data pipeline → GBIF client: fetches occurrences (evidence: `backend/services/data_pipeline.py`)
- Data pipeline → NASA client: fetches metrics (evidence: `backend/services/data_pipeline.py`)
- Data pipeline → Weather client: fetches weather (evidence: `backend/services/data_pipeline.py`)
- GBIF client → GBIF API: queries
- NASA client → NASA POWER API: queries
- Weather client → OpenWeather API: queries
- Prediction routes → Risk scoring: scores risk (evidence: `backend/routes/predictions.py`)
- Prediction routes → MongoDB manager: persists results (evidence: `backend/routes/predictions.py`)
- Analytics routes → MongoDB manager: reads analytics (evidence: `backend/routes/analytics.py`)
- Analytics routes → Weather client: uses client (evidence: `backend/routes/analytics.py`)
- Chatbot routes → JWT validation: protects queries (evidence: `backend/routes/chatbot.py`)
- Chatbot routes → PDF Q&A service: processes questions (evidence: `backend/routes/chatbot.py`)
- Chatbot routes → Website knowledge: uses knowledge (evidence: `backend/routes/chatbot.py`)
- Chatbot routes → MongoDB manager: stores history (evidence: `backend/routes/chatbot.py`)
- PDF Q&A service → Supabase vectors: retrieves chunks
- PDF Q&A service → Groq LLM: generates answer
