# bilal2417/cricket-rebirth architecture

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

- Interactive diagram: https://gitdiagram.com/bilal2417/cricket-rebirth
- Repository: https://github.com/bilal2417/cricket-rebirth

## Overview

This is a React cricket game, rather than the generic React/Vite template described by the README. Its main flow is navigation into game modes, selection and match play, then a result screen; it also includes tournaments, profiles, packs, shop and online play. The excerpts show routing, match-state handling, team data, scoreboard imports, and some Supabase and Netlify interactions. Several page and function implementations were not sampled, so their internal calls and some connections are left out.

Main entry points: [`src/App.jsx`](https://github.com/bilal2417/cricket-rebirth/blob/main/src/App.jsx) (App routes), [`src/components/score.jsx`](https://github.com/bilal2417/cricket-rebirth/blob/main/src/components/score.jsx) (Match engine), [`src/supabaseClient.js`](https://github.com/bilal2417/cricket-rebirth/blob/main/src/supabaseClient.js) (Supabase client), [`src/pages/Toss.jsx`](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Toss.jsx) (Toss)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_router["App routes<br/>[App.jsx]"]
  node_home["Home<br/>[Home.jsx]"]
  node_modes["Game modes<br/>[Modes.jsx]"]
end

subgraph group_play["Cricket gameplay"]
  node_selection["Team selection<br/>[Selection.jsx]"]
  node_fixtures["Fixtures<br/>[Fixtures.jsx]"]
  node_tournament["Tournament<br/>[Tournament.jsx]"]
  node_toss["Toss<br/>[Toss.jsx]"]
  node_match["Match engine<br/>[score.jsx]"]
  node_online["Online match<br/>[scoreOnline.jsx]"]
  node_teams["Match team data<br/>[data.jsx]"]
  node_scoreboards["Scoreboard themes"]
  node_result["Match result<br/>[Result.jsx]"]
end

subgraph group_features["Player features"]
  node_profiles["Profile pages<br/>[Profile.jsx]"]
  node_packs["Card packs<br/>[Opening.jsx]"]
  node_shop["Shop<br/>[Shop.jsx]"]
  node_records["Battle log<br/>[Log.jsx]"]
end

subgraph group_backend["Backend services"]
  node_dbclient["Supabase client<br/>[supabaseClient.js]"]
  node_supabase[("Supabase")]
  node_profileapi["Profile functions"]
  node_netlify["Netlify Functions"]
end

node_player(("Player"))

node_player -->|"uses"| node_router
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_modes
node_router -->|"routes to"| node_profiles
node_router -->|"routes to"| node_packs
node_router -->|"routes to"| node_shop
node_router -->|"routes to"| node_tournament
node_router -->|"routes to"| node_records
node_router -->|"imports"| node_match
node_home -->|"uses"| node_dbclient
node_match -->|"loads"| node_teams
node_match -->|"imports themes"| node_scoreboards
node_online -->|"loads"| node_teams
node_online -->|"uses"| node_dbclient
node_toss -->|"uses"| node_dbclient
node_result -->|"uses"| node_dbclient
node_dbclient -->|"connects"| node_supabase
node_router -->|"requests activity"| node_netlify
node_netlify -.->|"dispatches"| node_profileapi
node_selection -.->|"prepares match"| node_fixtures
node_fixtures -.->|"continues to"| node_toss
node_toss -.->|"starts play"| node_match
node_match -.->|"ends at"| node_result

click node_router "https://github.com/bilal2417/cricket-rebirth/blob/main/src/App.jsx"
click node_home "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Home.jsx"
click node_modes "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Modes.jsx"
click node_selection "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Selection.jsx"
click node_fixtures "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Fixtures.jsx"
click node_tournament "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Tournament.jsx"
click node_toss "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Toss.jsx"
click node_match "https://github.com/bilal2417/cricket-rebirth/blob/main/src/components/score.jsx"
click node_online "https://github.com/bilal2417/cricket-rebirth/blob/main/src/components/scoreOnline.jsx"
click node_teams "https://github.com/bilal2417/cricket-rebirth/blob/main/src/components/data.jsx"
click node_scoreboards "https://github.com/bilal2417/cricket-rebirth/tree/main/src/components"
click node_result "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Result.jsx"
click node_profiles "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Profile.jsx"
click node_packs "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Opening.jsx"
click node_shop "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Shop.jsx"
click node_records "https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Log.jsx"
click node_dbclient "https://github.com/bilal2417/cricket-rebirth/blob/main/src/supabaseClient.js"
click node_profileapi "https://github.com/bilal2417/cricket-rebirth/tree/main/netlify/functions"

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_router,node_home,node_modes toneBlue
class node_selection,node_fixtures,node_tournament,node_toss,node_match,node_online,node_teams,node_scoreboards,node_result toneAmber
class node_profiles,node_packs,node_shop,node_records toneMint
class node_dbclient,node_supabase,node_profileapi,node_netlify toneRose
class node_player toneIndigo
```

## Components

### Application

- [App routes](https://github.com/bilal2417/cricket-rebirth/blob/main/src/App.jsx): `src/App.jsx`
- [Home](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Game modes](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Modes.jsx): `src/pages/Modes.jsx`

### Cricket gameplay

- [Team selection](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Selection.jsx): `src/pages/Selection.jsx`
- [Fixtures](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Fixtures.jsx): `src/pages/Fixtures.jsx`
- [Tournament](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Tournament.jsx): `src/pages/Tournament.jsx`
- [Toss](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Toss.jsx): `src/pages/Toss.jsx`
- [Match engine](https://github.com/bilal2417/cricket-rebirth/blob/main/src/components/score.jsx): `src/components/score.jsx`
- [Online match](https://github.com/bilal2417/cricket-rebirth/blob/main/src/components/scoreOnline.jsx): `src/components/scoreOnline.jsx`
- [Match team data](https://github.com/bilal2417/cricket-rebirth/blob/main/src/components/data.jsx): `src/components/data.jsx`
- [Scoreboard themes](https://github.com/bilal2417/cricket-rebirth/tree/main/src/components): `src/components`
- [Match result](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Result.jsx): `src/pages/Result.jsx`

### Player features

- [Profile pages](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Profile.jsx): `src/pages/Profile.jsx`
- [Card packs](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Opening.jsx): `src/pages/Opening.jsx`
- [Shop](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Shop.jsx): `src/pages/Shop.jsx`
- [Battle log](https://github.com/bilal2417/cricket-rebirth/blob/main/src/pages/Log.jsx): `src/pages/Log.jsx`

### Backend services

- [Supabase client](https://github.com/bilal2417/cricket-rebirth/blob/main/src/supabaseClient.js): `src/supabaseClient.js`
- **Supabase**
- [Profile functions](https://github.com/bilal2417/cricket-rebirth/tree/main/netlify/functions): `netlify/functions`
- **Netlify Functions**

### Other components

- **Player**

## Connections

- Player → App routes: uses
- App routes → Home: routes to (evidence: `src/App.jsx`)
- App routes → Game modes: routes to (evidence: `src/App.jsx`)
- App routes → Profile pages: routes to (evidence: `src/App.jsx`)
- App routes → Card packs: routes to (evidence: `src/App.jsx`)
- App routes → Shop: routes to (evidence: `src/App.jsx`)
- App routes → Tournament: routes to (evidence: `src/App.jsx`)
- App routes → Battle log: routes to (evidence: `src/App.jsx`)
- App routes → Match engine: imports (evidence: `src/App.jsx`)
- Home → Supabase client: uses (evidence: `src/pages/Home.jsx`)
- Match engine → Match team data: loads (evidence: `src/components/score.jsx`)
- Match engine → Scoreboard themes: imports themes (evidence: `src/components/score.jsx`)
- Online match → Match team data: loads (evidence: `src/components/scoreOnline.jsx`)
- Online match → Supabase client: uses (evidence: `src/components/scoreOnline.jsx`)
- Toss → Supabase client: uses (evidence: `src/pages/Toss.jsx`)
- Match result → Supabase client: uses (evidence: `src/pages/Result.jsx`)
- Supabase client → Supabase: connects (evidence: `src/supabaseClient.js`)
- App routes → Netlify Functions: requests activity (evidence: `src/App.jsx`)
- Netlify Functions → Profile functions: dispatches
- Team selection → Fixtures: prepares match
- Fixtures → Toss: continues to
- Toss → Match engine: starts play
- Match engine → Match result: ends at
