# sivakumar89/mslearn-tailspin-spacegame-web architecture

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

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

## Overview

##### Project type and purpose
- This is a full-stack ASP.NET Core MVC web application called “Tailspin.SpaceGame.Web.”
- It provides a simple leaderboard and profile system for a hypothetical space game, storing player profiles and scores in Azure Cosmos DB (DocumentDB).

##### File structure
- Top‐level solution (.sln) with a single web project (Tailspin.SpaceGame.Web).
- MVC folders:
- Controllers – route handlers (HomeController).
- Models – domain and view-model classes (Profile, Score, ErrorViewModel, etc.).
- Views – Razor templates under Views/Home and Views/Shared.
- Data/repository:
- IDocumentDBRepository interface and two implementations (LocalDocumentDBRepository for local JSON files, plus a cloud DocumentDB repo).
- SampleData folder containing JSON seed files for local dev.
- Static assets:
- wwwroot/css, js, images, and lib (Bootstrap, jQuery, validation).
- Configuration:
- appsettings.json / appsettings.Development.json
- Startup.cs and Program.cs for ASP.NET Core host setup.
- Build & CI/CD:
- gulpfile.js, package.json, package-lock.json for frontend build tasks.
- azure-pipelines.yml for Microsoft DevOps pipeline.

##### README
- The README contains licensing and contribution guidelines only—no architecture details.
- Architecture must be inferred from code structure and config files.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client/UI Layer
    subgraph "Client/UI Layer"
        Browser["Web Browser"]:::client
        StaticAssets["Static Assets\n(wwwroot/css, js, images)"]:::compute
    end

    %% Server/App Layer
    subgraph "Server/App Layer"
        subgraph "ASP.NET Core MVC App\n(Tailspin.SpaceGame.Web)" 
            Program["Program.cs"]:::compute
            Startup["Startup.cs"]:::compute
            Controllers["HomeController"]:::compute
            subgraph "View Engine & Views"
                ViewsEngine["Razor View Engine"]:::compute
            end
            subgraph "Models"
                ProfileModel["Profile.cs"]:::compute
                ScoreModel["Score.cs"]:::compute
                LeaderboardVM["LeaderboardViewModel.cs"]:::compute
                ProfileVM["ProfileViewModel.cs"]:::compute
                ErrorVM["ErrorViewModel.cs"]:::compute
            end
            subgraph "Repository Layer"
                IDocRepo["IDocumentDBRepository.cs"]:::compute
                LocalRepo["LocalDocumentDBRepository.cs"]:::compute
            end
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        CosmosDB["Azure Cosmos DB"]:::data
        JSONFiles["Local JSON Store\nprofiles.json, scores.json"]:::data
    end

    %% Build & Deploy
    subgraph "Build & Deploy"
        NPM["npm\n(package.json)"]:::build
        Gulp["Gulp Tasks\n(gulpfile.js)"]:::build
        AzurePipelines["Azure Pipelines\n(azure-pipelines.yml)"]:::build
        AppService["Azure App Service"]:::compute
    end

    %% Connections
    Browser -->|"HTTP(S) Request"| Program
    Program --> Startup
    Startup --> Controllers
    Controllers -->|"uses"| IDocRepo
    IDocRepo --> LocalRepo
    LocalRepo --> JSONFiles
    IDocRepo --> CosmosDB
    Controllers --> ViewsEngine
    ViewsEngine --> Browser
    Browser --> StaticAssets
    StaticAssets --> Browser

    NPM --> Gulp
    Gulp -->|"build assets"| StaticAssets
    AzurePipelines -->|"CI/CD Pipeline"| Gulp
    AzurePipelines -->|"deploy"| AppService
    AppService --> Program

    %% Click Events
    click TailspinSpaceGameWeb "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/tree/master/Tailspin.SpaceGame.Web/"
    click TailspinSpaceGameWebSln "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web.sln"
    click Program "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/Program.cs"
    click Startup "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/Startup.cs"
    click Controllers "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/Controllers/HomeController.cs"
    click ProfileModel "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/Models/Profile.cs"
    click ScoreModel "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/Models/Score.cs"
    click LeaderboardVM "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/Models/LeaderboardViewModel.cs"
    click ProfileVM "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/Models/ProfileViewModel.cs"
    click ErrorVM "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/Models/ErrorViewModel.cs"
    click IDocRepo "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/IDocumentDBRepository.cs"
    click LocalRepo "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/LocalDocumentDBRepository.cs"
    click JSONFiles "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/SampleData/profiles.json"
    click JSONFiles "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/Tailspin.SpaceGame.Web/SampleData/scores.json"
    click NPM "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/package.json"
    click Gulp "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/gulpfile.js"
    click AzurePipelines "https://github.com/sivakumar89/mslearn-tailspin-spacegame-web/blob/master/azure-pipelines.yml"

    %% Styles
    classDef compute fill:#E0F7FA,stroke:#006064,color:#006064;
    classDef data fill:#E8F5E9,stroke:#2E7D32,color:#2E7D32,stroke-dasharray: 5 5;
    classDef build fill:#FFF3E0,stroke:#EF6C00,color:#EF6C00;
    classDef client fill:#ECEFF1,stroke:#546E7A,color:#546E7A;
```
