# ganes-ha/turfmasters architecture

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

- Interactive diagram: https://gitdiagram.com/ganes-ha/turfmasters
- Repository: https://github.com/ganes-ha/turfmasters

## Overview

CricVault is a box-cricket scoring and tournament web app. Scorers configure a match, launch innings, record and revise deliveries, and review results; spectators can follow shared live matches. Tournament management, historical match records, analytics, and sharing are distinct supporting workflows. App.tsx is the main stateful controller, coordinating screens and cloud operations. The graph follows README capabilities and source-index references; unsampled implementation details are represented by their exact existing directories, and uncertain connections are omitted.

Main entry points: [`src/App.tsx`](https://github.com/ganes-ha/turfmasters/blob/main/src/App.tsx) (App Controller), [`src/services/firebase.ts`](https://github.com/ganes-ha/turfmasters/blob/main/src/services/firebase.ts) (Cloud Service), [`src/components/TournamentScreen.tsx`](https://github.com/ganes-ha/turfmasters/blob/main/src/components/TournamentScreen.tsx) (Tournament Screen), [`src/components/ScorecardScreen.tsx`](https://github.com/ganes-ha/turfmasters/blob/main/src/components/ScorecardScreen.tsx) (Scorecard & Stats)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_match["Match Scoring"]
  node_app["App Controller<br/>[App.tsx]"]
  node_setup["Match Setup<br/>[SetupScreen.tsx]"]
  node_newmatch["New Match<br/>[NewMatchModal.tsx]"]
  node_innings["Innings Setup"]
  node_live["Live Scoring"]
  node_wicket["Wicket Handling<br/>[WicketModal.tsx]"]
  node_bowler["Bowler Selection"]
  node_rules["Cricket Rules<br/>[cricketRules.ts]"]
  node_squad["Default Squads<br/>[defaultSquad.ts]"]
end

subgraph group_tournament["Tournament Management"]
  node_tournamentui["Tournament Screen"]
  node_tournamentcreate["Tournament Setup"]
  node_tournamentengine["Tournament Engine"]
end

subgraph group_insights["History &amp; Sharing"]
  node_scorecard["Scorecard &amp; Stats"]
  node_history["Match History<br/>[HistoryScreen.tsx]"]
  node_share["Sharing &amp; Posters<br/>[socialGraphics.ts]"]
end

subgraph group_platform["Identity &amp; Cloud"]
  node_auth["Account Access<br/>[AuthModal.tsx]"]
  node_firebase["Cloud Service<br/>[firebase.ts]"]
  node_firestore[("Firebase")]
end

node_scorer(("Scorer"))
node_spectator(("Spectator"))

node_scorer -->|"operates"| node_app
node_spectator -->|"views matches"| node_app
node_app -->|"renders"| node_setup
node_app -->|"renders"| node_newmatch
node_app -->|"renders"| node_innings
node_app -->|"renders"| node_live
node_app -->|"routes"| node_wicket
node_app -->|"routes"| node_bowler
node_app -->|"calculates with"| node_rules
node_app -->|"loads"| node_squad
node_live -->|"uses"| node_rules
node_app -->|"renders"| node_tournamentui
node_app -->|"renders"| node_scorecard
node_app -->|"renders"| node_history
node_app -->|"renders"| node_auth
node_tournamentui -->|"resolves fixtures"| node_tournamentengine
node_tournamentui -->|"opens setup"| node_tournamentcreate
node_tournamentcreate -->|"creates tournament"| node_tournamentengine
node_scorecard -->|"uses analytics"| node_rules
node_scorecard -->|"generates graphics"| node_share
node_auth -->|"registers users"| node_firebase
node_app -->|"syncs matches"| node_firebase
node_app -->|"loads history"| node_firebase
node_app -->|"saves tournaments"| node_firebase
node_firebase -->|"reads and writes"| node_firestore
node_firebase -->|"shares live updates"| node_spectator

click node_app "https://github.com/ganes-ha/turfmasters/blob/main/src/App.tsx"
click node_setup "https://github.com/ganes-ha/turfmasters/blob/main/src/components/SetupScreen.tsx"
click node_newmatch "https://github.com/ganes-ha/turfmasters/blob/main/src/components/NewMatchModal.tsx"
click node_innings "https://github.com/ganes-ha/turfmasters/blob/main/src/components/StartInningsModal.tsx"
click node_live "https://github.com/ganes-ha/turfmasters/blob/main/src/components/LiveScoringScreen.tsx"
click node_wicket "https://github.com/ganes-ha/turfmasters/blob/main/src/components/WicketModal.tsx"
click node_bowler "https://github.com/ganes-ha/turfmasters/blob/main/src/components/ChangeBowlerModal.tsx"
click node_rules "https://github.com/ganes-ha/turfmasters/blob/main/src/utils/cricketRules.ts"
click node_squad "https://github.com/ganes-ha/turfmasters/blob/main/src/data/defaultSquad.ts"
click node_tournamentui "https://github.com/ganes-ha/turfmasters/blob/main/src/components/TournamentScreen.tsx"
click node_tournamentcreate "https://github.com/ganes-ha/turfmasters/blob/main/src/components/CreateTournamentModal.tsx"
click node_tournamentengine "https://github.com/ganes-ha/turfmasters/blob/main/src/utils/tournamentEngine.ts"
click node_scorecard "https://github.com/ganes-ha/turfmasters/blob/main/src/components/ScorecardScreen.tsx"
click node_history "https://github.com/ganes-ha/turfmasters/blob/main/src/components/HistoryScreen.tsx"
click node_share "https://github.com/ganes-ha/turfmasters/blob/main/src/utils/socialGraphics.ts"
click node_auth "https://github.com/ganes-ha/turfmasters/blob/main/src/components/AuthModal.tsx"
click node_firebase "https://github.com/ganes-ha/turfmasters/blob/main/src/services/firebase.ts"

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_setup,node_newmatch,node_innings,node_live,node_wicket,node_bowler,node_rules,node_squad toneBlue
class node_tournamentui,node_tournamentcreate,node_tournamentengine toneAmber
class node_scorecard,node_history,node_share toneMint
class node_auth,node_firebase,node_firestore toneRose
class node_scorer,node_spectator toneIndigo
```

## Components

### Match Scoring

- [App Controller](https://github.com/ganes-ha/turfmasters/blob/main/src/App.tsx): `src/App.tsx`
- [Match Setup](https://github.com/ganes-ha/turfmasters/blob/main/src/components/SetupScreen.tsx): `src/components/SetupScreen.tsx`
- [New Match](https://github.com/ganes-ha/turfmasters/blob/main/src/components/NewMatchModal.tsx): `src/components/NewMatchModal.tsx`
- [Innings Setup](https://github.com/ganes-ha/turfmasters/blob/main/src/components/StartInningsModal.tsx): `src/components/StartInningsModal.tsx`
- [Live Scoring](https://github.com/ganes-ha/turfmasters/blob/main/src/components/LiveScoringScreen.tsx): `src/components/LiveScoringScreen.tsx`
- [Wicket Handling](https://github.com/ganes-ha/turfmasters/blob/main/src/components/WicketModal.tsx): `src/components/WicketModal.tsx`
- [Bowler Selection](https://github.com/ganes-ha/turfmasters/blob/main/src/components/ChangeBowlerModal.tsx): `src/components/ChangeBowlerModal.tsx`
- [Cricket Rules](https://github.com/ganes-ha/turfmasters/blob/main/src/utils/cricketRules.ts): `src/utils/cricketRules.ts`
- [Default Squads](https://github.com/ganes-ha/turfmasters/blob/main/src/data/defaultSquad.ts): `src/data/defaultSquad.ts`

### Tournament Management

- [Tournament Screen](https://github.com/ganes-ha/turfmasters/blob/main/src/components/TournamentScreen.tsx): `src/components/TournamentScreen.tsx`
- [Tournament Setup](https://github.com/ganes-ha/turfmasters/blob/main/src/components/CreateTournamentModal.tsx): `src/components/CreateTournamentModal.tsx`
- [Tournament Engine](https://github.com/ganes-ha/turfmasters/blob/main/src/utils/tournamentEngine.ts): `src/utils/tournamentEngine.ts`

### History & Sharing

- [Scorecard & Stats](https://github.com/ganes-ha/turfmasters/blob/main/src/components/ScorecardScreen.tsx): `src/components/ScorecardScreen.tsx`
- [Match History](https://github.com/ganes-ha/turfmasters/blob/main/src/components/HistoryScreen.tsx): `src/components/HistoryScreen.tsx`
- [Sharing & Posters](https://github.com/ganes-ha/turfmasters/blob/main/src/utils/socialGraphics.ts): `src/utils/socialGraphics.ts`

### Identity & Cloud

- [Account Access](https://github.com/ganes-ha/turfmasters/blob/main/src/components/AuthModal.tsx): `src/components/AuthModal.tsx`
- [Cloud Service](https://github.com/ganes-ha/turfmasters/blob/main/src/services/firebase.ts): `src/services/firebase.ts`
- **Firebase**

### Other components

- **Scorer**
- **Spectator**

## Connections

- Scorer → App Controller: operates (evidence: `README.md`)
- Spectator → App Controller: views matches (evidence: `README.md`)
- App Controller → Match Setup: renders (evidence: `src/App.tsx`)
- App Controller → New Match: renders (evidence: `src/App.tsx`)
- App Controller → Innings Setup: renders (evidence: `src/App.tsx`)
- App Controller → Live Scoring: renders (evidence: `src/App.tsx`)
- App Controller → Wicket Handling: routes (evidence: `src/App.tsx`)
- App Controller → Bowler Selection: routes (evidence: `src/App.tsx`)
- App Controller → Cricket Rules: calculates with (evidence: `src/App.tsx`)
- App Controller → Default Squads: loads (evidence: `src/App.tsx`)
- Live Scoring → Cricket Rules: uses (evidence: `src/components/LiveScoringScreen.tsx`)
- App Controller → Tournament Screen: renders (evidence: `src/App.tsx`)
- App Controller → Scorecard & Stats: renders (evidence: `src/App.tsx`)
- App Controller → Match History: renders (evidence: `src/App.tsx`)
- App Controller → Account Access: renders (evidence: `src/App.tsx`)
- Tournament Screen → Tournament Engine: resolves fixtures (evidence: `src/components/TournamentScreen.tsx`)
- Tournament Screen → Tournament Setup: opens setup (evidence: `src/components/TournamentScreen.tsx`)
- Tournament Setup → Tournament Engine: creates tournament (evidence: `src/components/CreateTournamentModal.tsx`)
- Scorecard & Stats → Cricket Rules: uses analytics (evidence: `src/components/ScorecardScreen.tsx`)
- Scorecard & Stats → Sharing & Posters: generates graphics (evidence: `src/components/ScorecardScreen.tsx`)
- Account Access → Cloud Service: registers users (evidence: `src/components/AuthModal.tsx`)
- App Controller → Cloud Service: syncs matches (evidence: `src/App.tsx`)
- App Controller → Cloud Service: loads history (evidence: `src/App.tsx`)
- App Controller → Cloud Service: saves tournaments (evidence: `src/App.tsx`)
- Cloud Service → Firebase: reads and writes (evidence: `src/services/firebase.ts`)
- Cloud Service → Spectator: shares live updates (evidence: `README.md`)
