# nathanamoo-crypto/sportshub architecture

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

- Interactive diagram: https://gitdiagram.com/nathanamoo-crypto/sportshub
- Repository: https://github.com/nathanamoo-crypto/sportshub

## Overview

SportsHub lets organizers manage local competitions from setup through teams, fixtures, scores and match events; players and visitors can browse competitions, matches, teams and statistics. The frontend routes these workflows through domain-specific services to Supabase for authentication, data and logo storage. The README documents standings and player/team statistics derived from Postgres views. Only routing, auth-provider behavior, and the fixture-result page’s service calls were sampled; other domain links reflect the documented service-layer structure, not inspected call sites.

Main entry points: [`src/App.tsx`](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/App.tsx) (Route application), [`src/services/supabase.ts`](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/supabase.ts) (Supabase client), [`src/pages/organizer`](https://github.com/nathanamoo-crypto/sportshub/tree/main/src/pages/organizer) (Team and squad setup), [`src/pages/organizer/FixtureResultPage.tsx`](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/organizer/FixtureResultPage.tsx) (Results and events)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and identity"]
  node_app["Route application<br/>[App.tsx]"]
  node_auth["Auth provider<br/>[AuthProvider.tsx]"]
end

subgraph group_management["Organizer management"]
  node_organizer["Competition setup"]
  node_teamops["Team and squad setup"]
  node_fixtureops["Fixture scheduling"]
  node_results["Results and events"]
end

subgraph group_public["Public competition experience"]
  node_competitionbrowse["Competition browsing"]
  node_competitiondetail["Competition details"]
  node_matchpublic["Public match pages"]
  node_teamsplayers["Teams and players<br/>[TeamsPage.tsx]"]
  node_statistics["Standings and stats<br/>[statistics.ts]"]
end

subgraph group_backend["Supabase data layer"]
  node_competitionssvc["Competition service<br/>[competitions.ts]"]
  node_teamssvc["Teams and squads<br/>[teams.ts]"]
  node_squadssvc["Squad service<br/>[squads.ts]"]
  node_fixturessvc["Fixture service<br/>[fixtures.ts]"]
  node_eventssvc["Match events<br/>[matchEvents.ts]"]
  node_storage["Logo storage<br/>[storage.ts]"]
  node_supabaseclient["Supabase client<br/>[supabase.ts]"]
end

node_visitor(("Visitor or user"))
node_supabaseauth["Supabase Auth"]
node_postgres[("Postgres database")]
node_supastorage[("Supabase Storage")]

node_visitor -->|"opens"| node_app
node_app -->|"provides identity"| node_auth
node_app -->|"routes"| node_organizer
node_app -->|"routes"| node_teamops
node_app -->|"routes"| node_fixtureops
node_app -->|"routes"| node_results
node_app -->|"routes"| node_competitionbrowse
node_app -->|"routes"| node_competitiondetail
node_app -->|"routes"| node_matchpublic
node_app -->|"routes"| node_teamsplayers
node_auth -->|"uses"| node_supabaseclient
node_supabaseclient -->|"auth requests"| node_supabaseauth
node_auth -->|"reads profiles and roles"| node_postgres
node_organizer -->|"manages competitions"| node_competitionssvc
node_teamops -->|"manages teams"| node_teamssvc
node_teamops -->|"manages squads"| node_squadssvc
node_teamops -->|"uploads logos"| node_storage
node_fixtureops -->|"manages fixtures"| node_fixturessvc
node_results -->|"loads and saves results"| node_fixturessvc
node_results -->|"manages events"| node_eventssvc
node_results -->|"loads squads"| node_squadssvc
node_competitionbrowse -->|"browses competitions"| node_competitionssvc
node_competitiondetail -->|"loads details"| node_competitionssvc
node_matchpublic -->|"loads matches"| node_fixturessvc
node_teamsplayers -->|"loads teams"| node_teamssvc
node_teamsplayers -->|"loads players"| node_squadssvc
node_statistics -->|"reads derived views"| node_postgres
node_competitionssvc -->|"queries data"| node_supabaseclient
node_teamssvc -->|"queries data"| node_supabaseclient
node_squadssvc -->|"queries data"| node_supabaseclient
node_fixturessvc -->|"queries data"| node_supabaseclient
node_eventssvc -->|"queries data"| node_supabaseclient
node_storage -->|"uses client"| node_supabaseclient
node_supabaseclient -->|"data requests"| node_postgres
node_storage -->|"uploads and deletes"| node_supastorage

click node_app "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/App.tsx"
click node_auth "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/context/AuthProvider.tsx"
click node_organizer "https://github.com/nathanamoo-crypto/sportshub/tree/main/src/pages/organizer"
click node_teamops "https://github.com/nathanamoo-crypto/sportshub/tree/main/src/pages/organizer"
click node_fixtureops "https://github.com/nathanamoo-crypto/sportshub/tree/main/src/pages/organizer"
click node_results "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/organizer/FixtureResultPage.tsx"
click node_competitionbrowse "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/CompetitionsPage.tsx"
click node_competitiondetail "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/CompetitionDetailPage.tsx"
click node_matchpublic "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/MatchDetailPage.tsx"
click node_teamsplayers "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/TeamsPage.tsx"
click node_statistics "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/statistics.ts"
click node_competitionssvc "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/competitions.ts"
click node_teamssvc "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/teams.ts"
click node_squadssvc "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/squads.ts"
click node_fixturessvc "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/fixtures.ts"
click node_eventssvc "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/matchEvents.ts"
click node_storage "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/storage.ts"
click node_supabaseclient "https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/supabase.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_auth,node_visitor toneBlue
class node_organizer,node_teamops,node_fixtureops,node_results,node_postgres,node_supastorage toneAmber
class node_competitionbrowse,node_competitiondetail,node_matchpublic,node_teamsplayers,node_statistics toneMint
class node_competitionssvc,node_teamssvc,node_squadssvc,node_fixturessvc,node_eventssvc,node_storage,node_supabaseclient toneRose
class node_supabaseauth toneIndigo
```

## Components

### Application and identity

- [Route application](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/App.tsx): `src/App.tsx`
- [Auth provider](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/context/AuthProvider.tsx): `src/context/AuthProvider.tsx`

### Organizer management

- [Competition setup](https://github.com/nathanamoo-crypto/sportshub/tree/main/src/pages/organizer): `src/pages/organizer`
- [Team and squad setup](https://github.com/nathanamoo-crypto/sportshub/tree/main/src/pages/organizer): `src/pages/organizer`
- [Fixture scheduling](https://github.com/nathanamoo-crypto/sportshub/tree/main/src/pages/organizer): `src/pages/organizer`
- [Results and events](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/organizer/FixtureResultPage.tsx): `src/pages/organizer/FixtureResultPage.tsx`

### Public competition experience

- [Competition browsing](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/CompetitionsPage.tsx): `src/pages/CompetitionsPage.tsx`
- [Competition details](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/CompetitionDetailPage.tsx): `src/pages/CompetitionDetailPage.tsx`
- [Public match pages](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/MatchDetailPage.tsx): `src/pages/MatchDetailPage.tsx`
- [Teams and players](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/pages/TeamsPage.tsx): `src/pages/TeamsPage.tsx`
- [Standings and stats](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/statistics.ts): `src/services/statistics.ts`

### Supabase data layer

- [Competition service](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/competitions.ts): `src/services/competitions.ts`
- [Teams and squads](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/teams.ts): `src/services/teams.ts`
- [Squad service](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/squads.ts): `src/services/squads.ts`
- [Fixture service](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/fixtures.ts): `src/services/fixtures.ts`
- [Match events](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/matchEvents.ts): `src/services/matchEvents.ts`
- [Logo storage](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/storage.ts): `src/services/storage.ts`
- [Supabase client](https://github.com/nathanamoo-crypto/sportshub/blob/main/src/services/supabase.ts): `src/services/supabase.ts`

### Other components

- **Visitor or user**
- **Supabase Auth**
- **Postgres database**
- **Supabase Storage**

## Connections

- Visitor or user → Route application: opens
- Route application → Auth provider: provides identity
- Route application → Competition setup: routes
- Route application → Team and squad setup: routes
- Route application → Fixture scheduling: routes
- Route application → Results and events: routes
- Route application → Competition browsing: routes
- Route application → Competition details: routes
- Route application → Public match pages: routes
- Route application → Teams and players: routes
- Auth provider → Supabase client: uses
- Supabase client → Supabase Auth: auth requests
- Auth provider → Postgres database: reads profiles and roles
- Competition setup → Competition service: manages competitions
- Team and squad setup → Teams and squads: manages teams
- Team and squad setup → Squad service: manages squads
- Team and squad setup → Logo storage: uploads logos
- Fixture scheduling → Fixture service: manages fixtures
- Results and events → Fixture service: loads and saves results
- Results and events → Match events: manages events
- Results and events → Squad service: loads squads
- Competition browsing → Competition service: browses competitions
- Competition details → Competition service: loads details
- Public match pages → Fixture service: loads matches
- Teams and players → Teams and squads: loads teams
- Teams and players → Squad service: loads players
- Standings and stats → Postgres database: reads derived views
- Competition service → Supabase client: queries data
- Teams and squads → Supabase client: queries data
- Squad service → Supabase client: queries data
- Fixture service → Supabase client: queries data
- Match events → Supabase client: queries data
- Logo storage → Supabase client: uses client
- Supabase client → Postgres database: data requests
- Logo storage → Supabase Storage: uploads and deletes
