# krishna752006/ipl-prediction-system architecture

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

- Interactive diagram: https://gitdiagram.com/krishna752006/ipl-prediction-system
- Repository: https://github.com/krishna752006/ipl-prediction-system

## Overview

IPL Project is a full-stack IPL analysis and match-prediction application. Users register or log in, then access protected prediction, schedule, points-table, history, statistics, and team-analysis views. The backend’s documented ball-by-ball simulator builds match context and features, blends model predictions with heuristics, and returns innings results; authentication and prediction history use MongoDB. Separately, the repository includes an ML inference service and an offline data-preparation pipeline. Frontend page capabilities are documented by routes and filenames, but their detailed data wiring was not sampled.

Main entry points: [`frontend/src/App.tsx`](https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/App.tsx) (Web routes), [`backend/services/match_engine.py`](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/match_engine.py) (Match simulator), [`frontend/src/api/authApi.ts`](https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/api/authApi.ts) (API client), [`data-service/run_pipeline.py`](https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/run_pipeline.py) (Data pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Web routes<br/>[App.tsx]"]
  node_authpages["Login and register<br/>[Login.tsx]"]
  node_predpage["Predictions<br/>[Predictions.tsx]"]
  node_analysispages["Analysis views<br/>[Statistics.tsx]"]
  node_schedule["Schedule and table<br/>[Schedule.tsx]"]
  node_historypage["Prediction history"]
  node_authstore["Auth state<br/>[authStore.ts]"]
  node_authapi["API client<br/>[authApi.ts]"]
end

subgraph group_api["Application backend"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_predictapi["Prediction endpoint<br/>[predict.py]"]
  node_historyapi["History endpoint"]
  node_simulator["Match simulator<br/>[match_engine.py]"]
  node_features["Ball features<br/>[feature_builder.py]"]
  node_embeddings["Match embeddings<br/>[embeddings.py]"]
  node_form["Historical form<br/>[historical_form.py]"]
  node_bowler["Bowler selection<br/>[bowler_selector.py]"]
  node_runner["Model runner<br/>[model_runner.py]"]
  node_db[("MongoDB<br/>[database.py]")]
end

subgraph group_ml["Model inference"]
  node_mlroutes["ML prediction route<br/>[routes.py]"]
  node_inference["Prediction inference<br/>[inference.py]"]
  node_loader["Model loading<br/>[model_loader.py]"]
  node_bundle["Model bundle<br/>[model_bundle.py]"]
end

subgraph group_data["Data preparation"]
  node_pipeline["Data pipeline<br/>[run_pipeline.py]"]
  node_cleanmatches["Clean matches<br/>[clean_matches.py]"]
  node_cleandeliveries["Clean deliveries"]
  node_offlinestats["Offline statistics"]
  node_buildfeatures["Build features<br/>[build_features.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_authpages
node_webapp -->|"routes to"| node_predpage
node_webapp -->|"routes to"| node_analysispages
node_webapp -->|"routes to"| node_schedule
node_webapp -->|"routes to"| node_historypage
node_authpages -->|"sends requests"| node_authapi
node_authapi -->|"reads token"| node_authstore
node_predpage -->|"uses client"| node_authapi
node_historypage -->|"uses client"| node_authapi
node_authapi -->|"HTTP requests"| node_backend
node_backend -->|"mounts router"| node_predictapi
node_backend -->|"mounts router"| node_historyapi
node_backend -->|"reads and writes users"| node_db
node_predictapi -->|"runs simulation"| node_simulator
node_historyapi -->|"reads and writes history"| node_db
node_simulator -->|"builds features"| node_features
node_simulator -->|"builds context"| node_embeddings
node_simulator -->|"gets player form"| node_form
node_simulator -->|"selects bowler"| node_bowler
node_simulator -->|"predicts balls"| node_runner
node_mlroutes -->|"runs prediction"| node_inference
node_inference -->|"loads model"| node_loader
node_loader -->|"loads bundle"| node_bundle
node_pipeline -->|"cleans matches"| node_cleanmatches
node_pipeline -->|"cleans deliveries"| node_cleandeliveries
node_pipeline -->|"generates stats"| node_offlinestats
node_pipeline -->|"builds features"| node_buildfeatures

click node_webapp "https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/App.tsx"
click node_authpages "https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/pages/Login.tsx"
click node_predpage "https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/pages/Predictions.tsx"
click node_analysispages "https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/pages/Statistics.tsx"
click node_schedule "https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/pages/Schedule.tsx"
click node_historypage "https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/pages/PredictionHistory.tsx"
click node_authstore "https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/store/authStore.ts"
click node_authapi "https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/api/authApi.ts"
click node_backend "https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/main.py"
click node_predictapi "https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/routers/predict.py"
click node_historyapi "https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/routers/prediction_history.py"
click node_simulator "https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/match_engine.py"
click node_features "https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/feature_builder.py"
click node_embeddings "https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/embeddings.py"
click node_form "https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/historical_form.py"
click node_bowler "https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/bowler_selector.py"
click node_runner "https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/model_runner.py"
click node_db "https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/database.py"
click node_mlroutes "https://github.com/krishna752006/ipl-prediction-system/blob/main/ml-service/app/routes.py"
click node_inference "https://github.com/krishna752006/ipl-prediction-system/blob/main/ml-service/app/inference.py"
click node_loader "https://github.com/krishna752006/ipl-prediction-system/blob/main/ml-service/core/model_loader.py"
click node_bundle "https://github.com/krishna752006/ipl-prediction-system/blob/main/ml-service/core/model_bundle.py"
click node_pipeline "https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/run_pipeline.py"
click node_cleanmatches "https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/pipeline/clean_matches.py"
click node_cleandeliveries "https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/pipeline/clean_deliveries.py"
click node_offlinestats "https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/pipeline/generate_offline_stats.py"
click node_buildfeatures "https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/pipeline/build_features.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_webapp,node_authpages,node_predpage,node_analysispages,node_schedule,node_historypage,node_authstore,node_authapi,node_user toneBlue
class node_backend,node_predictapi,node_historyapi,node_simulator,node_features,node_embeddings,node_form,node_bowler,node_runner,node_db toneAmber
class node_mlroutes,node_inference,node_loader,node_bundle toneMint
class node_pipeline,node_cleanmatches,node_cleandeliveries,node_offlinestats,node_buildfeatures toneRose
```

## Components

### Web application

- [Web routes](https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login and register](https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/pages/Login.tsx): `frontend/src/pages/Login.tsx`
- [Predictions](https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/pages/Predictions.tsx): `frontend/src/pages/Predictions.tsx`
- [Analysis views](https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/pages/Statistics.tsx): `frontend/src/pages/Statistics.tsx`
- [Schedule and table](https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/pages/Schedule.tsx): `frontend/src/pages/Schedule.tsx`
- [Prediction history](https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/pages/PredictionHistory.tsx): `frontend/src/pages/PredictionHistory.tsx`
- [Auth state](https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/store/authStore.ts): `frontend/src/store/authStore.ts`
- [API client](https://github.com/krishna752006/ipl-prediction-system/blob/main/frontend/src/api/authApi.ts): `frontend/src/api/authApi.ts`

### Application backend

- [FastAPI application](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/main.py): `backend/main.py`
- [Prediction endpoint](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/routers/predict.py): `backend/routers/predict.py`
- [History endpoint](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/routers/prediction_history.py): `backend/routers/prediction_history.py`
- [Match simulator](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/match_engine.py): `backend/services/match_engine.py`
- [Ball features](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/feature_builder.py): `backend/services/feature_builder.py`
- [Match embeddings](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/embeddings.py): `backend/services/embeddings.py`
- [Historical form](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/historical_form.py): `backend/services/historical_form.py`
- [Bowler selection](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/bowler_selector.py): `backend/services/bowler_selector.py`
- [Model runner](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/services/model_runner.py): `backend/services/model_runner.py`
- [MongoDB](https://github.com/krishna752006/ipl-prediction-system/blob/main/backend/database.py): `backend/database.py`

### Model inference

- [ML prediction route](https://github.com/krishna752006/ipl-prediction-system/blob/main/ml-service/app/routes.py): `ml-service/app/routes.py`
- [Prediction inference](https://github.com/krishna752006/ipl-prediction-system/blob/main/ml-service/app/inference.py): `ml-service/app/inference.py`
- [Model loading](https://github.com/krishna752006/ipl-prediction-system/blob/main/ml-service/core/model_loader.py): `ml-service/core/model_loader.py`
- [Model bundle](https://github.com/krishna752006/ipl-prediction-system/blob/main/ml-service/core/model_bundle.py): `ml-service/core/model_bundle.py`

### Data preparation

- [Data pipeline](https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/run_pipeline.py): `data-service/run_pipeline.py`
- [Clean matches](https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/pipeline/clean_matches.py): `data-service/pipeline/clean_matches.py`
- [Clean deliveries](https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/pipeline/clean_deliveries.py): `data-service/pipeline/clean_deliveries.py`
- [Offline statistics](https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/pipeline/generate_offline_stats.py): `data-service/pipeline/generate_offline_stats.py`
- [Build features](https://github.com/krishna752006/ipl-prediction-system/blob/main/data-service/pipeline/build_features.py): `data-service/pipeline/build_features.py`

### Other components

- **User**

## Connections

- User → Web routes: uses
- Web routes → Login and register: routes to
- Web routes → Predictions: routes to
- Web routes → Analysis views: routes to
- Web routes → Schedule and table: routes to
- Web routes → Prediction history: routes to
- Login and register → API client: sends requests
- API client → Auth state: reads token
- Predictions → API client: uses client
- Prediction history → API client: uses client
- API client → FastAPI application: HTTP requests
- FastAPI application → Prediction endpoint: mounts router
- FastAPI application → History endpoint: mounts router
- FastAPI application → MongoDB: reads and writes users
- Prediction endpoint → Match simulator: runs simulation
- History endpoint → MongoDB: reads and writes history
- Match simulator → Ball features: builds features
- Match simulator → Match embeddings: builds context
- Match simulator → Historical form: gets player form
- Match simulator → Bowler selection: selects bowler
- Match simulator → Model runner: predicts balls
- ML prediction route → Prediction inference: runs prediction
- Prediction inference → Model loading: loads model
- Model loading → Model bundle: loads bundle
- Data pipeline → Clean matches: cleans matches
- Data pipeline → Clean deliveries: cleans deliveries
- Data pipeline → Offline statistics: generates stats
- Data pipeline → Build features: builds features
