# susutae/fpl-settlement-room architecture

> Architecture diagram of the GitHub repository susutae/fpl-settlement-room, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/susutae/fpl-settlement-room
- Repository: https://github.com/susutae/fpl-settlement-room

## Overview

FPL Settlement Room is a league dashboard whose main workflow loads mini-league standings and manager gameweek histories, ranks weekly results, and presents weekly and season settlement totals. The client page also supports cup selections, persisted display/proxy settings, and sample-data fallback; a same-origin route relays FPL API requests. Scoring and orchestration are concentrated in the page module. The excerpts do not show every rendering or storage helper, so the graph keeps those responsibilities at the page level and omits unverified internal links.

Main entry points: [`app/page.tsx`](https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx) (Dashboard page), [`app/api/fpl/route.ts`](https://github.com/susutae/fpl-settlement-room/blob/main/app/api/fpl/route.ts) (FPL API relay)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_page["Dashboard page<br/>[page.tsx]"]
  node_settings["Display settings<br/>[page.tsx]"]
end

subgraph group_live_data["Live FPL Data"]
  node_league_loader["League loader<br/>[page.tsx]"]
  node_history_loader["History loader<br/>[page.tsx]"]
  node_fpl_relay["FPL API relay<br/>[route.ts]"]
end

subgraph group_settlement["Settlement"]
  node_weekly_ranking["Weekly ranking<br/>[page.tsx]"]
  node_settlement_totals["Settlement totals<br/>[page.tsx]"]
  node_sample_data["Sample data fallback<br/>[page.tsx]"]
end

node_manager(("League manager"))
node_browser_storage[("Browser storage")]
node_fpl_api["FPL API"]

node_manager -->|"views"| node_dashboard_page
node_dashboard_page -->|"refreshes"| node_league_loader
node_league_loader -->|"requests data"| node_fpl_relay
node_history_loader -->|"requests histories"| node_fpl_relay
node_fpl_relay -->|"fetches API"| node_fpl_api
node_league_loader -->|"ranks weeks"| node_weekly_ranking
node_history_loader -->|"provides scores"| node_weekly_ranking
node_weekly_ranking -->|"feeds weekly totals"| node_settlement_totals
node_dashboard_page -->|"projects awards"| node_settlement_totals
node_dashboard_page -->|"falls back"| node_sample_data
node_manager -->|"configures"| node_settings
node_settings -->|"persists settings"| node_browser_storage

click node_dashboard_page "https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx"
click node_settings "https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx"
click node_league_loader "https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx"
click node_history_loader "https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx"
click node_fpl_relay "https://github.com/susutae/fpl-settlement-room/blob/main/app/api/fpl/route.ts"
click node_weekly_ranking "https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx"
click node_settlement_totals "https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx"
click node_sample_data "https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx"

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_dashboard_page,node_settings toneBlue
class node_league_loader,node_history_loader,node_fpl_relay,node_browser_storage toneAmber
class node_weekly_ranking,node_settlement_totals,node_sample_data,node_fpl_api toneMint
class node_manager toneIndigo
```

## Components

### Dashboard

- [Dashboard page](https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx): `app/page.tsx`
- [Display settings](https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx): `app/page.tsx`

### Live FPL Data

- [League loader](https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx): `app/page.tsx`
- [History loader](https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx): `app/page.tsx`
- [FPL API relay](https://github.com/susutae/fpl-settlement-room/blob/main/app/api/fpl/route.ts): `app/api/fpl/route.ts`

### Settlement

- [Weekly ranking](https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx): `app/page.tsx`
- [Settlement totals](https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx): `app/page.tsx`
- [Sample data fallback](https://github.com/susutae/fpl-settlement-room/blob/main/app/page.tsx): `app/page.tsx`

### Other components

- **League manager**
- **Browser storage**
- **FPL API**

## Connections

- League manager → Dashboard page: views (evidence: `README.md`)
- Dashboard page → League loader: refreshes (evidence: `app/page.tsx`)
- League loader → FPL API relay: requests data (evidence: `README.md`)
- History loader → FPL API relay: requests histories (evidence: `README.md`)
- FPL API relay → FPL API: fetches API (evidence: `app/api/fpl/route.ts`)
- League loader → Weekly ranking: ranks weeks (evidence: `app/page.tsx`)
- History loader → Weekly ranking: provides scores (evidence: `app/page.tsx`)
- Weekly ranking → Settlement totals: feeds weekly totals (evidence: `app/page.tsx`)
- Dashboard page → Settlement totals: projects awards (evidence: `app/page.tsx`)
- Dashboard page → Sample data fallback: falls back (evidence: `app/page.tsx`)
- League manager → Display settings: configures (evidence: `README.md`)
- Display settings → Browser storage: persists settings (evidence: `README.md`)
