# ericpraveen/cricketscore architecture

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

- Interactive diagram: https://gitdiagram.com/ericpraveen/cricketscore
- Repository: https://github.com/ericpraveen/cricketscore

## Overview

This is an Expo-based cricket match scoring and tracking app. The visible workflow starts from the match list, proceeds through match setup and toss into live ball-by-ball scoring, then presents scorecards, analysis and PDF export; match history remains available from the home experience. SQLite queries provide persistence, while cricket-statistics utilities derive summaries used by screens and analysis. Several screen implementations were not excerpted, so their domain roles are represented, but unshown navigation and data-flow links are omitted.

Main entry points: [`db/queries.ts`](https://github.com/ericpraveen/cricketscore/blob/main/db/queries.ts) (Match queries), [`utils/cricketStats.ts`](https://github.com/ericpraveen/cricketscore/blob/main/utils/cricketStats.ts) (Cricket statistics), [`app/scorecard.tsx`](https://github.com/ericpraveen/cricketscore/blob/main/app/scorecard.tsx) (Match scorecard), [`app/index.tsx`](https://github.com/ericpraveen/cricketscore/blob/main/app/index.tsx) (Match home)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_match_flow["Match workflow"]
  node_home["Match home<br/>[index.tsx]"]
  node_setup["Match setup<br/>[setup.tsx]"]
  node_toss["Toss selection<br/>[toss.tsx]"]
  node_scoring["Live scoring<br/>[scoring.tsx]"]
  node_celebration["Score celebration"]
end

subgraph group_match_views["Match views"]
  node_history["Match history<br/>[history.tsx]"]
  node_scorecard["Match scorecard<br/>[scorecard.tsx]"]
  node_charts["Match charts<br/>[MatchCharts.tsx]"]
  node_pdf["Scorecard PDF<br/>[scorecardPdf.ts]"]
end

subgraph group_cricket_logic["Cricket logic"]
  node_stats["Cricket statistics<br/>[cricketStats.ts]"]
end

subgraph group_persistence["Persistence"]
  node_queries["Match queries<br/>[queries.ts]"]
  node_database[("SQLite database<br/>[database.ts]")]
end

node_user(("Cricket user"))

node_user -->|"opens app"| node_home
node_home -->|"opens setup"| node_setup
node_home -->|"loads and deletes"| node_queries
node_setup -->|"match data"| node_queries
node_toss -->|"match data"| node_queries
node_scoring -->|"score data"| node_queries
node_scoring -->|"renders"| node_celebration
node_history -->|"match records"| node_queries
node_history -->|"derives summaries"| node_stats
node_scorecard -->|"match data"| node_queries
node_scorecard -->|"derives statistics"| node_stats
node_scorecard -->|"renders analysis"| node_charts
node_scorecard -->|"exports scorecard"| node_pdf
node_charts -->|"uses summaries"| node_stats
node_stats -->|"reads match data"| node_queries
node_pdf -->|"uses match types"| node_queries
node_pdf -->|"uses analysis types"| node_stats
node_queries -->|"executes queries"| node_database

click node_home "https://github.com/ericpraveen/cricketscore/blob/main/app/index.tsx"
click node_setup "https://github.com/ericpraveen/cricketscore/blob/main/app/setup.tsx"
click node_toss "https://github.com/ericpraveen/cricketscore/blob/main/app/toss.tsx"
click node_scoring "https://github.com/ericpraveen/cricketscore/blob/main/app/scoring.tsx"
click node_celebration "https://github.com/ericpraveen/cricketscore/blob/main/components/CelebrationOverlay.tsx"
click node_history "https://github.com/ericpraveen/cricketscore/blob/main/app/history.tsx"
click node_scorecard "https://github.com/ericpraveen/cricketscore/blob/main/app/scorecard.tsx"
click node_charts "https://github.com/ericpraveen/cricketscore/blob/main/components/MatchCharts.tsx"
click node_pdf "https://github.com/ericpraveen/cricketscore/blob/main/utils/scorecardPdf.ts"
click node_stats "https://github.com/ericpraveen/cricketscore/blob/main/utils/cricketStats.ts"
click node_queries "https://github.com/ericpraveen/cricketscore/blob/main/db/queries.ts"
click node_database "https://github.com/ericpraveen/cricketscore/blob/main/db/database.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_home,node_setup,node_toss,node_scoring,node_celebration,node_user toneBlue
class node_history,node_scorecard,node_charts,node_pdf toneAmber
class node_stats toneMint
class node_queries,node_database toneRose
```

## Components

### Match workflow

- [Match home](https://github.com/ericpraveen/cricketscore/blob/main/app/index.tsx): `app/index.tsx`
- [Match setup](https://github.com/ericpraveen/cricketscore/blob/main/app/setup.tsx): `app/setup.tsx`
- [Toss selection](https://github.com/ericpraveen/cricketscore/blob/main/app/toss.tsx): `app/toss.tsx`
- [Live scoring](https://github.com/ericpraveen/cricketscore/blob/main/app/scoring.tsx): `app/scoring.tsx`
- [Score celebration](https://github.com/ericpraveen/cricketscore/blob/main/components/CelebrationOverlay.tsx): `components/CelebrationOverlay.tsx`

### Match views

- [Match history](https://github.com/ericpraveen/cricketscore/blob/main/app/history.tsx): `app/history.tsx`
- [Match scorecard](https://github.com/ericpraveen/cricketscore/blob/main/app/scorecard.tsx): `app/scorecard.tsx`
- [Match charts](https://github.com/ericpraveen/cricketscore/blob/main/components/MatchCharts.tsx): `components/MatchCharts.tsx`
- [Scorecard PDF](https://github.com/ericpraveen/cricketscore/blob/main/utils/scorecardPdf.ts): `utils/scorecardPdf.ts`

### Cricket logic

- [Cricket statistics](https://github.com/ericpraveen/cricketscore/blob/main/utils/cricketStats.ts): `utils/cricketStats.ts`

### Persistence

- [Match queries](https://github.com/ericpraveen/cricketscore/blob/main/db/queries.ts): `db/queries.ts`
- [SQLite database](https://github.com/ericpraveen/cricketscore/blob/main/db/database.ts): `db/database.ts`

### Other components

- **Cricket user**

## Connections

- Cricket user → Match home: opens app
- Match home → Match setup: opens setup (evidence: `app/index.tsx`)
- Match home → Match queries: loads and deletes (evidence: `app/index.tsx`)
- Match setup → Match queries: match data (evidence: `app/setup.tsx`)
- Toss selection → Match queries: match data (evidence: `app/toss.tsx`)
- Live scoring → Match queries: score data (evidence: `app/scoring.tsx`)
- Live scoring → Score celebration: renders (evidence: `app/scoring.tsx`)
- Match history → Match queries: match records (evidence: `app/history.tsx`)
- Match history → Cricket statistics: derives summaries (evidence: `app/history.tsx`)
- Match scorecard → Match queries: match data (evidence: `app/scorecard.tsx`)
- Match scorecard → Cricket statistics: derives statistics (evidence: `app/scorecard.tsx`)
- Match scorecard → Match charts: renders analysis (evidence: `app/scorecard.tsx`)
- Match scorecard → Scorecard PDF: exports scorecard (evidence: `app/scorecard.tsx`)
- Match charts → Cricket statistics: uses summaries (evidence: `components/MatchCharts.tsx`)
- Cricket statistics → Match queries: reads match data (evidence: `utils/cricketStats.ts`)
- Scorecard PDF → Match queries: uses match types (evidence: `utils/scorecardPdf.ts`)
- Scorecard PDF → Cricket statistics: uses analysis types (evidence: `utils/scorecardPdf.ts`)
- Match queries → SQLite database: executes queries (evidence: `db/queries.ts`)
