# sannjaay/ipl-llm architecture

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

- Interactive diagram: https://gitdiagram.com/sannjaay/ipl-llm
- Repository: https://github.com/sannjaay/ipl-llm

## Overview

This repository appears to be an IPL fan application: users browse match, player-comparison, standings, and statistics views, and can open match details. A separate Express backend exposes season-match and commentary endpoints; commentary retrieval combines stored match data and commentary text with Gemini generation. The tree also contains a scraper and Python/LLM code, but their runtime connections are not established by the excerpts. Frontend-to-backend wiring and several page data sources are likewise unverified, so those edges are omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/App.jsx) (Application router), [`backend/services/ragCommentaryService.js`](https://github.com/sannjaay/ipl-llm/blob/master/backend/services/ragCommentaryService.js) (Commentary retrieval and generation), [`backend/index.js`](https://github.com/sannjaay/ipl-llm/blob/master/backend/index.js) (Express server), [`frontend/src/pages/MatchesPage.jsx`](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/MatchesPage.jsx) (Matches list)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fan_ui["Fan application"]
  node_app["Application router<br/>[App.jsx]"]
  node_nav["Navigation<br/>[Navbar.jsx]"]
  node_home["Home<br/>[Home.jsx]"]
  node_matches_page["Matches list<br/>[MatchesPage.jsx]"]
  node_match_card["Match card<br/>[MatchCard.jsx]"]
  node_match_page["Match details<br/>[MatchDetails.jsx]"]
  node_commentary_section["Commentary view"]
  node_comparison["Player comparison"]
  node_table["Standings table<br/>[TablePage.jsx]"]
  node_statistics["Statistics<br/>[StatisticsPage.jsx]"]
  node_static_data["Sample IPL data<br/>[index.js]"]
  node_chatbot["Fan chatbot<br/>[ChatBot.jsx]"]
end

subgraph group_match_data["Match data API"]
  node_express_app["Express server<br/>[index.js]"]
  node_match_routes["Season match endpoint<br/>[matchRoutes.js]"]
  node_match_model[("Match model<br/>[Match.js]")]
end

subgraph group_commentary["AI commentary"]
  node_rag_routes["Commentary endpoint<br/>[ragRoutes.js]"]
  node_rag_service["Commentary retrieval and generation"]
  node_gemini["Gemini API"]
end

subgraph group_data_ingest["Data and ML"]
  node_scraper["IPL scraper<br/>[scraper.js]"]
  node_llm_integration["LLM integration<br/>[llmintegration.js]"]
  node_python_rag["Python RAG<br/>[main.py]"]
  node_flask_app["Flask app<br/>[app.py]"]
  node_mongo[("Mongo integration<br/>[database.py]")]
end

node_fan(("IPL fan"))

node_fan -->|"uses"| node_app
node_app -->|"renders"| node_nav
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_matches_page
node_app -->|"routes to"| node_match_page
node_app -->|"routes to"| node_comparison
node_app -->|"routes to"| node_table
node_app -->|"routes to"| node_statistics
node_app -->|"opens"| node_chatbot
node_matches_page -->|"renders"| node_match_card
node_matches_page -->|"uses"| node_match_page
node_match_page -->|"renders"| node_commentary_section
node_statistics -->|"reads"| node_static_data
node_match_routes -->|"queries"| node_match_model
node_rag_routes -->|"calls"| node_rag_service
node_rag_service -->|"loads match"| node_match_model
node_rag_service -->|"generates answer"| node_gemini
node_express_app -->|"registers"| node_match_routes
node_express_app -->|"registers"| node_rag_routes
node_express_app -->|"initializes"| node_rag_service

click node_app "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/App.jsx"
click node_nav "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/components/Navbar.jsx"
click node_home "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/Home.jsx"
click node_matches_page "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/MatchesPage.jsx"
click node_match_card "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/MatchCard.jsx"
click node_match_page "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/MatchDetails.jsx"
click node_commentary_section "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/components/CommentarySection.jsx"
click node_comparison "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/PlayerComparisonPage.jsx"
click node_table "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/TablePage.jsx"
click node_statistics "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/StatisticsPage.jsx"
click node_static_data "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/data/index.js"
click node_chatbot "https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/components/ChatBot.jsx"
click node_express_app "https://github.com/sannjaay/ipl-llm/blob/master/backend/index.js"
click node_match_routes "https://github.com/sannjaay/ipl-llm/blob/master/backend/routes/matchRoutes.js"
click node_match_model "https://github.com/sannjaay/ipl-llm/blob/master/backend/models/Match.js"
click node_rag_routes "https://github.com/sannjaay/ipl-llm/blob/master/backend/routes/ragRoutes.js"
click node_rag_service "https://github.com/sannjaay/ipl-llm/blob/master/backend/services/ragCommentaryService.js"
click node_scraper "https://github.com/sannjaay/ipl-llm/blob/master/ipl-scraper/scraper.js"
click node_llm_integration "https://github.com/sannjaay/ipl-llm/blob/master/ml/llmintegration.js"
click node_python_rag "https://github.com/sannjaay/ipl-llm/blob/master/ml/rag/main.py"
click node_flask_app "https://github.com/sannjaay/ipl-llm/blob/master/backend/app.py"
click node_mongo "https://github.com/sannjaay/ipl-llm/blob/master/backend/database.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_nav,node_home,node_matches_page,node_match_card,node_match_page,node_commentary_section,node_comparison,node_table,node_statistics,node_static_data,node_chatbot toneBlue
class node_express_app,node_match_routes,node_match_model toneAmber
class node_rag_routes,node_rag_service,node_gemini toneMint
class node_scraper,node_llm_integration,node_python_rag,node_flask_app,node_mongo toneRose
class node_fan toneIndigo
```

## Components

### Fan application

- [Application router](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Navigation](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [Home](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Matches list](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/MatchesPage.jsx): `frontend/src/pages/MatchesPage.jsx`
- [Match card](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/MatchCard.jsx): `frontend/src/pages/MatchCard.jsx`
- [Match details](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/MatchDetails.jsx): `frontend/src/pages/MatchDetails.jsx`
- [Commentary view](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/components/CommentarySection.jsx): `frontend/src/components/CommentarySection.jsx`
- [Player comparison](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/PlayerComparisonPage.jsx): `frontend/src/pages/PlayerComparisonPage.jsx`
- [Standings table](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/TablePage.jsx): `frontend/src/pages/TablePage.jsx`
- [Statistics](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/pages/StatisticsPage.jsx): `frontend/src/pages/StatisticsPage.jsx`
- [Sample IPL data](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/data/index.js): `frontend/src/data/index.js`
- [Fan chatbot](https://github.com/sannjaay/ipl-llm/blob/master/frontend/src/components/ChatBot.jsx): `frontend/src/components/ChatBot.jsx`

### Match data API

- [Express server](https://github.com/sannjaay/ipl-llm/blob/master/backend/index.js): `backend/index.js`
- [Season match endpoint](https://github.com/sannjaay/ipl-llm/blob/master/backend/routes/matchRoutes.js): `backend/routes/matchRoutes.js`
- [Match model](https://github.com/sannjaay/ipl-llm/blob/master/backend/models/Match.js): `backend/models/Match.js`

### AI commentary

- [Commentary endpoint](https://github.com/sannjaay/ipl-llm/blob/master/backend/routes/ragRoutes.js): `backend/routes/ragRoutes.js`
- [Commentary retrieval and generation](https://github.com/sannjaay/ipl-llm/blob/master/backend/services/ragCommentaryService.js): `backend/services/ragCommentaryService.js`
- **Gemini API**

### Data and ML

- [IPL scraper](https://github.com/sannjaay/ipl-llm/blob/master/ipl-scraper/scraper.js): `ipl-scraper/scraper.js`
- [LLM integration](https://github.com/sannjaay/ipl-llm/blob/master/ml/llmintegration.js): `ml/llmintegration.js`
- [Python RAG](https://github.com/sannjaay/ipl-llm/blob/master/ml/rag/main.py): `ml/rag/main.py`
- [Flask app](https://github.com/sannjaay/ipl-llm/blob/master/backend/app.py): `backend/app.py`
- [Mongo integration](https://github.com/sannjaay/ipl-llm/blob/master/backend/database.py): `backend/database.py`

### Other components

- **IPL fan**

## Connections

- IPL fan → Application router: uses
- Application router → Navigation: renders (evidence: `frontend/src/App.jsx`)
- Application router → Home: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Matches list: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Match details: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Player comparison: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Standings table: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Statistics: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Fan chatbot: opens (evidence: `frontend/src/App.jsx`)
- Matches list → Match card: renders (evidence: `frontend/src/pages/MatchesPage.jsx`)
- Matches list → Match details: uses (evidence: `frontend/src/pages/MatchesPage.jsx`)
- Match details → Commentary view: renders (evidence: `frontend/src/pages/MatchDetails.jsx`)
- Statistics → Sample IPL data: reads (evidence: `frontend/src/pages/StatisticsPage.jsx`)
- Season match endpoint → Match model: queries (evidence: `backend/routes/matchRoutes.js`)
- Commentary endpoint → Commentary retrieval and generation: calls (evidence: `backend/routes/ragRoutes.js`)
- Commentary retrieval and generation → Match model: loads match (evidence: `backend/services/ragCommentaryService.js`)
- Commentary retrieval and generation → Gemini API: generates answer (evidence: `backend/services/ragCommentaryService.js`)
- Express server → Season match endpoint: registers (evidence: `backend/index.js`)
- Express server → Commentary endpoint: registers (evidence: `backend/index.js`)
- Express server → Commentary retrieval and generation: initializes (evidence: `backend/index.js`)
