# sbcoding271/metromitra architecture

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

- Interactive diagram: https://gitdiagram.com/sbcoding271/metromitra
- Repository: https://github.com/sbcoding271/metromitra

## Overview

MetroMitra helps Pune Metro passengers explore stations and plan accessible journeys, ask multilingual questions by text or voice, and review AI-assisted photo issue reports. The main journey runs from the passenger-facing planner through the API client and metro route endpoint to the graph planner and verified network data, then back to route presentation. Separate branches cover AI chat and journey interpretation, issue triage, and browser-local reports and preferences. Relationships are limited to those shown in the supplied excerpts, source index, or README; unsampled components are represented without speculative internal connections.

Main entry points: [`client/src/App.jsx`](https://github.com/sbcoding271/metromitra/blob/main/client/src/App.jsx) (Application shell), [`client/src/services/api.js`](https://github.com/sbcoding271/metromitra/blob/main/client/src/services/api.js) (API client), [`server/src/services/geminiService.js`](https://github.com/sbcoding271/metromitra/blob/main/server/src/services/geminiService.js) (Gemini services), [`server/src/routes/issueRoutes.js`](https://github.com/sbcoding271/metromitra/blob/main/server/src/routes/issueRoutes.js) (Issue endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_passenger_ui["Passenger experience"]
  node_app["Application shell<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_network_explorer["Network explorer"]
  node_stations["Stations directory<br/>[StationsView.jsx]"]
  node_favourites["Favourite stations<br/>[FavouritesView.jsx]"]
  node_alerts_help["Alerts and help"]
  node_translations["Language translations<br/>[translations.js]"]
  node_local_storage[("Browser-local storage<br/>[storage.js]")]
end

subgraph group_journey_data["Journey and network"]
  node_journey_planner["Journey planner<br/>[JourneyPlanner.jsx]"]
  node_route_card["Route results"]
  node_network_map["Schematic network map"]
  node_metro_graph["Route and station graph<br/>[metroGraph.js]"]
  node_network_data["Verified Pune network"]
end

subgraph group_ai_reporting["AI and reporting"]
  node_ai_assistant["AI text assistant<br/>[AiAssistant.jsx]"]
  node_voice_assistant["Voice assistant<br/>[VoiceAssistant.jsx]"]
  node_speech_hook["Browser speech<br/>[useSpeech.js]"]
  node_issue_reporter["Issue reporter<br/>[IssueReporter.jsx]"]
  node_my_reports["My reports<br/>[MyReports.jsx]"]
  node_gemini_service["Gemini services<br/>[geminiService.js]"]
end

subgraph group_api_backend["API backend"]
  node_api_client["API client<br/>[api.js]"]
  node_api_app["Express API app<br/>[app.js]"]
  node_metro_routes["Metro endpoints<br/>[metroRoutes.js]"]
  node_assistant_routes["Assistant endpoints<br/>[assistantRoutes.js]"]
  node_issue_routes["Issue endpoint<br/>[issueRoutes.js]"]
  node_upload_middleware["Image validation<br/>[upload.js]"]
  node_env_config["Server configuration<br/>[env.js]"]
end

node_passenger(("Passenger"))
node_gemini{{"Google Gemini"}}

node_passenger -->|"uses"| node_app
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_journey_planner
node_app -->|"renders"| node_network_explorer
node_app -->|"renders"| node_stations
node_app -->|"renders"| node_favourites
node_app -->|"renders"| node_alerts_help
node_app -->|"renders"| node_ai_assistant
node_app -->|"renders"| node_voice_assistant
node_app -->|"renders"| node_issue_reporter
node_app -->|"renders"| node_my_reports
node_app -->|"loads network"| node_api_client
node_app -->|"persists reports"| node_local_storage
node_journey_planner -->|"requests routes"| node_api_client
node_journey_planner -->|"renders"| node_route_card
node_ai_assistant -->|"sends chat"| node_api_client
node_ai_assistant -->|"renders"| node_route_card
node_voice_assistant -->|"sends queries"| node_api_client
node_voice_assistant -->|"uses speech"| node_speech_hook
node_voice_assistant -->|"renders"| node_route_card
node_issue_reporter -->|"submits image"| node_api_client
node_issue_reporter -->|"saves report"| node_local_storage
node_my_reports -->|"manages reports"| node_local_storage
node_network_explorer -->|"renders"| node_network_map
node_dashboard -->|"renders"| node_network_map
node_api_client -->|"requests metro data"| node_metro_routes
node_api_client -->|"requests assistance"| node_assistant_routes
node_api_client -->|"submits analysis"| node_issue_routes
node_api_app -->|"mounts routes"| node_metro_routes
node_api_app -->|"mounts routes"| node_assistant_routes
node_api_app -->|"mounts routes"| node_issue_routes
node_metro_routes -->|"calls planner"| node_metro_graph
node_assistant_routes -->|"calls services"| node_gemini_service
node_issue_routes -->|"validates upload"| node_upload_middleware
node_issue_routes -->|"analyzes image"| node_gemini_service
node_issue_routes -->|"finds station"| node_metro_graph
node_metro_graph -->|"reads network"| node_network_data
node_gemini_service -->|"uses verified routes"| node_metro_graph
node_gemini_service -->|"checks configuration"| node_env_config
node_gemini_service -->|"generates responses"| node_gemini
node_api_app -->|"reads settings"| node_env_config

click node_app "https://github.com/sbcoding271/metromitra/blob/main/client/src/App.jsx"
click node_dashboard "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/Dashboard.jsx"
click node_network_explorer "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/NetworkExplorer.jsx"
click node_stations "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/StationsView.jsx"
click node_favourites "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/FavouritesView.jsx"
click node_alerts_help "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/ServiceAlertsView.jsx"
click node_translations "https://github.com/sbcoding271/metromitra/blob/main/client/src/i18n/translations.js"
click node_journey_planner "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/JourneyPlanner.jsx"
click node_route_card "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/RouteResultCard.jsx"
click node_network_map "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/SchematicNetworkMap.jsx"
click node_api_client "https://github.com/sbcoding271/metromitra/blob/main/client/src/services/api.js"
click node_local_storage "https://github.com/sbcoding271/metromitra/blob/main/client/src/services/storage.js"
click node_ai_assistant "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/AiAssistant.jsx"
click node_voice_assistant "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/VoiceAssistant.jsx"
click node_speech_hook "https://github.com/sbcoding271/metromitra/blob/main/client/src/hooks/useSpeech.js"
click node_issue_reporter "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/IssueReporter.jsx"
click node_my_reports "https://github.com/sbcoding271/metromitra/blob/main/client/src/components/MyReports.jsx"
click node_api_app "https://github.com/sbcoding271/metromitra/blob/main/server/src/app.js"
click node_metro_routes "https://github.com/sbcoding271/metromitra/blob/main/server/src/routes/metroRoutes.js"
click node_assistant_routes "https://github.com/sbcoding271/metromitra/blob/main/server/src/routes/assistantRoutes.js"
click node_issue_routes "https://github.com/sbcoding271/metromitra/blob/main/server/src/routes/issueRoutes.js"
click node_upload_middleware "https://github.com/sbcoding271/metromitra/blob/main/server/src/middleware/upload.js"
click node_metro_graph "https://github.com/sbcoding271/metromitra/blob/main/server/src/services/metroGraph.js"
click node_network_data "https://github.com/sbcoding271/metromitra/blob/main/server/src/data/puneMetroNetwork.js"
click node_gemini_service "https://github.com/sbcoding271/metromitra/blob/main/server/src/services/geminiService.js"
click node_env_config "https://github.com/sbcoding271/metromitra/blob/main/server/src/config/env.js"

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_dashboard,node_network_explorer,node_stations,node_favourites,node_alerts_help,node_translations,node_local_storage toneBlue
class node_journey_planner,node_route_card,node_network_map,node_metro_graph,node_network_data toneAmber
class node_ai_assistant,node_voice_assistant,node_speech_hook,node_issue_reporter,node_my_reports,node_gemini_service toneMint
class node_api_client,node_api_app,node_metro_routes,node_assistant_routes,node_issue_routes,node_upload_middleware,node_env_config toneRose
class node_passenger,node_gemini toneIndigo
```

## Components

### Passenger experience

- [Application shell](https://github.com/sbcoding271/metromitra/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Dashboard](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/Dashboard.jsx): `client/src/components/Dashboard.jsx`
- [Network explorer](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/NetworkExplorer.jsx): `client/src/components/NetworkExplorer.jsx`
- [Stations directory](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/StationsView.jsx): `client/src/components/StationsView.jsx`
- [Favourite stations](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/FavouritesView.jsx): `client/src/components/FavouritesView.jsx`
- [Alerts and help](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/ServiceAlertsView.jsx): `client/src/components/ServiceAlertsView.jsx`
- [Language translations](https://github.com/sbcoding271/metromitra/blob/main/client/src/i18n/translations.js): `client/src/i18n/translations.js`
- [Browser-local storage](https://github.com/sbcoding271/metromitra/blob/main/client/src/services/storage.js): `client/src/services/storage.js`

### Journey and network

- [Journey planner](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/JourneyPlanner.jsx): `client/src/components/JourneyPlanner.jsx`
- [Route results](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/RouteResultCard.jsx): `client/src/components/RouteResultCard.jsx`
- [Schematic network map](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/SchematicNetworkMap.jsx): `client/src/components/SchematicNetworkMap.jsx`
- [Route and station graph](https://github.com/sbcoding271/metromitra/blob/main/server/src/services/metroGraph.js): `server/src/services/metroGraph.js`
- [Verified Pune network](https://github.com/sbcoding271/metromitra/blob/main/server/src/data/puneMetroNetwork.js): `server/src/data/puneMetroNetwork.js`

### AI and reporting

- [AI text assistant](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/AiAssistant.jsx): `client/src/components/AiAssistant.jsx`
- [Voice assistant](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/VoiceAssistant.jsx): `client/src/components/VoiceAssistant.jsx`
- [Browser speech](https://github.com/sbcoding271/metromitra/blob/main/client/src/hooks/useSpeech.js): `client/src/hooks/useSpeech.js`
- [Issue reporter](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/IssueReporter.jsx): `client/src/components/IssueReporter.jsx`
- [My reports](https://github.com/sbcoding271/metromitra/blob/main/client/src/components/MyReports.jsx): `client/src/components/MyReports.jsx`
- [Gemini services](https://github.com/sbcoding271/metromitra/blob/main/server/src/services/geminiService.js): `server/src/services/geminiService.js`

### API backend

- [API client](https://github.com/sbcoding271/metromitra/blob/main/client/src/services/api.js): `client/src/services/api.js`
- [Express API app](https://github.com/sbcoding271/metromitra/blob/main/server/src/app.js): `server/src/app.js`
- [Metro endpoints](https://github.com/sbcoding271/metromitra/blob/main/server/src/routes/metroRoutes.js): `server/src/routes/metroRoutes.js`
- [Assistant endpoints](https://github.com/sbcoding271/metromitra/blob/main/server/src/routes/assistantRoutes.js): `server/src/routes/assistantRoutes.js`
- [Issue endpoint](https://github.com/sbcoding271/metromitra/blob/main/server/src/routes/issueRoutes.js): `server/src/routes/issueRoutes.js`
- [Image validation](https://github.com/sbcoding271/metromitra/blob/main/server/src/middleware/upload.js): `server/src/middleware/upload.js`
- [Server configuration](https://github.com/sbcoding271/metromitra/blob/main/server/src/config/env.js): `server/src/config/env.js`

### Other components

- **Passenger**
- **Google Gemini**

## Connections

- Passenger → Application shell: uses (evidence: `README.md`)
- Application shell → Dashboard: renders (evidence: `client/src/App.jsx`)
- Application shell → Journey planner: renders (evidence: `client/src/App.jsx`)
- Application shell → Network explorer: renders (evidence: `client/src/App.jsx`)
- Application shell → Stations directory: renders (evidence: `client/src/App.jsx`)
- Application shell → Favourite stations: renders (evidence: `client/src/App.jsx`)
- Application shell → Alerts and help: renders (evidence: `client/src/App.jsx`)
- Application shell → AI text assistant: renders (evidence: `client/src/App.jsx`)
- Application shell → Voice assistant: renders (evidence: `client/src/App.jsx`)
- Application shell → Issue reporter: renders (evidence: `client/src/App.jsx`)
- Application shell → My reports: renders (evidence: `client/src/App.jsx`)
- Application shell → API client: loads network (evidence: `client/src/App.jsx`)
- Application shell → Browser-local storage: persists reports (evidence: `client/src/App.jsx`)
- Journey planner → API client: requests routes (evidence: `client/src/components/JourneyPlanner.jsx`)
- Journey planner → Route results: renders (evidence: `client/src/components/JourneyPlanner.jsx`)
- AI text assistant → API client: sends chat (evidence: `client/src/components/AiAssistant.jsx`)
- AI text assistant → Route results: renders (evidence: `client/src/components/AiAssistant.jsx`)
- Voice assistant → API client: sends queries (evidence: `client/src/components/VoiceAssistant.jsx`)
- Voice assistant → Browser speech: uses speech (evidence: `client/src/components/VoiceAssistant.jsx`)
- Voice assistant → Route results: renders (evidence: `client/src/components/VoiceAssistant.jsx`)
- Issue reporter → API client: submits image (evidence: `client/src/components/IssueReporter.jsx`)
- Issue reporter → Browser-local storage: saves report (evidence: `client/src/components/IssueReporter.jsx`)
- My reports → Browser-local storage: manages reports (evidence: `client/src/components/MyReports.jsx`)
- Network explorer → Schematic network map: renders (evidence: `client/src/components/NetworkExplorer.jsx`)
- Dashboard → Schematic network map: renders (evidence: `client/src/components/Dashboard.jsx`)
- API client → Metro endpoints: requests metro data (evidence: `client/src/services/api.js`)
- API client → Assistant endpoints: requests assistance (evidence: `client/src/services/api.js`)
- API client → Issue endpoint: submits analysis (evidence: `client/src/services/api.js`)
- Express API app → Metro endpoints: mounts routes (evidence: `server/src/app.js`)
- Express API app → Assistant endpoints: mounts routes (evidence: `server/src/app.js`)
- Express API app → Issue endpoint: mounts routes (evidence: `server/src/app.js`)
- Metro endpoints → Route and station graph: calls planner (evidence: `server/src/routes/metroRoutes.js`)
- Assistant endpoints → Gemini services: calls services (evidence: `server/src/routes/assistantRoutes.js`)
- Issue endpoint → Image validation: validates upload (evidence: `server/src/routes/issueRoutes.js`)
- Issue endpoint → Gemini services: analyzes image (evidence: `server/src/routes/issueRoutes.js`)
- Issue endpoint → Route and station graph: finds station (evidence: `server/src/routes/issueRoutes.js`)
- Route and station graph → Verified Pune network: reads network (evidence: `server/src/services/metroGraph.js`)
- Gemini services → Route and station graph: uses verified routes (evidence: `server/src/services/geminiService.js`)
- Gemini services → Server configuration: checks configuration (evidence: `server/src/services/geminiService.js`)
- Gemini services → Google Gemini: generates responses (evidence: `server/src/services/geminiService.js`)
- Express API app → Server configuration: reads settings (evidence: `server/src/app.js`)
