# edwin-metcalf/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/edwin-metcalf/portfolio
- Repository: https://github.com/edwin-metcalf/portfolio

## Overview

This is a personal portfolio and game-project site. Visitors browse the portfolio, or enter the games area to play Space Invaders or view Dota 2 and Clash Royale statistics; the documented stats workflow syncs public game data into a local database and presents historical trends. The graph preserves the portfolio sections, both stats domains, matchup generation, and the playable game. Backend files were indexed as read but their implementation excerpts were not provided, so backend relationships are limited to those documented in the README.

Main entry points: [`frontend/src/routes/+page.svelte`](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/%2Bpage.svelte) (Portfolio page), [`frontend/src/routes/games/game-stats/dota/+page.svelte`](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/dota/%2Bpage.svelte) (Dota dashboard), [`backend/handlers.go`](https://github.com/edwin-metcalf/portfolio/blob/main/backend/handlers.go) (HTTP handlers), [`frontend/src/lib/api.ts`](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portfolio["Portfolio site"]
  node_home["Portfolio page<br/>[+page.svelte]"]
  node_profile["About and profile<br/>[Aboutme.svelte]"]
  node_courses["Coursework<br/>[Courses.svelte]"]
  node_portfolio_sections["Portfolio sections<br/>[Portfolio.svelte]"]
end

subgraph group_gamehub["Games and play"]
  node_games_landing["Games landing<br/>[+page.svelte]"]
  node_space_page["Space Invaders page<br/>[+page.svelte]"]
  node_space_engine["Game engine<br/>[game.ts]"]
end

subgraph group_statsui["Stats interface"]
  node_stats_landing["Stats landing<br/>[+page.ts]"]
  node_dota_view["Dota dashboard<br/>[+page.svelte]"]
  node_cr_view["Clash Royale dashboard<br/>[+page.svelte]"]
  node_matchup_view["Friend matchup<br/>[+page.svelte]"]
  node_stats_models["Stats and charts<br/>[stats.ts]"]
  node_stats_cache["Stats cache"]
  node_api_helper["API client<br/>[api.ts]"]
end

subgraph group_backend["Stats backend"]
  node_backend_entry["Go service entry<br/>[main.go]"]
  node_handlers["HTTP handlers<br/>[handlers.go]"]
  node_dota_service["Dota stats service<br/>[dotaController.go]"]
  node_cr_service["Clash Royale service"]
  node_sync["Game data sync<br/>[databaseSync.go]"]
  node_database[("Stats database<br/>[database.go]")]
end

node_visitor(("Site visitor"))
node_game_apis["Public game APIs"]

node_visitor -->|"visits"| node_home
node_home -->|"renders"| node_profile
node_home -->|"renders"| node_portfolio_sections
node_home -->|"renders"| node_courses
node_visitor -.->|"opens games"| node_games_landing
node_games_landing -.->|"opens game"| node_space_page
node_visitor -.->|"plays"| node_space_page
node_space_page -->|"runs"| node_space_engine
node_visitor -.->|"opens stats"| node_stats_landing
node_stats_landing -.->|"routes to"| node_dota_view
node_stats_landing -.->|"routes to"| node_cr_view
node_dota_view -->|"requests data"| node_api_helper
node_cr_view -->|"requests data"| node_api_helper
node_matchup_view -->|"posts tags"| node_api_helper
node_dota_view -->|"builds charts"| node_stats_models
node_cr_view -->|"builds charts"| node_stats_models
node_matchup_view -->|"formats results"| node_stats_models
node_dota_view -->|"uses cache"| node_stats_cache
node_api_helper -.->|"HTTP requests"| node_handlers
node_backend_entry -.->|"serves"| node_handlers
node_handlers -.->|"dispatches"| node_dota_service
node_handlers -.->|"dispatches"| node_cr_service
node_dota_service -.->|"reads and writes"| node_database
node_cr_service -.->|"reads and writes"| node_database
node_sync -.->|"syncs data"| node_game_apis
node_sync -.->|"stores history"| node_database

click node_home "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/%2Bpage.svelte"
click node_profile "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/Aboutme.svelte"
click node_courses "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/Courses.svelte"
click node_portfolio_sections "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/Portfolio.svelte"
click node_games_landing "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/%2Bpage.svelte"
click node_space_page "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/space-invaders/%2Bpage.svelte"
click node_space_engine "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/space-invaders/game.ts"
click node_stats_landing "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/%2Bpage.ts"
click node_dota_view "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/dota/%2Bpage.svelte"
click node_cr_view "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/clash-royale/%2Bpage.svelte"
click node_matchup_view "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/clash-royale/matchup-generator/%2Bpage.svelte"
click node_stats_models "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/stats.ts"
click node_stats_cache "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/store/GameStatsCache.svelte.ts"
click node_api_helper "https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/api.ts"
click node_backend_entry "https://github.com/edwin-metcalf/portfolio/blob/main/backend/main.go"
click node_handlers "https://github.com/edwin-metcalf/portfolio/blob/main/backend/handlers.go"
click node_dota_service "https://github.com/edwin-metcalf/portfolio/blob/main/backend/dotaController.go"
click node_cr_service "https://github.com/edwin-metcalf/portfolio/blob/main/backend/clashRoyaleController.go"
click node_sync "https://github.com/edwin-metcalf/portfolio/blob/main/backend/databaseSync.go"
click node_database "https://github.com/edwin-metcalf/portfolio/blob/main/backend/database.go"

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_home,node_profile,node_courses,node_portfolio_sections toneBlue
class node_games_landing,node_space_page,node_space_engine toneAmber
class node_stats_landing,node_dota_view,node_cr_view,node_matchup_view,node_stats_models,node_stats_cache,node_api_helper,node_game_apis toneMint
class node_backend_entry,node_handlers,node_dota_service,node_cr_service,node_sync,node_database toneRose
class node_visitor toneIndigo
```

## Components

### Portfolio site

- [Portfolio page](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/%2Bpage.svelte): `frontend/src/routes/+page.svelte`
- [About and profile](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/Aboutme.svelte): `frontend/src/lib/Aboutme.svelte`
- [Coursework](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/Courses.svelte): `frontend/src/lib/Courses.svelte`
- [Portfolio sections](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/Portfolio.svelte): `frontend/src/lib/Portfolio.svelte`

### Games and play

- [Games landing](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/%2Bpage.svelte): `frontend/src/routes/games/+page.svelte`
- [Space Invaders page](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/space-invaders/%2Bpage.svelte): `frontend/src/routes/games/space-invaders/+page.svelte`
- [Game engine](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/space-invaders/game.ts): `frontend/src/routes/games/space-invaders/game.ts`

### Stats interface

- [Stats landing](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/%2Bpage.ts): `frontend/src/routes/games/game-stats/+page.ts`
- [Dota dashboard](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/dota/%2Bpage.svelte): `frontend/src/routes/games/game-stats/dota/+page.svelte`
- [Clash Royale dashboard](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/clash-royale/%2Bpage.svelte): `frontend/src/routes/games/game-stats/clash-royale/+page.svelte`
- [Friend matchup](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/clash-royale/matchup-generator/%2Bpage.svelte): `frontend/src/routes/games/game-stats/clash-royale/matchup-generator/+page.svelte`
- [Stats and charts](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/routes/games/game-stats/stats.ts): `frontend/src/routes/games/game-stats/stats.ts`
- [Stats cache](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/store/GameStatsCache.svelte.ts): `frontend/src/lib/store/GameStatsCache.svelte.ts`
- [API client](https://github.com/edwin-metcalf/portfolio/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Stats backend

- [Go service entry](https://github.com/edwin-metcalf/portfolio/blob/main/backend/main.go): `backend/main.go`
- [HTTP handlers](https://github.com/edwin-metcalf/portfolio/blob/main/backend/handlers.go): `backend/handlers.go`
- [Dota stats service](https://github.com/edwin-metcalf/portfolio/blob/main/backend/dotaController.go): `backend/dotaController.go`
- [Clash Royale service](https://github.com/edwin-metcalf/portfolio/blob/main/backend/clashRoyaleController.go): `backend/clashRoyaleController.go`
- [Game data sync](https://github.com/edwin-metcalf/portfolio/blob/main/backend/databaseSync.go): `backend/databaseSync.go`
- [Stats database](https://github.com/edwin-metcalf/portfolio/blob/main/backend/database.go): `backend/database.go`

### Other components

- **Site visitor**
- **Public game APIs**

## Connections

- Site visitor → Portfolio page: visits (evidence: `frontend/src/routes/+page.svelte`)
- Portfolio page → About and profile: renders (evidence: `frontend/src/routes/+page.svelte`)
- Portfolio page → Portfolio sections: renders (evidence: `frontend/src/routes/+page.svelte`)
- Portfolio page → Coursework: renders (evidence: `frontend/src/routes/+page.svelte`)
- Site visitor → Games landing: opens games (evidence: `README.md`)
- Games landing → Space Invaders page: opens game (evidence: `README.md`)
- Site visitor → Space Invaders page: plays (evidence: `README.md`)
- Space Invaders page → Game engine: runs (evidence: `frontend/src/routes/games/space-invaders/+page.svelte`)
- Site visitor → Stats landing: opens stats (evidence: `README.md`)
- Stats landing → Dota dashboard: routes to (evidence: `README.md`)
- Stats landing → Clash Royale dashboard: routes to (evidence: `README.md`)
- Dota dashboard → API client: requests data (evidence: `frontend/src/routes/games/game-stats/dota/+page.svelte`)
- Clash Royale dashboard → API client: requests data (evidence: `frontend/src/routes/games/game-stats/clash-royale/+page.svelte`)
- Friend matchup → API client: posts tags (evidence: `frontend/src/routes/games/game-stats/clash-royale/matchup-generator/+page.svelte`)
- Dota dashboard → Stats and charts: builds charts (evidence: `frontend/src/routes/games/game-stats/dota/+page.svelte`)
- Clash Royale dashboard → Stats and charts: builds charts (evidence: `frontend/src/routes/games/game-stats/clash-royale/+page.svelte`)
- Friend matchup → Stats and charts: formats results (evidence: `frontend/src/routes/games/game-stats/clash-royale/matchup-generator/+page.svelte`)
- Dota dashboard → Stats cache: uses cache (evidence: `frontend/src/routes/games/game-stats/dota/+page.svelte`)
- API client → HTTP handlers: HTTP requests
- Go service entry → HTTP handlers: serves (evidence: `README.md`)
- HTTP handlers → Dota stats service: dispatches
- HTTP handlers → Clash Royale service: dispatches
- Dota stats service → Stats database: reads and writes (evidence: `README.md`)
- Clash Royale service → Stats database: reads and writes (evidence: `README.md`)
- Game data sync → Public game APIs: syncs data (evidence: `README.md`)
- Game data sync → Stats database: stores history (evidence: `README.md`)
