# sdk2575/mslearn-tailspin-spacegame-web architecture

> Architecture diagram of the GitHub repository sdk2575/mslearn-tailspin-spacegame-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sdk2575/mslearn-tailspin-spacegame-web
- Repository: https://github.com/sdk2575/mslearn-tailspin-spacegame-web

## Overview

Tailspin SpaceGame Web is an ASP.NET MVC leaderboard and player-profile viewer. A browser request reaches HomeController: the leaderboard action filters, sorts, and pages scores, fetches each score’s profile, and returns a view model; the profile action fetches one profile and returns its view. Startup wires these requests to JSON-backed in-memory repositories. The graph reflects the sampled controller, repository, and startup code; view rendering is represented by the controller’s View results, while unsampled view details are not inferred.

Main entry points: [`Tailspin.SpaceGame.Web/Controllers/HomeController.cs`](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Controllers/HomeController.cs) (Home controller), [`Tailspin.SpaceGame.Web/Startup.cs`](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Startup.cs) (Web startup), [`Tailspin.SpaceGame.Web/IDocumentDBRepository.cs`](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/IDocumentDBRepository.cs) (Repository contract), [`Tailspin.SpaceGame.Web/Models/Model.cs`](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/Model.cs) (Base data model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_startup["Web startup<br/>[Startup.cs]"]
  node_program["Web host<br/>[Program.cs]"]
  node_home["Home controller<br/>[HomeController.cs]"]
  node_leaderboard_view["Leaderboard page<br/>[Index.cshtml]"]
  node_profile_view["Profile page<br/>[Profile.cshtml]"]
  node_privacy_view["Privacy page<br/>[Privacy.cshtml]"]
  node_error_view["Error page<br/>[Error.cshtml]"]
end

subgraph group_domain["Game data"]
  node_score["Score model<br/>[Score.cs]"]
  node_profile["Profile model<br/>[Profile.cs]"]
  node_model["Base data model<br/>[Model.cs]"]
  node_leaderboard_vm["Leaderboard model"]
  node_profile_vm["Profile model"]
  node_error_vm["Error model<br/>[ErrorViewModel.cs]"]
end

subgraph group_storage["Data access"]
  node_repository_api["Repository contract"]
  node_local_repository["Local repository"]
  node_scores_data["Scores JSON<br/>[scores.json]"]
  node_profiles_data["Profiles JSON<br/>[profiles.json]"]
end

node_visitor(("Browser visitor"))

node_program -->|"uses startup"| node_startup
node_startup -->|"routes requests"| node_home
node_startup -->|"registers stores"| node_local_repository
node_startup -->|"configures scores"| node_scores_data
node_startup -->|"configures profiles"| node_profiles_data
node_local_repository -->|"implements"| node_repository_api
node_home -->|"queries scores"| node_repository_api
node_home -->|"fetches profiles"| node_repository_api
node_home -->|"filters and sorts"| node_score
node_home -->|"combines profile"| node_profile
node_home -->|"builds view model"| node_leaderboard_vm
node_home -->|"builds view model"| node_profile_vm
node_home -->|"builds error model"| node_error_vm
node_home -->|"returns view"| node_leaderboard_view
node_home -->|"returns view"| node_profile_view
node_home -->|"returns view"| node_privacy_view
node_home -->|"returns view"| node_error_view
node_visitor -.->|"requests page"| node_home
node_score -->|"inherits"| node_model
node_profile -->|"inherits"| node_model
node_repository_api -->|"constrains items"| node_model

click node_startup "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Startup.cs"
click node_program "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Program.cs"
click node_home "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Controllers/HomeController.cs"
click node_leaderboard_view "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Views/Home/Index.cshtml"
click node_profile_view "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Views/Home/Profile.cshtml"
click node_privacy_view "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Views/Home/Privacy.cshtml"
click node_error_view "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Views/Shared/Error.cshtml"
click node_score "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/Score.cs"
click node_profile "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/Profile.cs"
click node_model "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/Model.cs"
click node_leaderboard_vm "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/LeaderboardViewModel.cs"
click node_profile_vm "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/ProfileViewModel.cs"
click node_error_vm "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/ErrorViewModel.cs"
click node_repository_api "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/IDocumentDBRepository.cs"
click node_local_repository "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/LocalDocumentDBRepository.cs"
click node_scores_data "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/SampleData/scores.json"
click node_profiles_data "https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/SampleData/profiles.json"

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_startup,node_program,node_home,node_leaderboard_view,node_profile_view,node_privacy_view,node_error_view,node_visitor toneBlue
class node_score,node_profile,node_model,node_leaderboard_vm,node_profile_vm,node_error_vm toneAmber
class node_repository_api,node_local_repository,node_scores_data,node_profiles_data toneMint
```

## Components

### Web application

- [Web startup](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Startup.cs): `Tailspin.SpaceGame.Web/Startup.cs`
- [Web host](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Program.cs): `Tailspin.SpaceGame.Web/Program.cs`
- [Home controller](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Controllers/HomeController.cs): `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`
- [Leaderboard page](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Views/Home/Index.cshtml): `Tailspin.SpaceGame.Web/Views/Home/Index.cshtml`
- [Profile page](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Views/Home/Profile.cshtml): `Tailspin.SpaceGame.Web/Views/Home/Profile.cshtml`
- [Privacy page](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Views/Home/Privacy.cshtml): `Tailspin.SpaceGame.Web/Views/Home/Privacy.cshtml`
- [Error page](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Views/Shared/Error.cshtml): `Tailspin.SpaceGame.Web/Views/Shared/Error.cshtml`

### Game data

- [Score model](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/Score.cs): `Tailspin.SpaceGame.Web/Models/Score.cs`
- [Profile model](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/Profile.cs): `Tailspin.SpaceGame.Web/Models/Profile.cs`
- [Base data model](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/Model.cs): `Tailspin.SpaceGame.Web/Models/Model.cs`
- [Leaderboard model](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/LeaderboardViewModel.cs): `Tailspin.SpaceGame.Web/Models/LeaderboardViewModel.cs`
- [Profile model](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/ProfileViewModel.cs): `Tailspin.SpaceGame.Web/Models/ProfileViewModel.cs`
- [Error model](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/Models/ErrorViewModel.cs): `Tailspin.SpaceGame.Web/Models/ErrorViewModel.cs`

### Data access

- [Repository contract](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/IDocumentDBRepository.cs): `Tailspin.SpaceGame.Web/IDocumentDBRepository.cs`
- [Local repository](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/LocalDocumentDBRepository.cs): `Tailspin.SpaceGame.Web/LocalDocumentDBRepository.cs`
- [Scores JSON](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/SampleData/scores.json): `Tailspin.SpaceGame.Web/SampleData/scores.json`
- [Profiles JSON](https://github.com/sdk2575/mslearn-tailspin-spacegame-web/blob/main/Tailspin.SpaceGame.Web/SampleData/profiles.json): `Tailspin.SpaceGame.Web/SampleData/profiles.json`

### Other components

- **Browser visitor**

## Connections

- Web host → Web startup: uses startup (evidence: `Tailspin.SpaceGame.Web/Program.cs`)
- Web startup → Home controller: routes requests (evidence: `Tailspin.SpaceGame.Web/Startup.cs`)
- Web startup → Local repository: registers stores (evidence: `Tailspin.SpaceGame.Web/Startup.cs`)
- Web startup → Scores JSON: configures scores (evidence: `Tailspin.SpaceGame.Web/Startup.cs`)
- Web startup → Profiles JSON: configures profiles (evidence: `Tailspin.SpaceGame.Web/Startup.cs`)
- Local repository → Repository contract: implements (evidence: `Tailspin.SpaceGame.Web/LocalDocumentDBRepository.cs`)
- Home controller → Repository contract: queries scores (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Home controller → Repository contract: fetches profiles (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Home controller → Score model: filters and sorts (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Home controller → Profile model: combines profile (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Home controller → Leaderboard model: builds view model (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Home controller → Profile model: builds view model (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Home controller → Error model: builds error model (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Home controller → Leaderboard page: returns view (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Home controller → Profile page: returns view (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Home controller → Privacy page: returns view (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Home controller → Error page: returns view (evidence: `Tailspin.SpaceGame.Web/Controllers/HomeController.cs`)
- Browser visitor → Home controller: requests page
- Score model → Base data model: inherits (evidence: `Tailspin.SpaceGame.Web/Models/Score.cs`)
- Profile model → Base data model: inherits (evidence: `Tailspin.SpaceGame.Web/Models/Profile.cs`)
- Repository contract → Base data model: constrains items (evidence: `Tailspin.SpaceGame.Web/IDocumentDBRepository.cs`)
