# pranav30r/cricket-tournament architecture

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

- Interactive diagram: https://gitdiagram.com/pranav30r/cricket-tournament
- Repository: https://github.com/pranav30r/cricket-tournament

## Overview

This is a cricket tournament management application: users browse tournaments, teams, matches and player statistics; authorized scorers record live ball-by-ball play, with scorecards and live updates as results. The React client calls an Express API backed by SQLite. Tournament/fixture management, scoring, authentication and roles, statistics, administration, reports, search, notifications, and CSV synchronization are represented as distinct capabilities. Several routes and frontend views are unsampled; their presence and some connections are supported by the source index or route registration, not inspected implementation details.

Main entry points: [`backend/server.js`](https://github.com/pranav30r/cricket-tournament/blob/main/backend/server.js) (HTTP server), [`frontend/src/App.jsx`](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/App.jsx) (App routing), [`backend/routes/scoring.js`](https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/scoring.js) (Live scoring), [`backend/config/db.js`](https://github.com/pranav30r/cricket-tournament/blob/main/backend/config/db.js) (SQLite database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App routing<br/>[App.jsx]"]
  node_authui["Authentication UI<br/>[LoginPage.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_tournamentui["Tournament views"]
  node_scoreui["Scoring and scorecards<br/>[ScoringPanel.jsx]"]
  node_playerui["Player profiles<br/>[PlayerProfile.jsx]"]
  node_statsui["Statistics views"]
  node_authstate["Auth context<br/>[AuthContext.jsx]"]
  node_socketstate["Socket context<br/>[SocketContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API and access"]
  node_express["HTTP server<br/>[server.js]"]
  node_authroute["Auth routes<br/>[auth.js]"]
  node_access["Authentication and roles<br/>[auth.js]"]
  node_rbac["Role checks<br/>[rbac.js]"]
  node_other_routes["Supporting routes"]
  node_socketserver["Realtime socket<br/>[socket.js]"]
end

subgraph group_cricket["Cricket operations"]
  node_tournaments["Tournament management<br/>[tournaments.js]"]
  node_teamsplayers["Teams and players<br/>[teams.js]"]
  node_matches["Matches and fixtures<br/>[matches.js]"]
  node_scoring["Live scoring<br/>[scoring.js]"]
  node_stats["Statistics engine<br/>[statsEngine.js]"]
  node_points["Points table<br/>[pointsTable.js]"]
  node_fixtures["Fixture generator"]
end

subgraph group_data["Persistence and outputs"]
  node_database[("SQLite database<br/>[db.js]")]
  node_schema["Domain schema<br/>[schema.js]"]
  node_csv["CSV synchronization<br/>[csvSync.js]"]
  node_reports["Report generation<br/>[reportGenerator.js]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_tournamentui
node_app -->|"routes to"| node_scoreui
node_app -->|"routes to"| node_playerui
node_app -->|"routes to"| node_statsui
node_authui -->|"uses"| node_authstate
node_authstate -->|"calls"| node_api_client
node_dashboard -->|"calls"| node_api_client
node_tournamentui -->|"calls"| node_api_client
node_scoreui -->|"calls"| node_api_client
node_scoreui -->|"subscribes"| node_socketstate
node_playerui -->|"calls"| node_api_client
node_statsui -.->|"calls"| node_api_client
node_api_client -->|"HTTP requests"| node_express
node_express -->|"mounts"| node_authroute
node_express -->|"mounts"| node_tournaments
node_express -->|"mounts"| node_teamsplayers
node_express -->|"mounts"| node_matches
node_express -->|"mounts"| node_scoring
node_express -->|"mounts"| node_other_routes
node_express -->|"sets up"| node_socketserver
node_authroute -->|"uses"| node_access
node_authroute -->|"queries"| node_database
node_matches -->|"uses"| node_access
node_matches -->|"checks roles"| node_rbac
node_matches -->|"generates fixtures"| node_fixtures
node_matches -->|"queries"| node_database
node_scoring -->|"uses"| node_access
node_scoring -->|"checks roles"| node_rbac
node_scoring -->|"updates"| node_points
node_scoring -->|"uses"| node_fixtures
node_scoring -->|"emits updates"| node_socketserver
node_scoring -->|"writes"| node_database
node_tournaments -->|"uses"| node_stats
node_tournaments -->|"uses"| node_points
node_tournaments -->|"queries"| node_database
node_teamsplayers -->|"uses"| node_stats
node_teamsplayers -->|"queries"| node_database
node_stats -->|"queries"| node_database
node_schema -->|"initializes"| node_database
node_express -->|"initializes"| node_schema
node_express -->|"runs initial sync"| node_csv
node_csv -->|"reads"| node_database
node_other_routes -.->|"may invoke"| node_reports

click node_app "https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/auth/LoginPage.jsx"
click node_dashboard "https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/dashboard/Dashboard.jsx"
click node_tournamentui "https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/tournaments/TournamentDetails.jsx"
click node_scoreui "https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/scoring/ScoringPanel.jsx"
click node_playerui "https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/players/PlayerProfile.jsx"
click node_statsui "https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/tournaments/StatsLeaderboard.jsx"
click node_authstate "https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/contexts/AuthContext.jsx"
click node_socketstate "https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/contexts/SocketContext.jsx"
click node_api_client "https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/services/api.js"
click node_express "https://github.com/pranav30r/cricket-tournament/blob/main/backend/server.js"
click node_authroute "https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/auth.js"
click node_access "https://github.com/pranav30r/cricket-tournament/blob/main/backend/middleware/auth.js"
click node_rbac "https://github.com/pranav30r/cricket-tournament/blob/main/backend/middleware/rbac.js"
click node_tournaments "https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/tournaments.js"
click node_teamsplayers "https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/teams.js"
click node_matches "https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/matches.js"
click node_scoring "https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/scoring.js"
click node_stats "https://github.com/pranav30r/cricket-tournament/blob/main/backend/services/statsEngine.js"
click node_points "https://github.com/pranav30r/cricket-tournament/blob/main/backend/services/pointsTable.js"
click node_fixtures "https://github.com/pranav30r/cricket-tournament/blob/main/backend/services/fixtureGenerator.js"
click node_other_routes "https://github.com/pranav30r/cricket-tournament/tree/main/backend/routes"
click node_socketserver "https://github.com/pranav30r/cricket-tournament/blob/main/backend/config/socket.js"
click node_database "https://github.com/pranav30r/cricket-tournament/blob/main/backend/config/db.js"
click node_schema "https://github.com/pranav30r/cricket-tournament/blob/main/backend/models/schema.js"
click node_csv "https://github.com/pranav30r/cricket-tournament/blob/main/backend/services/csvSync.js"
click node_reports "https://github.com/pranav30r/cricket-tournament/blob/main/backend/services/reportGenerator.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_authui,node_dashboard,node_tournamentui,node_scoreui,node_playerui,node_statsui,node_authstate,node_socketstate,node_api_client,node_user toneBlue
class node_express,node_authroute,node_access,node_rbac,node_other_routes,node_socketserver toneAmber
class node_tournaments,node_teamsplayers,node_matches,node_scoring,node_stats,node_points,node_fixtures toneMint
class node_database,node_schema,node_csv,node_reports toneRose
```

## Components

### Web client

- [App routing](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication UI](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/auth/LoginPage.jsx): `frontend/src/components/auth/LoginPage.jsx`
- [Dashboard](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/dashboard/Dashboard.jsx): `frontend/src/components/dashboard/Dashboard.jsx`
- [Tournament views](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/tournaments/TournamentDetails.jsx): `frontend/src/components/tournaments/TournamentDetails.jsx`
- [Scoring and scorecards](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/scoring/ScoringPanel.jsx): `frontend/src/components/scoring/ScoringPanel.jsx`
- [Player profiles](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/players/PlayerProfile.jsx): `frontend/src/components/players/PlayerProfile.jsx`
- [Statistics views](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/components/tournaments/StatsLeaderboard.jsx): `frontend/src/components/tournaments/StatsLeaderboard.jsx`
- [Auth context](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/contexts/AuthContext.jsx): `frontend/src/contexts/AuthContext.jsx`
- [Socket context](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/contexts/SocketContext.jsx): `frontend/src/contexts/SocketContext.jsx`
- [API client](https://github.com/pranav30r/cricket-tournament/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API and access

- [HTTP server](https://github.com/pranav30r/cricket-tournament/blob/main/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Authentication and roles](https://github.com/pranav30r/cricket-tournament/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Role checks](https://github.com/pranav30r/cricket-tournament/blob/main/backend/middleware/rbac.js): `backend/middleware/rbac.js`
- [Supporting routes](https://github.com/pranav30r/cricket-tournament/tree/main/backend/routes): `backend/routes`
- [Realtime socket](https://github.com/pranav30r/cricket-tournament/blob/main/backend/config/socket.js): `backend/config/socket.js`

### Cricket operations

- [Tournament management](https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/tournaments.js): `backend/routes/tournaments.js`
- [Teams and players](https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/teams.js): `backend/routes/teams.js`
- [Matches and fixtures](https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/matches.js): `backend/routes/matches.js`
- [Live scoring](https://github.com/pranav30r/cricket-tournament/blob/main/backend/routes/scoring.js): `backend/routes/scoring.js`
- [Statistics engine](https://github.com/pranav30r/cricket-tournament/blob/main/backend/services/statsEngine.js): `backend/services/statsEngine.js`
- [Points table](https://github.com/pranav30r/cricket-tournament/blob/main/backend/services/pointsTable.js): `backend/services/pointsTable.js`
- [Fixture generator](https://github.com/pranav30r/cricket-tournament/blob/main/backend/services/fixtureGenerator.js): `backend/services/fixtureGenerator.js`

### Persistence and outputs

- [SQLite database](https://github.com/pranav30r/cricket-tournament/blob/main/backend/config/db.js): `backend/config/db.js`
- [Domain schema](https://github.com/pranav30r/cricket-tournament/blob/main/backend/models/schema.js): `backend/models/schema.js`
- [CSV synchronization](https://github.com/pranav30r/cricket-tournament/blob/main/backend/services/csvSync.js): `backend/services/csvSync.js`
- [Report generation](https://github.com/pranav30r/cricket-tournament/blob/main/backend/services/reportGenerator.js): `backend/services/reportGenerator.js`

### Other components

- **User**

## Connections

- User → App routing: uses
- App routing → Authentication UI: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Tournament views: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Scoring and scorecards: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Player profiles: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Statistics views: routes to (evidence: `frontend/src/App.jsx`)
- Authentication UI → Auth context: uses (evidence: `frontend/src/components/auth/LoginPage.jsx`)
- Auth context → API client: calls (evidence: `frontend/src/contexts/AuthContext.jsx`)
- Dashboard → API client: calls (evidence: `frontend/src/components/dashboard/Dashboard.jsx`)
- Tournament views → API client: calls (evidence: `frontend/src/components/tournaments/TournamentDetails.jsx`)
- Scoring and scorecards → API client: calls (evidence: `frontend/src/components/scoring/ScoringPanel.jsx`)
- Scoring and scorecards → Socket context: subscribes (evidence: `frontend/src/contexts/SocketContext.jsx`)
- Player profiles → API client: calls (evidence: `frontend/src/components/players/PlayerProfile.jsx`)
- Statistics views → API client: calls
- API client → HTTP server: HTTP requests (evidence: `frontend/src/services/api.js`)
- HTTP server → Auth routes: mounts (evidence: `backend/server.js`)
- HTTP server → Tournament management: mounts (evidence: `backend/server.js`)
- HTTP server → Teams and players: mounts (evidence: `backend/server.js`)
- HTTP server → Matches and fixtures: mounts (evidence: `backend/server.js`)
- HTTP server → Live scoring: mounts (evidence: `backend/server.js`)
- HTTP server → Supporting routes: mounts (evidence: `backend/server.js`)
- HTTP server → Realtime socket: sets up (evidence: `backend/server.js`)
- Auth routes → Authentication and roles: uses (evidence: `backend/routes/auth.js`)
- Auth routes → SQLite database: queries (evidence: `backend/routes/auth.js`)
- Matches and fixtures → Authentication and roles: uses (evidence: `backend/routes/matches.js`)
- Matches and fixtures → Role checks: checks roles (evidence: `backend/routes/matches.js`)
- Matches and fixtures → Fixture generator: generates fixtures (evidence: `backend/routes/matches.js`)
- Matches and fixtures → SQLite database: queries (evidence: `backend/routes/matches.js`)
- Live scoring → Authentication and roles: uses (evidence: `backend/routes/scoring.js`)
- Live scoring → Role checks: checks roles (evidence: `backend/routes/scoring.js`)
- Live scoring → Points table: updates (evidence: `backend/routes/scoring.js`)
- Live scoring → Fixture generator: uses (evidence: `backend/routes/scoring.js`)
- Live scoring → Realtime socket: emits updates (evidence: `backend/routes/scoring.js`)
- Live scoring → SQLite database: writes (evidence: `backend/routes/scoring.js`)
- Tournament management → Statistics engine: uses (evidence: `backend/routes/tournaments.js`)
- Tournament management → Points table: uses (evidence: `backend/routes/tournaments.js`)
- Tournament management → SQLite database: queries (evidence: `backend/routes/tournaments.js`)
- Teams and players → Statistics engine: uses (evidence: `backend/routes/teams.js`)
- Teams and players → SQLite database: queries (evidence: `backend/routes/teams.js`)
- Statistics engine → SQLite database: queries (evidence: `backend/services/statsEngine.js`)
- Domain schema → SQLite database: initializes (evidence: `backend/server.js`)
- HTTP server → Domain schema: initializes (evidence: `backend/server.js`)
- HTTP server → CSV synchronization: runs initial sync (evidence: `backend/server.js`)
- CSV synchronization → SQLite database: reads (evidence: `backend/services/csvSync.js`)
- Supporting routes → Report generation: may invoke
