# bluehorizon65/metro_sphere_web architecture

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

- Interactive diagram: https://gitdiagram.com/bluehorizon65/metro_sphere_web
- Repository: https://github.com/bluehorizon65/metro_sphere_web

## Overview

Metro Sphere is a document-management and AI analysis platform: employees upload or receive metro documents, which can be digitized/translated, analyzed for actionable details, searched, and tracked. The graph captures the evidenced frontend routing, Express API, and translation/analysis handoffs, plus README-described capabilities whose implementation links were not sampled. The AI server and semantic-search service are represented by their exact paths, but their internal behavior and several UI/API connections were not inspected.

Main entry points: [`Frontend/src/App.jsx`](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/App.jsx) (App routes), [`Backend/index.js`](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/index.js) (Express API), [`AI/kmrl_api_server.py`](https://github.com/bluehorizon65/metro_sphere_web/blob/main/AI/kmrl_api_server.py) (LLM document analysis), [`Backend/routes/email.js`](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/email.js) (Email analysis route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Employee web app"]
  node_frontend_routes["App routes<br/>[App.jsx]"]
  node_login["Login and registration<br/>[LoginRegister.jsx]"]
  node_dashboard["Dashboard"]
  node_upload_ui["Document upload<br/>[UploadDocument.jsx]"]
  node_analysis_ui["PDF analysis"]
  node_search_ui["Semantic search UI<br/>[SemanticSearch.jsx]"]
  node_email_ui["Email uploads UI<br/>[EmailUploads.jsx]"]
  node_whatsapp_ui["WhatsApp uploads UI"]
end

subgraph group_api["Application API"]
  node_api_server["Express API<br/>[index.js]"]
  node_auth["User and admin accounts<br/>[user.js]"]
  node_database[("PostgreSQL database<br/>[db.js]")]
  node_document_api["Document analysis routes<br/>[user.js]"]
  node_email_api["Email analysis route<br/>[email.js]"]
  node_whatsapp_api["WhatsApp analysis route<br/>[whatsapp.js]"]
  node_semantic_api["Semantic API routes<br/>[semantic.js]"]
  node_admin_api["Admin routes<br/>[admin.js]"]
end

subgraph group_processing["Document processing"]
  node_translation["OCR and translation<br/>[full_pipeline.py]"]
  node_ai_analysis["LLM document analysis<br/>[kmrl_api_server.py]"]
  node_semantic_engine[("Vector search service<br/>[merged_api.py]")]
end

subgraph group_ingestion["External ingestion"]
  node_email_ingest["Gmail attachment ingest<br/>[backend.py]"]
  node_whatsapp_ingest["WhatsApp file ingest<br/>[backend.py]"]
end

node_employee(("Employee"))

node_employee -->|"uses"| node_frontend_routes
node_frontend_routes -->|"routes to"| node_login
node_frontend_routes -->|"routes to"| node_dashboard
node_frontend_routes -->|"routes to"| node_upload_ui
node_frontend_routes -->|"routes to"| node_analysis_ui
node_frontend_routes -->|"routes to"| node_search_ui
node_frontend_routes -->|"routes to"| node_email_ui
node_frontend_routes -->|"routes to"| node_whatsapp_ui
node_frontend_routes -.->|"calls"| node_api_server
node_api_server -->|"mounts"| node_auth
node_api_server -->|"mounts"| node_document_api
node_api_server -->|"mounts"| node_email_api
node_api_server -->|"mounts"| node_whatsapp_api
node_api_server -->|"mounts"| node_semantic_api
node_api_server -->|"mounts"| node_admin_api
node_auth -.->|"queries"| node_database
node_admin_api -.->|"queries"| node_database
node_document_api -->|"translates via"| node_translation
node_document_api -->|"requests analysis"| node_ai_analysis
node_email_api -->|"translates via"| node_translation
node_email_api -->|"requests analysis"| node_ai_analysis
node_whatsapp_api -->|"translates via"| node_translation
node_whatsapp_api -->|"requests analysis"| node_ai_analysis
node_semantic_api -->|"forwards search"| node_semantic_engine
node_email_ingest -.->|"provides attachments"| node_email_api
node_whatsapp_ingest -.->|"provides files"| node_whatsapp_api
node_employee -.->|"searches documents"| node_semantic_engine
node_ai_analysis -.->|"returns extracted details"| node_employee
node_ai_analysis -.->|"suggests team sharing"| node_employee
node_employee -.->|"tracks documents"| node_database

click node_frontend_routes "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/App.jsx"
click node_login "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/LoginRegister.jsx"
click node_dashboard "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/DashboardLayout.jsx"
click node_upload_ui "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/UploadDocument.jsx"
click node_analysis_ui "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/PdfAnalysisPage.jsx"
click node_search_ui "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/SemanticSearch.jsx"
click node_email_ui "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/EmailUploads.jsx"
click node_whatsapp_ui "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/WhatsAppUploads.jsx"
click node_api_server "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/index.js"
click node_auth "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/user.js"
click node_database "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/db.js"
click node_document_api "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/user.js"
click node_email_api "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/email.js"
click node_whatsapp_api "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/whatsapp.js"
click node_semantic_api "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/semantic.js"
click node_admin_api "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/admin.js"
click node_translation "https://github.com/bluehorizon65/metro_sphere_web/blob/main/pipeline/full_pipeline.py"
click node_ai_analysis "https://github.com/bluehorizon65/metro_sphere_web/blob/main/AI/kmrl_api_server.py"
click node_semantic_engine "https://github.com/bluehorizon65/metro_sphere_web/blob/main/Semantic-search/merged_api.py"
click node_email_ingest "https://github.com/bluehorizon65/metro_sphere_web/blob/main/twilio/twilio_gmail/backend.py"
click node_whatsapp_ingest "https://github.com/bluehorizon65/metro_sphere_web/blob/main/twilio/twilio_whtspp/backend.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_frontend_routes,node_login,node_dashboard,node_upload_ui,node_analysis_ui,node_search_ui,node_email_ui,node_whatsapp_ui toneBlue
class node_api_server,node_auth,node_database,node_document_api,node_email_api,node_whatsapp_api,node_semantic_api,node_admin_api toneAmber
class node_translation,node_ai_analysis,node_semantic_engine toneMint
class node_email_ingest,node_whatsapp_ingest toneRose
class node_employee toneIndigo
```

## Components

### Employee web app

- [App routes](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [Login and registration](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/LoginRegister.jsx): `Frontend/src/pages/LoginRegister.jsx`
- [Dashboard](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/DashboardLayout.jsx): `Frontend/src/pages/DashboardLayout.jsx`
- [Document upload](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/UploadDocument.jsx): `Frontend/src/pages/UploadDocument.jsx`
- [PDF analysis](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/PdfAnalysisPage.jsx): `Frontend/src/pages/PdfAnalysisPage.jsx`
- [Semantic search UI](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/SemanticSearch.jsx): `Frontend/src/pages/SemanticSearch.jsx`
- [Email uploads UI](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/EmailUploads.jsx): `Frontend/src/pages/EmailUploads.jsx`
- [WhatsApp uploads UI](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Frontend/src/pages/WhatsAppUploads.jsx): `Frontend/src/pages/WhatsAppUploads.jsx`

### Application API

- [Express API](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/index.js): `Backend/index.js`
- [User and admin accounts](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/user.js): `Backend/routes/user.js`
- [PostgreSQL database](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/db.js): `Backend/db.js`
- [Document analysis routes](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/user.js): `Backend/routes/user.js`
- [Email analysis route](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/email.js): `Backend/routes/email.js`
- [WhatsApp analysis route](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/whatsapp.js): `Backend/routes/whatsapp.js`
- [Semantic API routes](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/semantic.js): `Backend/routes/semantic.js`
- [Admin routes](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Backend/routes/admin.js): `Backend/routes/admin.js`

### Document processing

- [OCR and translation](https://github.com/bluehorizon65/metro_sphere_web/blob/main/pipeline/full_pipeline.py): `pipeline/full_pipeline.py`
- [LLM document analysis](https://github.com/bluehorizon65/metro_sphere_web/blob/main/AI/kmrl_api_server.py): `AI/kmrl_api_server.py`
- [Vector search service](https://github.com/bluehorizon65/metro_sphere_web/blob/main/Semantic-search/merged_api.py): `Semantic-search/merged_api.py`

### External ingestion

- [Gmail attachment ingest](https://github.com/bluehorizon65/metro_sphere_web/blob/main/twilio/twilio_gmail/backend.py): `twilio/twilio_gmail/backend.py`
- [WhatsApp file ingest](https://github.com/bluehorizon65/metro_sphere_web/blob/main/twilio/twilio_whtspp/backend.py): `twilio/twilio_whtspp/backend.py`

### Other components

- **Employee**

## Connections

- Employee → App routes: uses (evidence: `README.md`)
- App routes → Login and registration: routes to (evidence: `Frontend/src/App.jsx`)
- App routes → Dashboard: routes to (evidence: `Frontend/src/App.jsx`)
- App routes → Document upload: routes to (evidence: `Frontend/src/App.jsx`)
- App routes → PDF analysis: routes to (evidence: `Frontend/src/App.jsx`)
- App routes → Semantic search UI: routes to (evidence: `Frontend/src/App.jsx`)
- App routes → Email uploads UI: routes to (evidence: `Frontend/src/App.jsx`)
- App routes → WhatsApp uploads UI: routes to (evidence: `Frontend/src/App.jsx`)
- App routes → Express API: calls
- Express API → User and admin accounts: mounts (evidence: `Backend/index.js`)
- Express API → Document analysis routes: mounts (evidence: `Backend/index.js`)
- Express API → Email analysis route: mounts (evidence: `Backend/index.js`)
- Express API → WhatsApp analysis route: mounts (evidence: `Backend/index.js`)
- Express API → Semantic API routes: mounts (evidence: `Backend/index.js`)
- Express API → Admin routes: mounts (evidence: `Backend/index.js`)
- User and admin accounts → PostgreSQL database: queries (evidence: `Backend/routes/user.js`)
- Admin routes → PostgreSQL database: queries (evidence: `Backend/routes/admin.js`)
- Document analysis routes → OCR and translation: translates via (evidence: `Backend/routes/user.js`)
- Document analysis routes → LLM document analysis: requests analysis (evidence: `Backend/routes/user.js`)
- Email analysis route → OCR and translation: translates via (evidence: `Backend/routes/email.js`)
- Email analysis route → LLM document analysis: requests analysis (evidence: `Backend/routes/email.js`)
- WhatsApp analysis route → OCR and translation: translates via (evidence: `Backend/routes/whatsapp.js`)
- WhatsApp analysis route → LLM document analysis: requests analysis (evidence: `Backend/routes/whatsapp.js`)
- Semantic API routes → Vector search service: forwards search (evidence: `Backend/routes/semantic.js`)
- Gmail attachment ingest → Email analysis route: provides attachments
- WhatsApp file ingest → WhatsApp analysis route: provides files
- Employee → Vector search service: searches documents (evidence: `README.md`)
- LLM document analysis → Employee: returns extracted details (evidence: `README.md`)
- LLM document analysis → Employee: suggests team sharing (evidence: `README.md`)
- Employee → PostgreSQL database: tracks documents (evidence: `README.md`)
