# jaswanth-komatineni/cricket-insights-ipl architecture

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

- Interactive diagram: https://gitdiagram.com/jaswanth-komatineni/cricket-insights-ipl
- Repository: https://github.com/jaswanth-komatineni/cricket-insights-ipl

## Overview

This is a small IPL statistics web app: users choose a season and statistic, submit the selection, and view matching player results in a table. The browser submits JSON to an Express route, which selects a SQL query and returns PostgreSQL rows; the browser renders them. The README documents four statistic types and season selection. A separate database.js script also connects to PostgreSQL and queries the match table. The graph reflects the shown code and README; styling and static-page delivery are included, but unsampled page details are not inferred.

Main entry points: [`public/main.html`](https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/public/main.html) (Statistics page), [`server.js`](https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/server.js) (Query API and statistic selection), [`public/script.js`](https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/public/script.js) (Season and statistic selection), [`database.js`](https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/database.js) (Standalone database query)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser interface"]
  node_page["Statistics page<br/>[main.html]"]
  node_selection["Season and statistic selection<br/>[script.js]"]
  node_results["Results table rendering<br/>[script.js]"]
  node_styles["Page styling<br/>[styles.css]"]
end

subgraph group_service["Query service"]
  node_route["Query API and statistic selection<br/>[server.js]"]
  node_dbscript["Standalone database query<br/>[database.js]"]
end

subgraph group_storage["Match data"]
  node_postgres[("PostgreSQL match table")]
end

node_user(("User"))

node_user -->|"opens"| node_page
node_user -->|"selects"| node_selection
node_page -->|"loads script"| node_selection
node_selection -->|"posts JSON"| node_route
node_route -->|"queries"| node_postgres
node_route -->|"returns rows"| node_results
node_results -->|"displays table"| node_user
node_page -.->|"uses styles"| node_styles
node_dbscript -->|"queries"| node_postgres

click node_page "https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/public/main.html"
click node_selection "https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/public/script.js"
click node_results "https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/public/script.js"
click node_styles "https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/public/styles.css"
click node_route "https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/server.js"
click node_dbscript "https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/database.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_page,node_selection,node_results,node_styles,node_user toneBlue
class node_route,node_dbscript toneAmber
class node_postgres toneMint
```

## Components

### Browser interface

- [Statistics page](https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/public/main.html): `public/main.html`
- [Season and statistic selection](https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/public/script.js): `public/script.js`
- [Results table rendering](https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/public/script.js): `public/script.js`
- [Page styling](https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/public/styles.css): `public/styles.css`

### Query service

- [Query API and statistic selection](https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/server.js): `server.js`
- [Standalone database query](https://github.com/jaswanth-komatineni/cricket-insights-ipl/blob/main/database.js): `database.js`

### Match data

- **PostgreSQL match table**

### Other components

- **User**

## Connections

- User → Statistics page: opens (evidence: `README.md`)
- User → Season and statistic selection: selects (evidence: `README.md`)
- Statistics page → Season and statistic selection: loads script (evidence: `README.md`)
- Season and statistic selection → Query API and statistic selection: posts JSON (evidence: `public/script.js`)
- Query API and statistic selection → PostgreSQL match table: queries (evidence: `server.js`)
- Query API and statistic selection → Results table rendering: returns rows (evidence: `server.js`)
- Results table rendering → User: displays table (evidence: `public/script.js`)
- Statistics page → Page styling: uses styles
- Standalone database query → PostgreSQL match table: queries (evidence: `database.js`)
