# mastrogpt/fantacalcio-project architecture

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

- Interactive diagram: https://gitdiagram.com/mastrogpt/fantacalcio-project
- Repository: https://github.com/mastrogpt/fantacalcio-project
- Video tour (about a minute): https://gitdiagram.com/mastrogpt/fantacalcio-project/video

## Overview

Nuvolaris MastroGPT is a Fantacalcio companion: users browse players and statistics, read football articles, and can ask an AI chatbot for fantasy-team advice. The frontend routes invoke data services, while a Python serverless entry point dispatches model operations against persistent domain data. The sampled sources substantiate the player-statistics request and backend dispatch; article, player-list, and chatbot internals are represented only where supported by the tree or documented capabilities. The README notes that chatbot and article functions are unavailable in frontend-only setup.

Main entry points: [`src/routes/players/[id]/+page.svelte`](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/routes/players/%5Bid%5D/%2Bpage.svelte) (Player profile), [`packages/db/main/__main__.py`](https://github.com/mastrogpt/fantacalcio-project/blob/main/packages/db/main/__main__.py) (Model dispatcher), [`src/lib/service/fantaicalcio/getArticles.ts`](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/service/fantaicalcio/getArticles.ts) (Article service), [`src/routes/players/+page.svelte`](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/routes/players/%2Bpage.svelte) (Player directory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web experience"]
  node_players_list["Player directory<br/>[+page.svelte]"]
  node_player_profile["Player profile<br/>[+page.svelte]"]
  node_chat_widget["Chat interface<br/>[Widget.svelte]"]
  node_chat_state["Chat state<br/>[store.ts]"]
  node_chat_service["Chat service<br/>[nuvBot.ts]"]
end

subgraph group_content["Articles"]
  node_article_pages["Article pages<br/>[+page.svelte]"]
  node_article_tag["Article tags<br/>[+page.svelte]"]
  node_article_service["Article service<br/>[getArticles.ts]"]
end

subgraph group_football["Football data"]
  node_player_service["Player service<br/>[getPlayers.ts]"]
  node_stats_service["Statistics service<br/>[getStats.ts]"]
end

subgraph group_backend["Serverless data"]
  node_db_entry["Model dispatcher<br/>[__main__.py]"]
  node_domain_models["Football models"]
end

node_visitor(("Fantacalcio user"))
node_api{{"Nuvolaris API"}}
node_postgres[("PostgreSQL")]
node_redis[("Redis cache")]
node_ai_service{{"AI assistant"}}

node_visitor -->|"browses"| node_players_list
node_players_list -->|"loads players"| node_player_service
node_visitor -->|"opens profile"| node_player_profile
node_player_profile -->|"loads statistics"| node_stats_service
node_player_profile -->|"loads related articles"| node_article_service
node_stats_service -->|"requests stats"| node_api
node_visitor -->|"reads articles"| node_article_pages
node_article_pages -->|"loads articles"| node_article_service
node_visitor -->|"filters articles"| node_article_tag
node_article_tag -->|"loads articles"| node_article_service
node_visitor -->|"asks advice"| node_chat_widget
node_chat_widget -->|"updates conversation"| node_chat_state
node_chat_state -->|"sends message"| node_chat_service
node_chat_service -.->|"requests response"| node_ai_service
node_api -->|"dispatches model request"| node_db_entry
node_db_entry -->|"dispatches by model"| node_domain_models
node_domain_models -->|"reads and writes"| node_postgres
node_db_entry -->|"clears cache"| node_redis

click node_players_list "https://github.com/mastrogpt/fantacalcio-project/blob/main/src/routes/players/%2Bpage.svelte"
click node_player_profile "https://github.com/mastrogpt/fantacalcio-project/blob/main/src/routes/players/%5Bid%5D/%2Bpage.svelte"
click node_chat_widget "https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/components/widget/Widget.svelte"
click node_chat_state "https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/store/store.ts"
click node_chat_service "https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/service/nuvBot.ts"
click node_article_pages "https://github.com/mastrogpt/fantacalcio-project/blob/main/src/routes/articles/%5Bslug%5D/%2Bpage.svelte"
click node_article_tag "https://github.com/mastrogpt/fantacalcio-project/blob/main/src/routes/articles/tags%3D%5Bname%5D/%2Bpage.svelte"
click node_article_service "https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/service/fantaicalcio/getArticles.ts"
click node_player_service "https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/service/fantaicalcio/getPlayers.ts"
click node_stats_service "https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/service/fantaicalcio/getStats.ts"
click node_db_entry "https://github.com/mastrogpt/fantacalcio-project/blob/main/packages/db/main/__main__.py"
click node_domain_models "https://github.com/mastrogpt/fantacalcio-project/tree/main/packages/db/main/models"

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_players_list,node_player_profile,node_chat_widget,node_chat_state,node_chat_service,node_visitor toneBlue
class node_article_pages,node_article_tag,node_article_service,node_postgres,node_redis toneAmber
class node_player_service,node_stats_service,node_api toneMint
class node_db_entry,node_domain_models toneRose
class node_ai_service toneIndigo
```

## Components

### Web experience

- [Player directory](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/routes/players/%2Bpage.svelte): `src/routes/players/+page.svelte`
- [Player profile](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/routes/players/%5Bid%5D/%2Bpage.svelte): `src/routes/players/[id]/+page.svelte`
- [Chat interface](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/components/widget/Widget.svelte): `src/lib/components/widget/Widget.svelte`
- [Chat state](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/store/store.ts): `src/lib/store/store.ts`
- [Chat service](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/service/nuvBot.ts): `src/lib/service/nuvBot.ts`

### Articles

- [Article pages](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/routes/articles/%5Bslug%5D/%2Bpage.svelte): `src/routes/articles/[slug]/+page.svelte`
- [Article tags](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/routes/articles/tags%3D%5Bname%5D/%2Bpage.svelte): `src/routes/articles/tags=[name]/+page.svelte`
- [Article service](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/service/fantaicalcio/getArticles.ts): `src/lib/service/fantaicalcio/getArticles.ts`

### Football data

- [Player service](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/service/fantaicalcio/getPlayers.ts): `src/lib/service/fantaicalcio/getPlayers.ts`
- [Statistics service](https://github.com/mastrogpt/fantacalcio-project/blob/main/src/lib/service/fantaicalcio/getStats.ts): `src/lib/service/fantaicalcio/getStats.ts`

### Serverless data

- [Model dispatcher](https://github.com/mastrogpt/fantacalcio-project/blob/main/packages/db/main/__main__.py): `packages/db/main/__main__.py`
- [Football models](https://github.com/mastrogpt/fantacalcio-project/tree/main/packages/db/main/models): `packages/db/main/models`

### Other components

- **Fantacalcio user**
- **Nuvolaris API**
- **PostgreSQL**
- **Redis cache**
- **AI assistant**

## Connections

- Fantacalcio user → Player directory: browses
- Player directory → Player service: loads players
- Fantacalcio user → Player profile: opens profile
- Player profile → Statistics service: loads statistics
- Player profile → Article service: loads related articles
- Statistics service → Nuvolaris API: requests stats
- Fantacalcio user → Article pages: reads articles
- Article pages → Article service: loads articles
- Fantacalcio user → Article tags: filters articles
- Article tags → Article service: loads articles
- Fantacalcio user → Chat interface: asks advice
- Chat interface → Chat state: updates conversation
- Chat state → Chat service: sends message
- Chat service → AI assistant: requests response
- Nuvolaris API → Model dispatcher: dispatches model request
- Model dispatcher → Football models: dispatches by model
- Football models → PostgreSQL: reads and writes
- Model dispatcher → Redis cache: clears cache
