# miguelink113/volleyball-fantasy architecture

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

- Interactive diagram: https://gitdiagram.com/miguelink113/volleyball-fantasy
- Repository: https://github.com/miguelink113/volleyball-fantasy

## Overview

Volleyball Fantasy is a Next.js app for managing private fantasy volleyball leagues and teams, alongside official match results. The user path runs from Supabase authentication and league selection through fantasy roster and scoring APIs to team views; results have a separate competition/round/group workflow. RFEVB ingestion populates the catalog that these views read. The graph includes documented but unsampled capabilities such as standings and ingestion; connections are included only where the excerpts, source index, or README support them.

Main entry points: [`components/fantasy/FantasyTeamBuilder.tsx`](https://github.com/miguelink113/volleyball-fantasy/blob/main/components/fantasy/FantasyTeamBuilder.tsx) (Fantasy workspace), [`app/api/fantasy-round-scores/route.ts`](https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/fantasy-round-scores/route.ts) (Round score API), [`lib/repositories`](https://github.com/miguelink113/volleyball-fantasy/tree/main/lib/repositories) (Catalog repositories), [`lib/supabase/client.ts`](https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/supabase/client.ts) (Browser Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_auth_ui["Sign in<br/>[SimpleAuth.tsx]"]
  node_league_ui["League manager<br/>[LeagueManager.tsx]"]
  node_fantasy_ui["Fantasy workspace"]
  node_player_stats_ui["Player stats modal"]
  node_results_page["Results page<br/>[page.tsx]"]
  node_results_views["Results views"]
end

subgraph group_fantasy["Fantasy domain"]
  node_fantasy_team_api["Fantasy team API<br/>[route.ts]"]
  node_league_ranking_api["League ranking API<br/>[route.ts]"]
  node_league_scores_api["League scores API<br/>[route.ts]"]
  node_team_rules["Team rules"]
end

subgraph group_data["Catalog and scoring data"]
  node_roster_api["Competition roster API<br/>[route.ts]"]
  node_score_api["Round score API<br/>[route.ts]"]
  node_scoring["Scoring system"]
  node_repositories["Catalog repositories"]
  node_standings_repo["Standings repository"]
  node_match_types["Match and player types"]
  node_player_types["Player types<br/>[player.types.ts]"]
end

subgraph group_ingestion["RFEVB ingestion"]
  node_ingest_api["Ingest cron API<br/>[route.ts]"]
  node_ingest_scripts["Catalog ingestion"]
  node_scrapers["RFEVB scrapers"]
  node_match_stats["Match statistics scraper"]
  node_alias_resolver["Team alias resolver"]
  node_esvoley_ingest["Esvoley exploration"]
end

subgraph group_identity["Identity and persistence"]
  node_auth_hook["Auth state<br/>[useAuth.ts]"]
  node_profile["User profile<br/>[profile.service.ts]"]
  node_catalog_db[("Supabase catalog")]
  node_browser_supabase["Browser Supabase client<br/>[client.ts]"]
  node_server_supabase["Server Supabase client<br/>[server.ts]"]
  node_admin_supabase["Admin Supabase client<br/>[admin.server.ts]"]
end

node_user(("Fantasy user"))
node_rfevb["RFEVB"]

node_user -->|"signs in"| node_auth_ui
node_auth_ui -->|"uses auth"| node_auth_hook
node_auth_hook -->|"authenticates"| node_browser_supabase
node_auth_hook -->|"loads profile"| node_profile
node_league_ui -->|"manages leagues"| node_browser_supabase
node_user -->|"selects league"| node_league_ui
node_user -->|"manages team"| node_fantasy_ui
node_fantasy_ui -->|"validates lineup"| node_team_rules
node_fantasy_ui -->|"opens details"| node_player_stats_ui
node_fantasy_ui -->|"reads data"| node_browser_supabase
node_fantasy_ui -.->|"requests team"| node_fantasy_team_api
node_fantasy_ui -.->|"requests scores"| node_score_api
node_fantasy_team_api -->|"authenticates request"| node_server_supabase
node_league_ranking_api -->|"checks user"| node_server_supabase
node_league_scores_api -->|"checks user"| node_server_supabase
node_roster_api -->|"queries catalog"| node_admin_supabase
node_roster_api -->|"loads roster"| node_repositories
node_score_api -->|"queries season"| node_admin_supabase
node_score_api -->|"loads match data"| node_repositories
node_score_api -->|"scores statistics"| node_scoring
node_repositories -.->|"reads catalog"| node_catalog_db
node_admin_supabase -->|"connects to"| node_catalog_db
node_browser_supabase -.->|"connects to"| node_catalog_db
node_server_supabase -.->|"connects to"| node_catalog_db
node_results_page -->|"loads results"| node_admin_supabase
node_results_page -->|"renders views"| node_results_views
node_results_views -->|"loads standings"| node_standings_repo
node_standings_repo -.->|"reads standings"| node_catalog_db
node_rfevb -.->|"provides data"| node_scrapers
node_rfevb -.->|"provides statistics"| node_match_stats
node_ingest_api -.->|"triggers ingestion"| node_ingest_scripts
node_ingest_scripts -.->|"fetches source data"| node_scrapers
node_ingest_scripts -.->|"persists catalog"| node_catalog_db
node_esvoley_ingest -->|"resolves aliases"| node_alias_resolver
node_match_stats -.->|"maps statistics"| node_match_types
node_repositories -.->|"returns typed data"| node_match_types
node_team_rules -->|"uses positions"| node_player_types

click node_auth_ui "https://github.com/miguelink113/volleyball-fantasy/blob/main/components/auth/SimpleAuth.tsx"
click node_auth_hook "https://github.com/miguelink113/volleyball-fantasy/blob/main/hooks/useAuth.ts"
click node_profile "https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/services/profile/profile.service.ts"
click node_league_ui "https://github.com/miguelink113/volleyball-fantasy/blob/main/components/dashboard/LeagueManager.tsx"
click node_fantasy_ui "https://github.com/miguelink113/volleyball-fantasy/blob/main/components/fantasy/FantasyTeamBuilder.tsx"
click node_player_stats_ui "https://github.com/miguelink113/volleyball-fantasy/blob/main/components/fantasy/PlayerStatsModal.tsx"
click node_results_page "https://github.com/miguelink113/volleyball-fantasy/blob/main/app/(app)/results/page.tsx"
click node_results_views "https://github.com/miguelink113/volleyball-fantasy/tree/main/components/results"
click node_fantasy_team_api "https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/fantasy-team/route.ts"
click node_league_ranking_api "https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/league-ranking/route.ts"
click node_league_scores_api "https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/league-scores/route.ts"
click node_team_rules "https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/services/fantasy/fantasy-team.service.ts"
click node_roster_api "https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/competition-roster/route.ts"
click node_score_api "https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/fantasy-round-scores/route.ts"
click node_scoring "https://github.com/miguelink113/volleyball-fantasy/blob/main/domain/scoring/scoring-v1.system.ts"
click node_repositories "https://github.com/miguelink113/volleyball-fantasy/tree/main/lib/repositories"
click node_standings_repo "https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/repositories/standings.repository.ts"
click node_browser_supabase "https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/supabase/client.ts"
click node_server_supabase "https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/supabase/server.ts"
click node_admin_supabase "https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/supabase/admin.server.ts"
click node_ingest_api "https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/cron/ingest/route.ts"
click node_ingest_scripts "https://github.com/miguelink113/volleyball-fantasy/tree/main/scripts/ingest"
click node_scrapers "https://github.com/miguelink113/volleyball-fantasy/tree/main/lib/scraper"
click node_match_stats "https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/scraper/fetch-match-statistics.ts"
click node_alias_resolver "https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/services/ingestion/team-alias-resolver.ts"
click node_esvoley_ingest "https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/scraper/esvoley-ingestion.ts"
click node_match_types "https://github.com/miguelink113/volleyball-fantasy/tree/main/domain/match"
click node_player_types "https://github.com/miguelink113/volleyball-fantasy/blob/main/domain/player/player.types.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_auth_ui,node_league_ui,node_fantasy_ui,node_player_stats_ui,node_results_page,node_results_views,node_user toneBlue
class node_fantasy_team_api,node_league_ranking_api,node_league_scores_api,node_team_rules toneAmber
class node_roster_api,node_score_api,node_scoring,node_repositories,node_standings_repo,node_match_types,node_player_types toneMint
class node_ingest_api,node_ingest_scripts,node_scrapers,node_match_stats,node_alias_resolver,node_esvoley_ingest toneRose
class node_auth_hook,node_profile,node_catalog_db,node_browser_supabase,node_server_supabase,node_admin_supabase,node_rfevb toneIndigo
```

## Components

### Web experience

- [Sign in](https://github.com/miguelink113/volleyball-fantasy/blob/main/components/auth/SimpleAuth.tsx): `components/auth/SimpleAuth.tsx`
- [League manager](https://github.com/miguelink113/volleyball-fantasy/blob/main/components/dashboard/LeagueManager.tsx): `components/dashboard/LeagueManager.tsx`
- [Fantasy workspace](https://github.com/miguelink113/volleyball-fantasy/blob/main/components/fantasy/FantasyTeamBuilder.tsx): `components/fantasy/FantasyTeamBuilder.tsx`
- [Player stats modal](https://github.com/miguelink113/volleyball-fantasy/blob/main/components/fantasy/PlayerStatsModal.tsx): `components/fantasy/PlayerStatsModal.tsx`
- [Results page](https://github.com/miguelink113/volleyball-fantasy/blob/main/app/(app)/results/page.tsx): `app/(app)/results/page.tsx`
- [Results views](https://github.com/miguelink113/volleyball-fantasy/tree/main/components/results): `components/results`

### Fantasy domain

- [Fantasy team API](https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/fantasy-team/route.ts): `app/api/fantasy-team/route.ts`
- [League ranking API](https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/league-ranking/route.ts): `app/api/league-ranking/route.ts`
- [League scores API](https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/league-scores/route.ts): `app/api/league-scores/route.ts`
- [Team rules](https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/services/fantasy/fantasy-team.service.ts): `lib/services/fantasy/fantasy-team.service.ts`

### Catalog and scoring data

- [Competition roster API](https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/competition-roster/route.ts): `app/api/competition-roster/route.ts`
- [Round score API](https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/fantasy-round-scores/route.ts): `app/api/fantasy-round-scores/route.ts`
- [Scoring system](https://github.com/miguelink113/volleyball-fantasy/blob/main/domain/scoring/scoring-v1.system.ts): `domain/scoring/scoring-v1.system.ts`
- [Catalog repositories](https://github.com/miguelink113/volleyball-fantasy/tree/main/lib/repositories): `lib/repositories`
- [Standings repository](https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/repositories/standings.repository.ts): `lib/repositories/standings.repository.ts`
- [Match and player types](https://github.com/miguelink113/volleyball-fantasy/tree/main/domain/match): `domain/match`
- [Player types](https://github.com/miguelink113/volleyball-fantasy/blob/main/domain/player/player.types.ts): `domain/player/player.types.ts`

### RFEVB ingestion

- [Ingest cron API](https://github.com/miguelink113/volleyball-fantasy/blob/main/app/api/cron/ingest/route.ts): `app/api/cron/ingest/route.ts`
- [Catalog ingestion](https://github.com/miguelink113/volleyball-fantasy/tree/main/scripts/ingest): `scripts/ingest`
- [RFEVB scrapers](https://github.com/miguelink113/volleyball-fantasy/tree/main/lib/scraper): `lib/scraper`
- [Match statistics scraper](https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/scraper/fetch-match-statistics.ts): `lib/scraper/fetch-match-statistics.ts`
- [Team alias resolver](https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/services/ingestion/team-alias-resolver.ts): `lib/services/ingestion/team-alias-resolver.ts`
- [Esvoley exploration](https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/scraper/esvoley-ingestion.ts): `lib/scraper/esvoley-ingestion.ts`

### Identity and persistence

- [Auth state](https://github.com/miguelink113/volleyball-fantasy/blob/main/hooks/useAuth.ts): `hooks/useAuth.ts`
- [User profile](https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/services/profile/profile.service.ts): `lib/services/profile/profile.service.ts`
- **Supabase catalog**
- [Browser Supabase client](https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/supabase/client.ts): `lib/supabase/client.ts`
- [Server Supabase client](https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- [Admin Supabase client](https://github.com/miguelink113/volleyball-fantasy/blob/main/lib/supabase/admin.server.ts): `lib/supabase/admin.server.ts`

### Other components

- **Fantasy user**
- **RFEVB**

## Connections

- Fantasy user → Sign in: signs in
- Sign in → Auth state: uses auth (evidence: `components/auth/SimpleAuth.tsx`)
- Auth state → Browser Supabase client: authenticates (evidence: `hooks/useAuth.ts`)
- Auth state → User profile: loads profile (evidence: `hooks/useAuth.ts`)
- League manager → Browser Supabase client: manages leagues (evidence: `components/dashboard/LeagueManager.tsx`)
- Fantasy user → League manager: selects league
- Fantasy user → Fantasy workspace: manages team
- Fantasy workspace → Team rules: validates lineup (evidence: `components/fantasy/FantasyTeamBuilder.tsx`)
- Fantasy workspace → Player stats modal: opens details (evidence: `components/fantasy/FantasyTeamBuilder.tsx`)
- Fantasy workspace → Browser Supabase client: reads data (evidence: `components/fantasy/FantasyTeamBuilder.tsx`)
- Fantasy workspace → Fantasy team API: requests team
- Fantasy workspace → Round score API: requests scores
- Fantasy team API → Server Supabase client: authenticates request (evidence: `app/api/fantasy-team/route.ts`)
- League ranking API → Server Supabase client: checks user (evidence: `app/api/league-ranking/route.ts`)
- League scores API → Server Supabase client: checks user (evidence: `app/api/league-scores/route.ts`)
- Competition roster API → Admin Supabase client: queries catalog (evidence: `app/api/competition-roster/route.ts`)
- Competition roster API → Catalog repositories: loads roster (evidence: `app/api/competition-roster/route.ts`)
- Round score API → Admin Supabase client: queries season (evidence: `app/api/fantasy-round-scores/route.ts`)
- Round score API → Catalog repositories: loads match data (evidence: `app/api/fantasy-round-scores/route.ts`)
- Round score API → Scoring system: scores statistics (evidence: `app/api/fantasy-round-scores/route.ts`)
- Catalog repositories → Supabase catalog: reads catalog
- Admin Supabase client → Supabase catalog: connects to (evidence: `lib/supabase/admin.server.ts`)
- Browser Supabase client → Supabase catalog: connects to
- Server Supabase client → Supabase catalog: connects to
- Results page → Admin Supabase client: loads results (evidence: `app/(app)/results/page.tsx`)
- Results page → Results views: renders views (evidence: `app/(app)/results/page.tsx`)
- Results views → Standings repository: loads standings (evidence: `components/results/StandingsTable.tsx`)
- Standings repository → Supabase catalog: reads standings
- RFEVB → RFEVB scrapers: provides data
- RFEVB → Match statistics scraper: provides statistics
- Ingest cron API → Catalog ingestion: triggers ingestion
- Catalog ingestion → RFEVB scrapers: fetches source data
- Catalog ingestion → Supabase catalog: persists catalog
- Esvoley exploration → Team alias resolver: resolves aliases (evidence: `lib/scraper/esvoley-ingestion.ts`)
- Match statistics scraper → Match and player types: maps statistics
- Catalog repositories → Match and player types: returns typed data (evidence: `lib/repositories/match-player-stats.repository.ts`)
- Team rules → Player types: uses positions (evidence: `lib/services/fantasy/fantasy-team.service.ts`)
