# abhishek6353/gitwicket architecture

> Architecture diagram of the GitHub repository abhishek6353/gitwicket, 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/abhishek6353/gitwicket
- Repository: https://github.com/abhishek6353/gitwicket

## Overview

GitWicket turns a submitted GitHub username into a rated cricket card and scouting report: the landing flow validates and routes the username, the player view fetches profile data, the API obtains and caches GitHub stats, and the rating engine derives attributes, role, and tier for presentation. Sharing, image endpoints, leaderboard, and analytics/counting are additional product capabilities. Relationships are limited to README statements and source-index references or shown calls; unsampled image and leaderboard internals are not inferred.

Main entry points: [`features/player-detail/components/player-detail-view.tsx`](https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/components/player-detail-view.tsx) (Scouting report view), [`app/api/github/[username]/route.ts`](https://github.com/abhishek6353/gitwicket/blob/main/app/api/github/%5Busername%5D/route.ts) (Profile API), [`features/player-detail/components/player-page-client.tsx`](https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/components/player-page-client.tsx) (Player data client), [`features/landing/components/landing-hero.tsx`](https://github.com/abhishek6353/gitwicket/blob/main/features/landing/components/landing-hero.tsx) (Landing scout form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Discovery and Entry"]
  node_landing["Landing scout form<br/>[landing-hero.tsx]"]
  node_player_route["Player detail route<br/>[page.tsx]"]
end

subgraph group_profile["Profile and Scoring"]
  node_profile_api["Profile API<br/>[route.ts]"]
  node_github_service["GitHub profile service<br/>[profile.ts]"]
  node_rating_engine["Rating engine<br/>[engine.ts]"]
  node_player_detail_data["Detail data builder"]
end

subgraph group_presentation["Player Experience"]
  node_player_client["Player data client"]
  node_detail_view["Scouting report view"]
  node_cricket_card["Cricket player card"]
  node_attribute_panel["Attribute panel"]
  node_playstyle_panel["Playstyle panel"]
  node_report_format["Report formatting<br/>[report-format.ts]"]
end

subgraph group_sharing["Sharing and Images"]
  node_image_api["Card image endpoint<br/>[route.tsx]"]
  node_og_api["Social preview endpoint<br/>[route.tsx]"]
  node_share_actions["Share and download actions<br/>[share-actions.tsx]"]
  node_card_image["Card image renderer"]
  node_og_renderer["OG image renderer"]
end

subgraph group_state["Persistence and Metrics"]
  node_firestore[("Firestore")]
  node_leaderboard["Leaderboard page<br/>[page.tsx]"]
  node_analytics["Analytics events<br/>[analytics.ts]"]
end

node_visitor(("GitWicket visitor"))
node_github_provider{{"GitHub GraphQL API"}}

node_visitor -->|"enters username"| node_landing
node_landing -->|"routes to"| node_player_route
node_player_route -->|"renders"| node_player_client
node_player_client -->|"fetches profile"| node_profile_api
node_profile_api -->|"requests profile"| node_github_service
node_github_service -.->|"queries profile"| node_github_provider
node_profile_api -->|"reads and writes"| node_firestore
node_profile_api -->|"scores profile"| node_rating_engine
node_player_client -->|"scores fetched stats"| node_rating_engine
node_player_client -->|"renders report"| node_detail_view
node_detail_view -->|"renders card"| node_cricket_card
node_detail_view -->|"renders attributes"| node_attribute_panel
node_detail_view -->|"renders playstyles"| node_playstyle_panel
node_detail_view -->|"formats report"| node_report_format
node_player_route -->|"loads detail data"| node_player_detail_data
node_visitor -.->|"uses sharing"| node_share_actions
node_detail_view -->|"shows actions"| node_share_actions
node_image_api -->|"creates image"| node_card_image
node_og_api -->|"renders preview"| node_og_renderer
node_landing -->|"reads scout count"| node_firestore
node_profile_api -->|"updates leaderboard data"| node_leaderboard
node_landing -->|"logs search"| node_analytics
node_player_client -->|"logs card events"| node_analytics

click node_landing "https://github.com/abhishek6353/gitwicket/blob/main/features/landing/components/landing-hero.tsx"
click node_player_route "https://github.com/abhishek6353/gitwicket/blob/main/app/players/%5Busername%5D/page.tsx"
click node_player_client "https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/components/player-page-client.tsx"
click node_profile_api "https://github.com/abhishek6353/gitwicket/blob/main/app/api/github/%5Busername%5D/route.ts"
click node_github_service "https://github.com/abhishek6353/gitwicket/blob/main/services/github/profile.ts"
click node_rating_engine "https://github.com/abhishek6353/gitwicket/blob/main/features/rating-engine/engine.ts"
click node_player_detail_data "https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/lib/player-detail-data.ts"
click node_detail_view "https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/components/player-detail-view.tsx"
click node_cricket_card "https://github.com/abhishek6353/gitwicket/blob/main/features/cards/components/cricket-player-card.tsx"
click node_attribute_panel "https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/components/attributes-panel.tsx"
click node_playstyle_panel "https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/components/playstyles-panel.tsx"
click node_report_format "https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/lib/report-format.ts"
click node_image_api "https://github.com/abhishek6353/gitwicket/blob/main/app/api/card/%5Busername%5D/image/route.tsx"
click node_og_api "https://github.com/abhishek6353/gitwicket/blob/main/app/api/og/%5Busername%5D/route.tsx"
click node_share_actions "https://github.com/abhishek6353/gitwicket/blob/main/features/image-generation/components/share-actions.tsx"
click node_card_image "https://github.com/abhishek6353/gitwicket/blob/main/features/image-generation/lib/card-image-response.tsx"
click node_og_renderer "https://github.com/abhishek6353/gitwicket/blob/main/features/image-generation/lib/og-image-response.tsx"
click node_leaderboard "https://github.com/abhishek6353/gitwicket/blob/main/app/leaderboard/page.tsx"
click node_analytics "https://github.com/abhishek6353/gitwicket/blob/main/lib/config/analytics.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_landing,node_player_route toneBlue
class node_profile_api,node_github_service,node_rating_engine,node_player_detail_data toneAmber
class node_player_client,node_detail_view,node_cricket_card,node_attribute_panel,node_playstyle_panel,node_report_format,node_github_provider toneMint
class node_image_api,node_og_api,node_share_actions,node_card_image,node_og_renderer toneRose
class node_firestore,node_leaderboard,node_analytics,node_visitor toneIndigo
```

## Components

### Discovery and Entry

- [Landing scout form](https://github.com/abhishek6353/gitwicket/blob/main/features/landing/components/landing-hero.tsx): `features/landing/components/landing-hero.tsx`
- [Player detail route](https://github.com/abhishek6353/gitwicket/blob/main/app/players/%5Busername%5D/page.tsx): `app/players/[username]/page.tsx`

### Profile and Scoring

- [Profile API](https://github.com/abhishek6353/gitwicket/blob/main/app/api/github/%5Busername%5D/route.ts): `app/api/github/[username]/route.ts`
- [GitHub profile service](https://github.com/abhishek6353/gitwicket/blob/main/services/github/profile.ts): `services/github/profile.ts`
- [Rating engine](https://github.com/abhishek6353/gitwicket/blob/main/features/rating-engine/engine.ts): `features/rating-engine/engine.ts`
- [Detail data builder](https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/lib/player-detail-data.ts): `features/player-detail/lib/player-detail-data.ts`

### Player Experience

- [Player data client](https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/components/player-page-client.tsx): `features/player-detail/components/player-page-client.tsx`
- [Scouting report view](https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/components/player-detail-view.tsx): `features/player-detail/components/player-detail-view.tsx`
- [Cricket player card](https://github.com/abhishek6353/gitwicket/blob/main/features/cards/components/cricket-player-card.tsx): `features/cards/components/cricket-player-card.tsx`
- [Attribute panel](https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/components/attributes-panel.tsx): `features/player-detail/components/attributes-panel.tsx`
- [Playstyle panel](https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/components/playstyles-panel.tsx): `features/player-detail/components/playstyles-panel.tsx`
- [Report formatting](https://github.com/abhishek6353/gitwicket/blob/main/features/player-detail/lib/report-format.ts): `features/player-detail/lib/report-format.ts`

### Sharing and Images

- [Card image endpoint](https://github.com/abhishek6353/gitwicket/blob/main/app/api/card/%5Busername%5D/image/route.tsx): `app/api/card/[username]/image/route.tsx`
- [Social preview endpoint](https://github.com/abhishek6353/gitwicket/blob/main/app/api/og/%5Busername%5D/route.tsx): `app/api/og/[username]/route.tsx`
- [Share and download actions](https://github.com/abhishek6353/gitwicket/blob/main/features/image-generation/components/share-actions.tsx): `features/image-generation/components/share-actions.tsx`
- [Card image renderer](https://github.com/abhishek6353/gitwicket/blob/main/features/image-generation/lib/card-image-response.tsx): `features/image-generation/lib/card-image-response.tsx`
- [OG image renderer](https://github.com/abhishek6353/gitwicket/blob/main/features/image-generation/lib/og-image-response.tsx): `features/image-generation/lib/og-image-response.tsx`

### Persistence and Metrics

- **Firestore**
- [Leaderboard page](https://github.com/abhishek6353/gitwicket/blob/main/app/leaderboard/page.tsx): `app/leaderboard/page.tsx`
- [Analytics events](https://github.com/abhishek6353/gitwicket/blob/main/lib/config/analytics.ts): `lib/config/analytics.ts`

### Other components

- **GitWicket visitor**
- **GitHub GraphQL API**

## Connections

- GitWicket visitor → Landing scout form: enters username (evidence: `features/landing/components/landing-hero.tsx`)
- Landing scout form → Player detail route: routes to (evidence: `features/landing/components/landing-hero.tsx`)
- Player detail route → Player data client: renders (evidence: `app/players/[username]/page.tsx`)
- Player data client → Profile API: fetches profile (evidence: `features/player-detail/components/player-page-client.tsx`)
- Profile API → GitHub profile service: requests profile (evidence: `app/api/github/[username]/route.ts`)
- GitHub profile service → GitHub GraphQL API: queries profile
- Profile API → Firestore: reads and writes (evidence: `app/api/github/[username]/route.ts`)
- Profile API → Rating engine: scores profile (evidence: `app/api/github/[username]/route.ts`)
- Player data client → Rating engine: scores fetched stats (evidence: `features/player-detail/components/player-page-client.tsx`)
- Player data client → Scouting report view: renders report (evidence: `features/player-detail/components/player-page-client.tsx`)
- Scouting report view → Cricket player card: renders card (evidence: `features/player-detail/components/player-detail-view.tsx`)
- Scouting report view → Attribute panel: renders attributes (evidence: `features/player-detail/components/player-detail-view.tsx`)
- Scouting report view → Playstyle panel: renders playstyles (evidence: `features/player-detail/components/player-detail-view.tsx`)
- Scouting report view → Report formatting: formats report (evidence: `features/player-detail/components/player-detail-view.tsx`)
- Player detail route → Detail data builder: loads detail data (evidence: `app/players/[username]/page.tsx`)
- GitWicket visitor → Share and download actions: uses sharing (evidence: `README.md`)
- Scouting report view → Share and download actions: shows actions (evidence: `features/player-detail/components/player-detail-view.tsx`)
- Card image endpoint → Card image renderer: creates image (evidence: `app/api/card/[username]/image/route.tsx`)
- Social preview endpoint → OG image renderer: renders preview (evidence: `app/api/og/[username]/route.tsx`)
- Landing scout form → Firestore: reads scout count (evidence: `features/landing/components/landing-hero.tsx`)
- Profile API → Leaderboard page: updates leaderboard data (evidence: `app/api/github/[username]/route.ts`)
- Landing scout form → Analytics events: logs search (evidence: `features/landing/components/landing-hero.tsx`)
- Player data client → Analytics events: logs card events (evidence: `features/player-detail/components/player-page-client.tsx`)
