# rflowers45/stockinvestinggame architecture

> Architecture diagram of the GitHub repository rflowers45/stockinvestinggame, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rflowers45/stockinvestinggame
- Repository: https://github.com/rflowers45/stockinvestinggame

## Overview

##### Project type and purpose
- This is a monolithic full-stack web application built with ASP.NET Core Razor Pages.
- Purpose: a stock investment game that simulates buying/selling stocks based on historical totals (CS3750 assignment).

##### File structure
- Top level:
- StockInvestingGame.sln – .NET solution file
- StockInvestingGame/ – main web application
- Inside StockInvestingGame/:
- Pages/ – Razor Pages views and their C# handlers (.cshtml + .cshtml.cs)
- Program.cs – entry point, middleware, routing, DI setup
- appsettings.json + appsettings.Development.json – configuration
- wwwroot/ – static assets (css, js, images, Bootstrap, jQuery, validation libs)
- StockInvestingGame.csproj – project definition
- No database migrations or Data/ folder; likely in-memory or external API for stock data.

##### README
- Confirms the game simulates stock market investing by looking at prior totals.
- No explicit mention of a persistent database—assume business logic lives in StockData.cs or calls an external stock API.

##### Main components
a. User’s Web Browser (Client)
b. ASP.NET Core Web Server (Kestrel/IIS)
- Program.cs / Startup: config + middleware
- Razor Pages UI layer (Pages/*.cshtml)
- Business Logic layer (StockData.cs + page handler code-behind)
- Configuration (appsettings.json)
c. Static File Server (wwwroot)
- CSS (site.css, Bootstrap)
- JS (site.js, jQuery, validation)
d. External Stock Data API or Service (if applicable)
e. (Optional) Database or In-Memory Store for persistency

##### Relationships & interactions
- Client ↔ Web Server over HTTP/HTTPS
- Razor Pages render dynamic HTML by combining cshtml templates + handler logic
- Business Logic may call:
- External stock data API (REST)
- In-memory or DB store for user portfolios
- Static File Server serves JS/CSS libraries to the client

##### Architectural patterns & design principles
- MVVM‐style Razor Pages (UI separated from handler logic)
- Dependency Injection configured in Program.cs
- Single-tier monolith (no microservices)
- Clear separation of concerns:
- Presentation layer (Pages + static assets)
- Business logic layer (StockData.cs, handlers)
- Configuration & hosting layer (Program.cs, appsettings)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        Browser["User's Web Browser"]:::frontend
        subgraph "Static Assets (wwwroot)"
            CSS["site.css"]:::frontend
            JS["site.js"]:::frontend
            LibsBootstrap["bootstrap/"]:::frontend
            LibsJQuery["jquery/"]:::frontend
            LibsVal["jquery-validation/"]:::frontend
            LibsValUnob["jquery-validation-unobtrusive/"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend Layer"
        Solution["StockInvestingGame.sln"]:::project
        Project["StockInvestingGame.csproj"]:::project
        Properties["launchSettings.json"]:::project
        Readme["README.md"]:::project

        Program["Program.cs\n(Hosting & Middleware)"]:::backend
        Config1["appsettings.json"]:::config
        Config2["appsettings.Development.json"]:::config

        subgraph "Razor Pages (Pages/)"
            Index["Index.cshtml"]:::backend
            IndexHandler["Index.cshtml.cs"]:::backend
            Privacy["Privacy.cshtml"]:::backend
            PrivacyHandler["Privacy.cshtml.cs"]:::backend
            Error["Error.cshtml"]:::backend
            ErrorHandler["Error.cshtml.cs"]:::backend
            subgraph "Shared"
                Layout["_Layout.cshtml"]:::backend
                LayoutCSS["_Layout.cshtml.css"]:::backend
                ValidationPartial["_ValidationScriptsPartial.cshtml"]:::backend
                ViewImports["_ViewImports.cshtml"]:::backend
                ViewStart["_ViewStart.cshtml"]:::backend
            end
        end

        Business["StockData.cs\n(Business Logic)"]:::backend
    end

    External["External Stock Data API"]:::external

    %% Relationships
    Browser -->|HTTP Request| Program
    Browser -->|GET CSS/JS| CSS
    Browser -->|GET CSS/JS| JS
    Program -->|Serves Static Files| CSS
    Program -->|Serves Static Files| JS
    Program -->|Serves Static Files| LibsBootstrap
    Program -->|Serves Static Files| LibsJQuery
    Program -->|Serves Static Files| LibsVal
    Program -->|Serves Static Files| LibsValUnob

    Program -->|Uses Config| Config1
    Program -->|Uses Config| Config2
    Program -->|Routing & Middleware| Index
    Program -->|Routing & Middleware| Privacy
    Program -->|Routing & Middleware| Error
    Program -->|Routing & Middleware| Business

    Index -->|Handler Calls| Business
    Privacy -->|Handler Calls| Business
    Error -->|Handler Calls| Business

    Business -->|REST Calls| External

    Solution -->|References| Program
    Solution -->|References| Project
    Solution -->|Includes| Readme
    Solution -->|Includes| Properties

    %% Click Events
    click Solution "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame.sln"
    click Program "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Program.cs"
    click Config1 "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/appsettings.json"
    click Config2 "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/appsettings.Development.json"
    click Index "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/Index.cshtml"
    click IndexHandler "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/Index.cshtml.cs"
    click Privacy "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/Privacy.cshtml"
    click PrivacyHandler "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/Privacy.cshtml.cs"
    click Error "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/Error.cshtml"
    click ErrorHandler "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/Error.cshtml.cs"
    click Layout "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/Shared/_Layout.cshtml"
    click LayoutCSS "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/Shared/_Layout.cshtml.css"
    click ValidationPartial "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/Shared/_ValidationScriptsPartial.cshtml"
    click ViewImports "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/_ViewImports.cshtml"
    click ViewStart "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/_ViewStart.cshtml"
    click Business "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Pages/StockData.cs"
    click CSS "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/wwwroot/css/site.css"
    click JS "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/wwwroot/js/site.js"
    click LibsBootstrap "https://github.com/rflowers45/stockinvestinggame/tree/master/StockInvestingGame/wwwroot/lib/bootstrap/"
    click LibsJQuery "https://github.com/rflowers45/stockinvestinggame/tree/master/StockInvestingGame/wwwroot/lib/jquery/"
    click LibsVal "https://github.com/rflowers45/stockinvestinggame/tree/master/StockInvestingGame/wwwroot/lib/jquery-validation/"
    click LibsValUnob "https://github.com/rflowers45/stockinvestinggame/tree/master/StockInvestingGame/wwwroot/lib/jquery-validation-unobtrusive/"
    click Project "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/StockInvestingGame.csproj"
    click Properties "https://github.com/rflowers45/stockinvestinggame/blob/master/StockInvestingGame/Properties/launchSettings.json"
    click Readme "https://github.com/rflowers45/stockinvestinggame/blob/master/README.md"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef config fill:#98FB98,stroke:#333,stroke-width:1px;
    classDef project fill:#D3D3D3,stroke:#333,stroke-width:1px;
```
