# vkarankuma/eco_voice architecture

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

- Interactive diagram: https://gitdiagram.com/vkarankuma/eco_voice
- Repository: https://github.com/vkarankuma/eco_voice

## Overview

EcoVoice is a multilingual, voice-first household waste guidance app. Users speak or type a waste question, receive classification and disposal advice, and can explore collection centres, record activity, view rewards, and manage profile and privacy settings. The frontend handles voice input/output and feature views; its API client calls FastAPI, which delegates classification to the AI engine and curated knowledge base. Centre discovery also uses external mapping data. Backend implementation excerpts are partial; the documented activity, rewards, and profile capabilities are represented without assuming an unshown persistence layer.

Main entry points: [`frontend/src/App.tsx`](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/App.tsx) (App shell), [`frontend/src/components/VoiceHome.tsx`](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/VoiceHome.tsx) (Voice assistant view), [`frontend/src/api/client.ts`](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/api/client.ts) (API client), [`frontend/src/components/CollectionLocator.tsx`](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/CollectionLocator.tsx) (Centre locator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_voice["Voice assistant view<br/>[VoiceHome.tsx]"]
  node_speech["Speech controls"]
  node_result["Waste guidance card"]
  node_api["API client<br/>[client.ts]"]
  node_locator["Centre locator"]
  node_demo["Demo centres<br/>[demoCentres.ts]"]
end

subgraph group_backend["Guidance backend"]
  node_backend["FastAPI endpoints<br/>[main.py]"]
  node_engine["Waste query engine<br/>[ai_engine.py]"]
  node_knowledge["Verified waste rules<br/>[knowledge_base.py]"]
end

subgraph group_engagement["Household engagement"]
  node_activity["Activity dashboard"]
  node_rewards["Rewards leaderboard"]
  node_profile["Profile settings"]
end

subgraph group_external["External services"]
  node_browser["Browser speech APIs"]
  node_gemini["Google Gemini"]
  node_osm["OpenStreetMap services"]
end

node_household(("Household user"))

node_household -->|"uses"| node_app
node_app -->|"shows"| node_voice
node_voice -->|"controls"| node_speech
node_speech -->|"uses speech"| node_browser
node_voice -->|"submits query"| node_api
node_api -->|"HTTP requests"| node_backend
node_backend -->|"analyzes query"| node_engine
node_engine -->|"matches rules"| node_knowledge
node_engine -.->|"generates response"| node_gemini
node_voice -->|"renders result"| node_result
node_app -->|"shows"| node_locator
node_locator -->|"searches centres"| node_api
node_locator -->|"uses fallback"| node_demo
node_backend -->|"geocodes and searches"| node_osm
node_app -->|"shows summary"| node_activity
node_app -->|"shows rewards"| node_rewards
node_app -->|"shows settings"| node_profile
node_app -->|"loads and logs"| node_api
node_profile -->|"saves or deletes"| node_app

click node_app "https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/App.tsx"
click node_voice "https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/VoiceHome.tsx"
click node_speech "https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/hooks/useVoiceAssistant.ts"
click node_result "https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/WasteResultCard.tsx"
click node_api "https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/api/client.ts"
click node_locator "https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/CollectionLocator.tsx"
click node_demo "https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/data/demoCentres.ts"
click node_activity "https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/ActivityDashboard.tsx"
click node_rewards "https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/RewardsLeaderboard.tsx"
click node_profile "https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/ProfileSettings.tsx"
click node_backend "https://github.com/vkarankuma/eco_voice/blob/main/backend/main.py"
click node_engine "https://github.com/vkarankuma/eco_voice/blob/main/backend/ai_engine.py"
click node_knowledge "https://github.com/vkarankuma/eco_voice/blob/main/backend/knowledge_base.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_voice,node_speech,node_result,node_api,node_locator,node_demo,node_household toneBlue
class node_backend,node_engine,node_knowledge toneAmber
class node_activity,node_rewards,node_profile toneMint
class node_browser,node_gemini,node_osm toneRose
```

## Components

### Frontend experience

- [App shell](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Voice assistant view](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/VoiceHome.tsx): `frontend/src/components/VoiceHome.tsx`
- [Speech controls](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/hooks/useVoiceAssistant.ts): `frontend/src/hooks/useVoiceAssistant.ts`
- [Waste guidance card](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/WasteResultCard.tsx): `frontend/src/components/WasteResultCard.tsx`
- [API client](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Centre locator](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/CollectionLocator.tsx): `frontend/src/components/CollectionLocator.tsx`
- [Demo centres](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/data/demoCentres.ts): `frontend/src/data/demoCentres.ts`

### Guidance backend

- [FastAPI endpoints](https://github.com/vkarankuma/eco_voice/blob/main/backend/main.py): `backend/main.py`
- [Waste query engine](https://github.com/vkarankuma/eco_voice/blob/main/backend/ai_engine.py): `backend/ai_engine.py`
- [Verified waste rules](https://github.com/vkarankuma/eco_voice/blob/main/backend/knowledge_base.py): `backend/knowledge_base.py`

### Household engagement

- [Activity dashboard](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/ActivityDashboard.tsx): `frontend/src/components/ActivityDashboard.tsx`
- [Rewards leaderboard](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/RewardsLeaderboard.tsx): `frontend/src/components/RewardsLeaderboard.tsx`
- [Profile settings](https://github.com/vkarankuma/eco_voice/blob/main/frontend/src/components/ProfileSettings.tsx): `frontend/src/components/ProfileSettings.tsx`

### External services

- **Browser speech APIs**
- **Google Gemini**
- **OpenStreetMap services**

### Other components

- **Household user**

## Connections

- Household user → App shell: uses (evidence: `README.md`)
- App shell → Voice assistant view: shows (evidence: `frontend/src/App.tsx`)
- Voice assistant view → Speech controls: controls (evidence: `frontend/src/components/VoiceHome.tsx`)
- Speech controls → Browser speech APIs: uses speech (evidence: `frontend/src/hooks/useVoiceAssistant.ts`)
- Voice assistant view → API client: submits query (evidence: `frontend/src/components/VoiceHome.tsx`)
- API client → FastAPI endpoints: HTTP requests (evidence: `frontend/src/api/client.ts`)
- FastAPI endpoints → Waste query engine: analyzes query (evidence: `backend/main.py`)
- Waste query engine → Verified waste rules: matches rules (evidence: `backend/ai_engine.py`)
- Waste query engine → Google Gemini: generates response (evidence: `backend/ai_engine.py`)
- Voice assistant view → Waste guidance card: renders result (evidence: `frontend/src/components/VoiceHome.tsx`)
- App shell → Centre locator: shows (evidence: `frontend/src/App.tsx`)
- Centre locator → API client: searches centres (evidence: `frontend/src/components/CollectionLocator.tsx`)
- Centre locator → Demo centres: uses fallback (evidence: `frontend/src/components/CollectionLocator.tsx`)
- FastAPI endpoints → OpenStreetMap services: geocodes and searches (evidence: `backend/main.py`)
- App shell → Activity dashboard: shows summary (evidence: `frontend/src/App.tsx`)
- App shell → Rewards leaderboard: shows rewards (evidence: `frontend/src/App.tsx`)
- App shell → Profile settings: shows settings (evidence: `frontend/src/App.tsx`)
- App shell → API client: loads and logs (evidence: `frontend/src/App.tsx`)
- Profile settings → App shell: saves or deletes (evidence: `frontend/src/components/ProfileSettings.tsx`)
