# k1yuse/fotdata-api architecture

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

- Interactive diagram: https://gitdiagram.com/k1yuse/fotdata-api
- Repository: https://github.com/k1yuse/fotdata-api

## Overview

FotData is a football analytics site and API. The main user journey is browser requests to the FastAPI service for match predictions and related league, schedule, and team information, which the site presents alongside forecast results. A daily data-and-model refresh supports those responses. The README documents additional capabilities, including pre-match prediction tracking, season simulations, player and club information, and sharing. Several API internals and frontend modules were not sampled; links to those features rely on README statements rather than inspected implementations.

Main entry points: [`main.py`](https://github.com/k1yuse/fotdata-api/blob/main/main.py) (FastAPI service), [`update_data.py`](https://github.com/k1yuse/fotdata-api/blob/main/update_data.py) (Data refresh and training), [`landing-story.js`](https://github.com/k1yuse/fotdata-api/blob/main/landing-story.js) (Landing story), [`FotData.html`](https://github.com/k1yuse/fotdata-api/blob/main/FotData.html) (FotData site)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web experience"]
  node_web["FotData site<br/>[FotData.html]"]
  node_landing["Landing story<br/>[landing-story.js]"]
end

subgraph group_service["API and football features"]
  node_api["FastAPI service<br/>[main.py]"]
  node_match["Match predictions<br/>[main.py]"]
  node_schedule["Schedules and tables<br/>[main.py]"]
  node_season["Season simulations<br/>[main.py]"]
  node_tracking["Prediction track record<br/>[main.py]"]
  node_clubs["Club and player data<br/>[main.py]"]
  node_details["Match details<br/>[main.py]"]
  node_share["Share previews<br/>[share_card.py]"]
end

subgraph group_data["Data and modeling"]
  node_transform["API-Football transforms<br/>[af_transform.py]"]
  node_refresh["Data refresh and training<br/>[update_data.py]"]
  node_store[("Model and data cache")]
end

subgraph group_visual["Visual assets"]
  node_ballgeometry["Ball geometry<br/>[ball-geometry.js]"]
  node_bganimation["Background animation<br/>[bg-ball.js]"]
end

node_visitor(("Site visitor"))
node_footballdata["Football-Data.org"]
node_apifootball["API-Football"]

node_visitor -->|"browses"| node_web
node_web -->|"requests data"| node_api
node_landing -->|"fetches predictions"| node_api
node_api -->|"serves"| node_match
node_api -->|"serves"| node_schedule
node_api -->|"serves"| node_season
node_api -->|"serves"| node_tracking
node_api -->|"serves"| node_clubs
node_api -->|"serves"| node_details
node_api -->|"renders previews"| node_share
node_api -->|"reads cached data"| node_store
node_refresh -->|"updates models"| node_store
node_refresh -->|"collects fixtures"| node_footballdata
node_refresh -->|"collects player data"| node_apifootball
node_refresh -->|"uses transforms"| node_transform
node_api -->|"uses transforms"| node_transform
node_landing -->|"uses geometry"| node_ballgeometry
node_bganimation -->|"uses geometry"| node_ballgeometry

click node_web "https://github.com/k1yuse/fotdata-api/blob/main/FotData.html"
click node_landing "https://github.com/k1yuse/fotdata-api/blob/main/landing-story.js"
click node_api "https://github.com/k1yuse/fotdata-api/blob/main/main.py"
click node_match "https://github.com/k1yuse/fotdata-api/blob/main/main.py"
click node_schedule "https://github.com/k1yuse/fotdata-api/blob/main/main.py"
click node_season "https://github.com/k1yuse/fotdata-api/blob/main/main.py"
click node_tracking "https://github.com/k1yuse/fotdata-api/blob/main/main.py"
click node_clubs "https://github.com/k1yuse/fotdata-api/blob/main/main.py"
click node_details "https://github.com/k1yuse/fotdata-api/blob/main/main.py"
click node_share "https://github.com/k1yuse/fotdata-api/blob/main/share_card.py"
click node_transform "https://github.com/k1yuse/fotdata-api/blob/main/af_transform.py"
click node_refresh "https://github.com/k1yuse/fotdata-api/blob/main/update_data.py"
click node_store "https://github.com/k1yuse/fotdata-api/tree/main/fotdata_model"
click node_ballgeometry "https://github.com/k1yuse/fotdata-api/blob/main/ball-geometry.js"
click node_bganimation "https://github.com/k1yuse/fotdata-api/blob/main/bg-ball.js"

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_web,node_landing toneBlue
class node_api,node_match,node_schedule,node_season,node_tracking,node_clubs,node_details,node_share toneAmber
class node_transform,node_refresh,node_store,node_apifootball toneMint
class node_ballgeometry,node_bganimation toneRose
class node_visitor,node_footballdata toneIndigo
```

## Components

### Web experience

- [FotData site](https://github.com/k1yuse/fotdata-api/blob/main/FotData.html): `FotData.html`
- [Landing story](https://github.com/k1yuse/fotdata-api/blob/main/landing-story.js): `landing-story.js`

### API and football features

- [FastAPI service](https://github.com/k1yuse/fotdata-api/blob/main/main.py): `main.py`
- [Match predictions](https://github.com/k1yuse/fotdata-api/blob/main/main.py): `main.py`
- [Schedules and tables](https://github.com/k1yuse/fotdata-api/blob/main/main.py): `main.py`
- [Season simulations](https://github.com/k1yuse/fotdata-api/blob/main/main.py): `main.py`
- [Prediction track record](https://github.com/k1yuse/fotdata-api/blob/main/main.py): `main.py`
- [Club and player data](https://github.com/k1yuse/fotdata-api/blob/main/main.py): `main.py`
- [Match details](https://github.com/k1yuse/fotdata-api/blob/main/main.py): `main.py`
- [Share previews](https://github.com/k1yuse/fotdata-api/blob/main/share_card.py): `share_card.py`

### Data and modeling

- [API-Football transforms](https://github.com/k1yuse/fotdata-api/blob/main/af_transform.py): `af_transform.py`
- [Data refresh and training](https://github.com/k1yuse/fotdata-api/blob/main/update_data.py): `update_data.py`
- [Model and data cache](https://github.com/k1yuse/fotdata-api/tree/main/fotdata_model): `fotdata_model`

### Visual assets

- [Ball geometry](https://github.com/k1yuse/fotdata-api/blob/main/ball-geometry.js): `ball-geometry.js`
- [Background animation](https://github.com/k1yuse/fotdata-api/blob/main/bg-ball.js): `bg-ball.js`

### Other components

- **Site visitor**
- **Football-Data.org**
- **API-Football**

## Connections

- Site visitor → FotData site: browses (evidence: `README.md`)
- FotData site → FastAPI service: requests data (evidence: `README.md`)
- Landing story → FastAPI service: fetches predictions (evidence: `landing-story.js`)
- FastAPI service → Match predictions: serves (evidence: `README.md`)
- FastAPI service → Schedules and tables: serves (evidence: `README.md`)
- FastAPI service → Season simulations: serves (evidence: `README.md`)
- FastAPI service → Prediction track record: serves (evidence: `README.md`)
- FastAPI service → Club and player data: serves (evidence: `README.md`)
- FastAPI service → Match details: serves (evidence: `main.py`)
- FastAPI service → Share previews: renders previews (evidence: `share_card.py`)
- FastAPI service → Model and data cache: reads cached data (evidence: `README.md`)
- Data refresh and training → Model and data cache: updates models (evidence: `README.md`)
- Data refresh and training → Football-Data.org: collects fixtures (evidence: `README.md`)
- Data refresh and training → API-Football: collects player data (evidence: `README.md`)
- Data refresh and training → API-Football transforms: uses transforms (evidence: `update_data.py`)
- FastAPI service → API-Football transforms: uses transforms (evidence: `main.py`)
- Landing story → Ball geometry: uses geometry (evidence: `landing-story.js`)
- Background animation → Ball geometry: uses geometry (evidence: `bg-ball.js`)
