# hossain-13/football-manager architecture

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

- Interactive diagram: https://gitdiagram.com/hossain-13/football-manager
- Repository: https://github.com/hossain-13/football-manager

## Overview

TURF is a multi-tenant matchday manager for pickup football. Players authenticate, create or join sessions by code, and use session screens to manage availability, teams, formations, schedules, live matches, standings, history, expenses, and profiles. The React app orchestrates screens and session state; its data-access layer switches between mock data and Supabase, whose Postgres policies enforce permissions. The README documents lazy loading and realtime synchronization; implementation excerpts are partial, so some feature-to-data links below rely on that documentation rather than inspected calls.

Main entry points: [`src/App.jsx`](https://github.com/hossain-13/football-manager/blob/main/src/App.jsx) (App orchestrator), [`src/lib/liveDb.js`](https://github.com/hossain-13/football-manager/blob/main/src/lib/liveDb.js) (Supabase data access), [`src/screens/LiveScreen.jsx`](https://github.com/hossain-13/football-manager/blob/main/src/screens/LiveScreen.jsx) (Live match control), [`src/lib/dataView.js`](https://github.com/hossain-13/football-manager/blob/main/src/lib/dataView.js) (Shared data view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["App orchestrator<br/>[App.jsx]"]
  node_auth["Google sign-in<br/>[AuthScreen.jsx]"]
end

subgraph group_sessions["Session management"]
  node_dashboard["Dashboard"]
  node_sessionscreen["Create or join<br/>[SessionsScreen.jsx]"]
  node_availability["Availability"]
  node_profile["Player profile<br/>[ProfileScreen.jsx]"]
  node_detail["Session details<br/>[DetailScreen.jsx]"]
end

subgraph group_matchday["Matchday operations"]
  node_teams["Teams and captains<br/>[TeamsScreen.jsx]"]
  node_formation["Tactical formations"]
  node_schedule["Fixtures and standings<br/>[ScheduleScreen.jsx]"]
  node_live["Live match control<br/>[LiveScreen.jsx]"]
  node_history["Match history<br/>[HistoryScreen.jsx]"]
  node_expenses["Fees and payments<br/>[ExpensesScreen.jsx]"]
end

subgraph group_data["Data and persistence"]
  node_dataaccess["Supabase data access<br/>[liveDb.js]"]
  node_dataview["Shared data view<br/>[dataView.js]"]
  node_mock[("Mock reference data<br/>[db.js]")]
  node_supabaseclient["Supabase client<br/>[supabase.js]"]
  node_postgres[("Postgres and RLS<br/>[schema.sql]")]
  node_realtime["Realtime sync<br/>[liveDb.js]"]
end

subgraph group_ui["Shared interface"]
  node_signature["Standings and match widgets<br/>[signature.jsx]"]
  node_core["Shared UI primitives<br/>[core.jsx]"]
  node_icons["Icon set<br/>[Icon.jsx]"]
end

node_player(("Player or organizer"))
node_google["Google OAuth"]
node_supabaseservice[("Supabase service")]

node_player -->|"uses"| node_app
node_app -->|"shows"| node_auth
node_auth -->|"starts OAuth"| node_google
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_sessionscreen
node_app -->|"routes to"| node_availability
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_teams
node_app -->|"routes to"| node_formation
node_app -->|"routes to"| node_schedule
node_app -->|"routes to"| node_live
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_expenses
node_app -->|"routes to"| node_detail
node_app -->|"loads and saves"| node_dataaccess
node_app -->|"sets active data"| node_dataview
node_dataview -->|"defaults to"| node_mock
node_dataaccess -->|"queries through"| node_supabaseclient
node_supabaseclient -->|"connects to"| node_supabaseservice
node_supabaseservice -->|"reads and writes"| node_postgres
node_supabaseservice -.->|"authenticates with"| node_google
node_supabaseservice -->|"publishes changes"| node_realtime
node_realtime -->|"patches state"| node_app
node_schedule -->|"renders standings"| node_signature
node_live -->|"uses match controls"| node_signature
node_app -->|"uses primitives"| node_core
node_core -->|"renders icons"| node_icons
node_availability -->|"reads shared data"| node_dataview
node_teams -.->|"persists team changes"| node_dataaccess
node_live -.->|"persists match state"| node_dataaccess
node_expenses -.->|"manages fee data"| node_dataaccess
node_sessionscreen -.->|"creates and joins"| node_dataaccess

click node_app "https://github.com/hossain-13/football-manager/blob/main/src/App.jsx"
click node_auth "https://github.com/hossain-13/football-manager/blob/main/src/screens/AuthScreen.jsx"
click node_dashboard "https://github.com/hossain-13/football-manager/blob/main/src/screens/DashboardScreen.jsx"
click node_sessionscreen "https://github.com/hossain-13/football-manager/blob/main/src/screens/SessionsScreen.jsx"
click node_availability "https://github.com/hossain-13/football-manager/blob/main/src/screens/AvailabilityScreen.jsx"
click node_profile "https://github.com/hossain-13/football-manager/blob/main/src/screens/ProfileScreen.jsx"
click node_teams "https://github.com/hossain-13/football-manager/blob/main/src/screens/TeamsScreen.jsx"
click node_formation "https://github.com/hossain-13/football-manager/blob/main/src/screens/FormationScreen.jsx"
click node_schedule "https://github.com/hossain-13/football-manager/blob/main/src/screens/ScheduleScreen.jsx"
click node_live "https://github.com/hossain-13/football-manager/blob/main/src/screens/LiveScreen.jsx"
click node_history "https://github.com/hossain-13/football-manager/blob/main/src/screens/HistoryScreen.jsx"
click node_expenses "https://github.com/hossain-13/football-manager/blob/main/src/screens/ExpensesScreen.jsx"
click node_detail "https://github.com/hossain-13/football-manager/blob/main/src/screens/DetailScreen.jsx"
click node_dataaccess "https://github.com/hossain-13/football-manager/blob/main/src/lib/liveDb.js"
click node_dataview "https://github.com/hossain-13/football-manager/blob/main/src/lib/dataView.js"
click node_mock "https://github.com/hossain-13/football-manager/blob/main/src/lib/db.js"
click node_supabaseclient "https://github.com/hossain-13/football-manager/blob/main/src/lib/supabase.js"
click node_postgres "https://github.com/hossain-13/football-manager/blob/main/supabase/schema.sql"
click node_realtime "https://github.com/hossain-13/football-manager/blob/main/src/lib/liveDb.js"
click node_signature "https://github.com/hossain-13/football-manager/blob/main/src/components/signature.jsx"
click node_core "https://github.com/hossain-13/football-manager/blob/main/src/components/core.jsx"
click node_icons "https://github.com/hossain-13/football-manager/blob/main/src/components/Icon.jsx"

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 toneBlue
class node_dashboard,node_sessionscreen,node_availability,node_profile,node_detail,node_supabaseservice toneAmber
class node_teams,node_formation,node_schedule,node_live,node_history,node_expenses toneMint
class node_dataaccess,node_dataview,node_mock,node_supabaseclient,node_postgres,node_realtime toneRose
class node_signature,node_core,node_icons,node_player,node_google toneIndigo
```

## Components

### Application shell

- [App orchestrator](https://github.com/hossain-13/football-manager/blob/main/src/App.jsx): `src/App.jsx`
- [Google sign-in](https://github.com/hossain-13/football-manager/blob/main/src/screens/AuthScreen.jsx): `src/screens/AuthScreen.jsx`

### Session management

- [Dashboard](https://github.com/hossain-13/football-manager/blob/main/src/screens/DashboardScreen.jsx): `src/screens/DashboardScreen.jsx`
- [Create or join](https://github.com/hossain-13/football-manager/blob/main/src/screens/SessionsScreen.jsx): `src/screens/SessionsScreen.jsx`
- [Availability](https://github.com/hossain-13/football-manager/blob/main/src/screens/AvailabilityScreen.jsx): `src/screens/AvailabilityScreen.jsx`
- [Player profile](https://github.com/hossain-13/football-manager/blob/main/src/screens/ProfileScreen.jsx): `src/screens/ProfileScreen.jsx`
- [Session details](https://github.com/hossain-13/football-manager/blob/main/src/screens/DetailScreen.jsx): `src/screens/DetailScreen.jsx`

### Matchday operations

- [Teams and captains](https://github.com/hossain-13/football-manager/blob/main/src/screens/TeamsScreen.jsx): `src/screens/TeamsScreen.jsx`
- [Tactical formations](https://github.com/hossain-13/football-manager/blob/main/src/screens/FormationScreen.jsx): `src/screens/FormationScreen.jsx`
- [Fixtures and standings](https://github.com/hossain-13/football-manager/blob/main/src/screens/ScheduleScreen.jsx): `src/screens/ScheduleScreen.jsx`
- [Live match control](https://github.com/hossain-13/football-manager/blob/main/src/screens/LiveScreen.jsx): `src/screens/LiveScreen.jsx`
- [Match history](https://github.com/hossain-13/football-manager/blob/main/src/screens/HistoryScreen.jsx): `src/screens/HistoryScreen.jsx`
- [Fees and payments](https://github.com/hossain-13/football-manager/blob/main/src/screens/ExpensesScreen.jsx): `src/screens/ExpensesScreen.jsx`

### Data and persistence

- [Supabase data access](https://github.com/hossain-13/football-manager/blob/main/src/lib/liveDb.js): `src/lib/liveDb.js`
- [Shared data view](https://github.com/hossain-13/football-manager/blob/main/src/lib/dataView.js): `src/lib/dataView.js`
- [Mock reference data](https://github.com/hossain-13/football-manager/blob/main/src/lib/db.js): `src/lib/db.js`
- [Supabase client](https://github.com/hossain-13/football-manager/blob/main/src/lib/supabase.js): `src/lib/supabase.js`
- [Postgres and RLS](https://github.com/hossain-13/football-manager/blob/main/supabase/schema.sql): `supabase/schema.sql`
- [Realtime sync](https://github.com/hossain-13/football-manager/blob/main/src/lib/liveDb.js): `src/lib/liveDb.js`

### Shared interface

- [Standings and match widgets](https://github.com/hossain-13/football-manager/blob/main/src/components/signature.jsx): `src/components/signature.jsx`
- [Shared UI primitives](https://github.com/hossain-13/football-manager/blob/main/src/components/core.jsx): `src/components/core.jsx`
- [Icon set](https://github.com/hossain-13/football-manager/blob/main/src/components/Icon.jsx): `src/components/Icon.jsx`

### Other components

- **Player or organizer**
- **Google OAuth**
- **Supabase service**

## Connections

- Player or organizer → App orchestrator: uses (evidence: `README.md`)
- App orchestrator → Google sign-in: shows (evidence: `src/App.jsx`)
- Google sign-in → Google OAuth: starts OAuth (evidence: `README.md`)
- App orchestrator → Dashboard: routes to (evidence: `src/App.jsx`)
- App orchestrator → Create or join: routes to (evidence: `src/App.jsx`)
- App orchestrator → Availability: routes to (evidence: `src/App.jsx`)
- App orchestrator → Player profile: routes to (evidence: `src/App.jsx`)
- App orchestrator → Teams and captains: routes to (evidence: `src/App.jsx`)
- App orchestrator → Tactical formations: routes to (evidence: `src/App.jsx`)
- App orchestrator → Fixtures and standings: routes to (evidence: `src/App.jsx`)
- App orchestrator → Live match control: routes to (evidence: `src/App.jsx`)
- App orchestrator → Match history: routes to (evidence: `src/App.jsx`)
- App orchestrator → Fees and payments: routes to (evidence: `src/App.jsx`)
- App orchestrator → Session details: routes to (evidence: `src/App.jsx`)
- App orchestrator → Supabase data access: loads and saves (evidence: `src/App.jsx`)
- App orchestrator → Shared data view: sets active data (evidence: `README.md`)
- Shared data view → Mock reference data: defaults to (evidence: `src/lib/dataView.js`)
- Supabase data access → Supabase client: queries through (evidence: `src/lib/liveDb.js`)
- Supabase client → Supabase service: connects to (evidence: `README.md`)
- Supabase service → Postgres and RLS: reads and writes (evidence: `README.md`)
- Supabase service → Google OAuth: authenticates with (evidence: `README.md`)
- Supabase service → Realtime sync: publishes changes (evidence: `README.md`)
- Realtime sync → App orchestrator: patches state (evidence: `README.md`)
- Fixtures and standings → Standings and match widgets: renders standings (evidence: `src/screens/ScheduleScreen.jsx`)
- Live match control → Standings and match widgets: uses match controls (evidence: `README.md`)
- App orchestrator → Shared UI primitives: uses primitives (evidence: `src/App.jsx`)
- Shared UI primitives → Icon set: renders icons (evidence: `src/components/core.jsx`)
- Availability → Shared data view: reads shared data (evidence: `src/screens/AvailabilityScreen.jsx`)
- Teams and captains → Supabase data access: persists team changes (evidence: `src/screens/TeamsScreen.jsx`)
- Live match control → Supabase data access: persists match state
- Fees and payments → Supabase data access: manages fee data
- Create or join → Supabase data access: creates and joins (evidence: `src/screens/SessionsScreen.jsx`)
