# billie355/worldcup_project architecture

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

- Interactive diagram: https://gitdiagram.com/billie355/worldcup_project
- Repository: https://github.com/billie355/worldcup_project

## Overview

World Cup Prediction Platform lets users create accounts, submit match and tournament picks, and track points on leaderboards; profiles, player picks, share cards, and admin management support that core loop. Server actions mediate prediction, account, and administration work against Supabase. The graph preserves these documented-by-source capabilities, but several page and action implementations were not sampled, so their internal links are omitted rather than inferred.

Main entry points: [`src/lib/supabase/server.ts`](https://github.com/billie355/worldcup_project/blob/main/src/lib/supabase/server.ts) (Supabase clients), [`src/components/profile/ProfileClient.tsx`](https://github.com/billie355/worldcup_project/blob/main/src/components/profile/ProfileClient.tsx) (Profile and settings), [`src/components/predictions/MatchPredictionsClient.tsx`](https://github.com/billie355/worldcup_project/blob/main/src/components/predictions/MatchPredictionsClient.tsx) (Match predictions), [`src/lib/actions/auth.ts`](https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/auth.ts) (Authentication actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_landing["Public landing<br/>[page.tsx]"]
  node_auth_pages["Sign-in and registration<br/>[page.tsx]"]
  node_auth_callback["OAuth callback<br/>[route.ts]"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_leaderboard_ui["Leaderboard views"]
  node_profile["Profile and settings<br/>[ProfileClient.tsx]"]
  node_share_actions["Share-card generation<br/>[share.ts]"]
  node_share_page["Shared card page<br/>[page.tsx]"]
end

subgraph group_predictions["Prediction gameplay"]
  node_match_ui["Match predictions"]
  node_player_picks["Player picks"]
  node_tournament_ui["Tournament predictions"]
  node_prediction_actions["Prediction actions<br/>[predictions.ts]"]
  node_player_actions["Player-pick actions"]
  node_leaderboard_actions["Leaderboard queries<br/>[leaderboard.ts]"]
end

subgraph group_operations["Accounts and operations"]
  node_auth_actions["Authentication actions<br/>[auth.ts]"]
  node_admin_pages["Admin console<br/>[page.tsx]"]
  node_admin_clients["Admin management clients"]
  node_admin_actions["Admin actions<br/>[admin.ts]"]
  node_notifications["Notification actions<br/>[notifications.ts]"]
end

subgraph group_data["Data services"]
  node_supabase_clients["Supabase clients<br/>[server.ts]"]
  node_supabase_db[("Supabase data store")]
end

node_visitors(("Visitors and users"))

node_visitors -->|"visit"| node_landing
node_landing -->|"loads preview data"| node_leaderboard_actions
node_landing -->|"presents features"| node_visitors
node_visitors -->|"register or sign in"| node_auth_pages
node_auth_pages -->|"submits credentials"| node_auth_actions
node_auth_actions -->|"creates session client"| node_supabase_clients
node_auth_callback -->|"exchanges auth code"| node_supabase_clients
node_visitors -->|"open dashboard"| node_dashboard
node_dashboard -->|"loads user data"| node_supabase_clients
node_dashboard -->|"loads predictions"| node_prediction_actions
node_visitors -->|"submit match picks"| node_match_ui
node_match_ui -->|"submits match pick"| node_prediction_actions
node_match_ui -->|"loads player picks"| node_player_actions
node_match_ui -->|"renders picks"| node_player_picks
node_player_picks -->|"saves player picks"| node_player_actions
node_visitors -->|"submit tournament picks"| node_tournament_ui
node_tournament_ui -->|"loads and saves picks"| node_prediction_actions
node_visitors -->|"view rankings"| node_leaderboard_ui
node_leaderboard_ui -->|"loads rankings"| node_leaderboard_actions
node_visitors -->|"manage profile"| node_profile
node_profile -->|"updates account"| node_auth_actions
node_profile -->|"generates share card"| node_share_actions
node_profile -->|"manages notifications"| node_notifications
node_visitors -->|"open shared card"| node_share_page
node_visitors -->|"manage tournament"| node_admin_pages
node_admin_pages -->|"loads admin data"| node_supabase_clients
node_admin_clients -->|"invokes management actions"| node_admin_actions
node_admin_actions -->|"checks roles and manages records"| node_supabase_clients
node_prediction_actions -->|"reads and writes picks"| node_supabase_clients
node_player_actions -->|"reads and writes picks"| node_supabase_clients
node_leaderboard_actions -->|"queries rankings"| node_supabase_clients
node_auth_actions -->|"authenticates and updates profiles"| node_supabase_clients
node_supabase_clients -.->|"accesses data store"| node_supabase_db

click node_landing "https://github.com/billie355/worldcup_project/blob/main/src/app/page.tsx"
click node_auth_pages "https://github.com/billie355/worldcup_project/blob/main/src/app/login/page.tsx"
click node_auth_callback "https://github.com/billie355/worldcup_project/blob/main/src/app/auth/callback/route.ts"
click node_dashboard "https://github.com/billie355/worldcup_project/blob/main/src/app/(main)/dashboard/page.tsx"
click node_leaderboard_ui "https://github.com/billie355/worldcup_project/blob/main/src/components/leaderboard/LeaderboardClient.tsx"
click node_profile "https://github.com/billie355/worldcup_project/blob/main/src/components/profile/ProfileClient.tsx"
click node_match_ui "https://github.com/billie355/worldcup_project/blob/main/src/components/predictions/MatchPredictionsClient.tsx"
click node_player_picks "https://github.com/billie355/worldcup_project/blob/main/src/components/predictions/PlayerPicksSection.tsx"
click node_tournament_ui "https://github.com/billie355/worldcup_project/blob/main/src/components/predictions/TournamentPredictionsClient.tsx"
click node_prediction_actions "https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/predictions.ts"
click node_player_actions "https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/player-predictions.ts"
click node_leaderboard_actions "https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/leaderboard.ts"
click node_share_actions "https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/share.ts"
click node_share_page "https://github.com/billie355/worldcup_project/blob/main/src/app/share/%5Bid%5D/page.tsx"
click node_auth_actions "https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/auth.ts"
click node_admin_pages "https://github.com/billie355/worldcup_project/blob/main/src/app/admin/page.tsx"
click node_admin_clients "https://github.com/billie355/worldcup_project/blob/main/src/components/admin/AdminMatchesClient.tsx"
click node_admin_actions "https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/admin.ts"
click node_notifications "https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/notifications.ts"
click node_supabase_clients "https://github.com/billie355/worldcup_project/blob/main/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_landing,node_auth_pages,node_auth_callback,node_dashboard,node_leaderboard_ui,node_profile,node_share_actions,node_share_page,node_visitors toneBlue
class node_match_ui,node_player_picks,node_tournament_ui,node_prediction_actions,node_player_actions,node_leaderboard_actions toneAmber
class node_auth_actions,node_admin_pages,node_admin_clients,node_admin_actions,node_notifications toneMint
class node_supabase_clients,node_supabase_db toneRose
```

## Components

### User experience

- [Public landing](https://github.com/billie355/worldcup_project/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Sign-in and registration](https://github.com/billie355/worldcup_project/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [OAuth callback](https://github.com/billie355/worldcup_project/blob/main/src/app/auth/callback/route.ts): `src/app/auth/callback/route.ts`
- [Dashboard](https://github.com/billie355/worldcup_project/blob/main/src/app/(main)/dashboard/page.tsx): `src/app/(main)/dashboard/page.tsx`
- [Leaderboard views](https://github.com/billie355/worldcup_project/blob/main/src/components/leaderboard/LeaderboardClient.tsx): `src/components/leaderboard/LeaderboardClient.tsx`
- [Profile and settings](https://github.com/billie355/worldcup_project/blob/main/src/components/profile/ProfileClient.tsx): `src/components/profile/ProfileClient.tsx`
- [Share-card generation](https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/share.ts): `src/lib/actions/share.ts`
- [Shared card page](https://github.com/billie355/worldcup_project/blob/main/src/app/share/%5Bid%5D/page.tsx): `src/app/share/[id]/page.tsx`

### Prediction gameplay

- [Match predictions](https://github.com/billie355/worldcup_project/blob/main/src/components/predictions/MatchPredictionsClient.tsx): `src/components/predictions/MatchPredictionsClient.tsx`
- [Player picks](https://github.com/billie355/worldcup_project/blob/main/src/components/predictions/PlayerPicksSection.tsx): `src/components/predictions/PlayerPicksSection.tsx`
- [Tournament predictions](https://github.com/billie355/worldcup_project/blob/main/src/components/predictions/TournamentPredictionsClient.tsx): `src/components/predictions/TournamentPredictionsClient.tsx`
- [Prediction actions](https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/predictions.ts): `src/lib/actions/predictions.ts`
- [Player-pick actions](https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/player-predictions.ts): `src/lib/actions/player-predictions.ts`
- [Leaderboard queries](https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/leaderboard.ts): `src/lib/actions/leaderboard.ts`

### Accounts and operations

- [Authentication actions](https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/auth.ts): `src/lib/actions/auth.ts`
- [Admin console](https://github.com/billie355/worldcup_project/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [Admin management clients](https://github.com/billie355/worldcup_project/blob/main/src/components/admin/AdminMatchesClient.tsx): `src/components/admin/AdminMatchesClient.tsx`
- [Admin actions](https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/admin.ts): `src/lib/actions/admin.ts`
- [Notification actions](https://github.com/billie355/worldcup_project/blob/main/src/lib/actions/notifications.ts): `src/lib/actions/notifications.ts`

### Data services

- [Supabase clients](https://github.com/billie355/worldcup_project/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- **Supabase data store**

### Other components

- **Visitors and users**

## Connections

- Visitors and users → Public landing: visit
- Public landing → Leaderboard queries: loads preview data (evidence: `src/app/page.tsx`)
- Public landing → Visitors and users: presents features (evidence: `src/app/page.tsx`)
- Visitors and users → Sign-in and registration: register or sign in
- Sign-in and registration → Authentication actions: submits credentials (evidence: `src/app/login/page.tsx`)
- Authentication actions → Supabase clients: creates session client (evidence: `src/lib/actions/auth.ts`)
- OAuth callback → Supabase clients: exchanges auth code (evidence: `src/app/auth/callback/route.ts`)
- Visitors and users → Dashboard: open dashboard
- Dashboard → Supabase clients: loads user data (evidence: `src/app/(main)/dashboard/page.tsx`)
- Dashboard → Prediction actions: loads predictions (evidence: `src/app/(main)/dashboard/page.tsx`)
- Visitors and users → Match predictions: submit match picks
- Match predictions → Prediction actions: submits match pick (evidence: `src/components/predictions/MatchPredictionsClient.tsx`)
- Match predictions → Player-pick actions: loads player picks (evidence: `src/components/predictions/MatchPredictionsClient.tsx`)
- Match predictions → Player picks: renders picks (evidence: `src/components/predictions/MatchPredictionsClient.tsx`)
- Player picks → Player-pick actions: saves player picks (evidence: `src/components/predictions/PlayerPicksSection.tsx`)
- Visitors and users → Tournament predictions: submit tournament picks
- Tournament predictions → Prediction actions: loads and saves picks (evidence: `src/components/predictions/TournamentPredictionsClient.tsx`)
- Visitors and users → Leaderboard views: view rankings
- Leaderboard views → Leaderboard queries: loads rankings (evidence: `src/components/leaderboard/LeaderboardClient.tsx`)
- Visitors and users → Profile and settings: manage profile
- Profile and settings → Authentication actions: updates account (evidence: `src/components/profile/ProfileClient.tsx`)
- Profile and settings → Share-card generation: generates share card (evidence: `src/components/profile/ProfileClient.tsx`)
- Profile and settings → Notification actions: manages notifications (evidence: `src/components/profile/ProfileClient.tsx`)
- Visitors and users → Shared card page: open shared card
- Visitors and users → Admin console: manage tournament
- Admin console → Supabase clients: loads admin data (evidence: `src/app/admin/page.tsx`)
- Admin management clients → Admin actions: invokes management actions (evidence: `src/components/admin/AdminMatchesClient.tsx`)
- Admin actions → Supabase clients: checks roles and manages records (evidence: `src/lib/actions/admin.ts`)
- Prediction actions → Supabase clients: reads and writes picks (evidence: `src/lib/actions/predictions.ts`)
- Player-pick actions → Supabase clients: reads and writes picks (evidence: `src/lib/actions/player-predictions.ts`)
- Leaderboard queries → Supabase clients: queries rankings (evidence: `src/lib/actions/leaderboard.ts`)
- Authentication actions → Supabase clients: authenticates and updates profiles (evidence: `src/lib/actions/auth.ts`)
- Supabase clients → Supabase data store: accesses data store
