# saurav-karki1/npl-hub-nepal architecture

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

- Interactive diagram: https://gitdiagram.com/saurav-karki1/npl-hub-nepal
- Repository: https://github.com/saurav-karki1/npl-hub-nepal

## Overview

NPL Hub Nepal is a cricket-tournament information site with an admin console for maintaining match, news, player, team, and statistics data. Visitors browse schedules, standings, team/player profiles, news, and season statistics; the homepage assembles featured content from repositories. Admins authenticate, edit domain records in the console, and use admin API routes backed by a server-only Supabase client. The graph preserves these product areas, but many public routes and integrations are unsampled; their links are omitted where the available evidence does not establish calls.

Main entry points: [`src/lib/repository/matches.ts`](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/repository/matches.ts) (Match repository), [`src/lib/supabase/client.ts`](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/supabase/client.ts) (Public Supabase client), [`src/app/page.tsx`](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/app/page.tsx) (Homepage), [`src/app/admin`](https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/admin) (Admin console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public experience"]
  node_homepage["Homepage<br/>[page.tsx]"]
  node_fixtures["Schedules &amp; matches"]
  node_standings["Points table"]
  node_teams["Team profiles"]
  node_players["Player profiles"]
  node_news["News"]
  node_stats["Season statistics<br/>[StatsHubClient.tsx]"]
  node_homeupdates["Homepage updates"]
  node_homefixtures["Featured match"]
  node_homepoints["Standings preview"]
end

subgraph group_domain["Tournament data"]
  node_teamdata["Team reference data<br/>[teams-data.ts]"]
  node_playerdata["Player reference data<br/>[players-data.ts]"]
  node_scheduledata["Schedule reference data<br/>[schedule-data.ts]"]
  node_matchrepo["Match repository<br/>[matches.ts]"]
  node_teamrepo["Team repository<br/>[teams.ts]"]
  node_newsrepo["News repository<br/>[news.ts]"]
  node_statsrepo["Statistics repository<br/>[stats.ts]"]
end

subgraph group_admin["Administration"]
  node_adminconsole["Admin console"]
  node_adminauth["Admin authentication"]
  node_adminapi["Admin API routes"]
end

subgraph group_infra["Data infrastructure"]
  node_supabaseclient["Public Supabase client<br/>[client.ts]"]
  node_supabaseserver["Service-role client<br/>[server.ts]"]
  node_supabase[("Supabase")]
end

node_visitor(("Visitor"))
node_adminuser(("Administrator"))

node_visitor -->|"browses"| node_homepage
node_homepage -->|"renders"| node_homeupdates
node_homepage -->|"renders"| node_homefixtures
node_homepage -->|"renders"| node_homepoints
node_homeupdates -->|"loads news"| node_newsrepo
node_homefixtures -->|"loads matches"| node_matchrepo
node_homepoints -->|"loads standings"| node_matchrepo
node_fixtures -.->|"loads fixtures"| node_matchrepo
node_standings -.->|"loads table"| node_matchrepo
node_matchrepo -->|"queries"| node_supabaseclient
node_matchrepo -->|"falls back to"| node_scheduledata
node_teamrepo -->|"queries"| node_supabaseclient
node_teamrepo -->|"uses fallback"| node_teamdata
node_statsrepo -->|"queries"| node_supabaseclient
node_statsrepo -->|"uses"| node_teamrepo
node_players -->|"uses reference data"| node_playerdata
node_adminuser -->|"manages content"| node_adminconsole
node_adminconsole -->|"authenticates with"| node_adminauth
node_adminauth -->|"manages session"| node_supabaseclient
node_adminconsole -.->|"requests admin data"| node_adminapi
node_adminapi -->|"creates client"| node_supabaseserver
node_supabaseclient -.->|"queries"| node_supabase
node_supabaseserver -.->|"admin access"| node_supabase

click node_homepage "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/app/page.tsx"
click node_fixtures "https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/components/schedule"
click node_standings "https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/components/points-table"
click node_teams "https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/teams"
click node_players "https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/players"
click node_news "https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/news"
click node_stats "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/components/stats/StatsHubClient.tsx"
click node_homeupdates "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/components/home/LatestUpdatesSection.tsx"
click node_homefixtures "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/components/home/UpcomingMatchSection.tsx"
click node_homepoints "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/components/home/PointsTablePreview.tsx"
click node_teamdata "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/data/teams-data.ts"
click node_playerdata "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/data/players-data.ts"
click node_scheduledata "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/data/schedule-data.ts"
click node_matchrepo "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/repository/matches.ts"
click node_teamrepo "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/repository/teams.ts"
click node_newsrepo "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/repository/news.ts"
click node_statsrepo "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/repository/stats.ts"
click node_adminconsole "https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/admin"
click node_adminauth "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/auth/admin-auth-context.tsx"
click node_adminapi "https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/api/admin"
click node_supabaseclient "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/supabase/client.ts"
click node_supabaseserver "https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/supabase/server.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_homepage,node_fixtures,node_standings,node_teams,node_players,node_news,node_stats,node_homeupdates,node_homefixtures,node_homepoints toneBlue
class node_teamdata,node_playerdata,node_scheduledata,node_matchrepo,node_teamrepo,node_newsrepo,node_statsrepo toneAmber
class node_adminconsole,node_adminauth,node_adminapi toneMint
class node_supabaseclient,node_supabaseserver,node_supabase toneRose
class node_visitor,node_adminuser toneIndigo
```

## Components

### Public experience

- [Homepage](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/app/page.tsx): `src/app/page.tsx`
- [Schedules & matches](https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/components/schedule): `src/components/schedule`
- [Points table](https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/components/points-table): `src/components/points-table`
- [Team profiles](https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/teams): `src/app/teams`
- [Player profiles](https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/players): `src/app/players`
- [News](https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/news): `src/app/news`
- [Season statistics](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/components/stats/StatsHubClient.tsx): `src/components/stats/StatsHubClient.tsx`
- [Homepage updates](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/components/home/LatestUpdatesSection.tsx): `src/components/home/LatestUpdatesSection.tsx`
- [Featured match](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/components/home/UpcomingMatchSection.tsx): `src/components/home/UpcomingMatchSection.tsx`
- [Standings preview](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/components/home/PointsTablePreview.tsx): `src/components/home/PointsTablePreview.tsx`

### Tournament data

- [Team reference data](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/data/teams-data.ts): `src/lib/data/teams-data.ts`
- [Player reference data](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/data/players-data.ts): `src/lib/data/players-data.ts`
- [Schedule reference data](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/data/schedule-data.ts): `src/lib/data/schedule-data.ts`
- [Match repository](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/repository/matches.ts): `src/lib/repository/matches.ts`
- [Team repository](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/repository/teams.ts): `src/lib/repository/teams.ts`
- [News repository](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/repository/news.ts): `src/lib/repository/news.ts`
- [Statistics repository](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/repository/stats.ts): `src/lib/repository/stats.ts`

### Administration

- [Admin console](https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/admin): `src/app/admin`
- [Admin authentication](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/auth/admin-auth-context.tsx): `src/lib/auth/admin-auth-context.tsx`
- [Admin API routes](https://github.com/saurav-karki1/npl-hub-nepal/tree/master/src/app/api/admin): `src/app/api/admin`

### Data infrastructure

- [Public Supabase client](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/supabase/client.ts): `src/lib/supabase/client.ts`
- [Service-role client](https://github.com/saurav-karki1/npl-hub-nepal/blob/master/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- **Supabase**

### Other components

- **Visitor**
- **Administrator**

## Connections

- Visitor → Homepage: browses
- Homepage → Homepage updates: renders (evidence: `src/app/page.tsx`)
- Homepage → Featured match: renders (evidence: `src/app/page.tsx`)
- Homepage → Standings preview: renders (evidence: `src/app/page.tsx`)
- Homepage updates → News repository: loads news (evidence: `src/components/home/LatestUpdatesSection.tsx`)
- Featured match → Match repository: loads matches (evidence: `src/components/home/UpcomingMatchSection.tsx`)
- Standings preview → Match repository: loads standings (evidence: `src/components/home/PointsTablePreview.tsx`)
- Schedules & matches → Match repository: loads fixtures (evidence: `src/components/schedule/FullFixturesSection.tsx`)
- Points table → Match repository: loads table
- Match repository → Public Supabase client: queries (evidence: `src/lib/repository/matches.ts`)
- Match repository → Schedule reference data: falls back to (evidence: `src/lib/repository/matches.ts`)
- Team repository → Public Supabase client: queries (evidence: `src/lib/repository/teams.ts`)
- Team repository → Team reference data: uses fallback (evidence: `src/lib/repository/teams.ts`)
- Statistics repository → Public Supabase client: queries (evidence: `src/lib/repository/stats.ts`)
- Statistics repository → Team repository: uses (evidence: `src/lib/repository/stats.ts`)
- Player profiles → Player reference data: uses reference data
- Administrator → Admin console: manages content
- Admin console → Admin authentication: authenticates with (evidence: `src/app/admin/matches/page.tsx`)
- Admin authentication → Public Supabase client: manages session (evidence: `src/lib/auth/admin-auth-context.tsx`)
- Admin console → Admin API routes: requests admin data
- Admin API routes → Service-role client: creates client (evidence: `src/app/api/admin/matches/route.ts`)
- Public Supabase client → Supabase: queries
- Service-role client → Supabase: admin access
