# nicolasvero/stardew-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/nicolasvero/stardew-dashboard
- Repository: https://github.com/nicolasvero/stardew-dashboard

## Overview

##### Main Components

a. Frontend Layer:
- Static Assets Component (assets/)
- Images, audio, fonts, and cursors
- User Interface Components (components/)
- Header and footer elements
- Styling System (styles/)
- LESS preprocessing
- CSS output

b. Backend Layer:
- Data Processing Engine (includes/)
- Save File Parser
- XML Data Extractor
- Player Information Processor
- Data Storage (data/json/)
- Game Data Repository
- Configuration Storage
- Localization System (locales/)
- Multi-language Support
- Locale Loader

c. Core Application Logic:
- TypeScript Components (scripts/typescript/)
- AJAX Save Handler
- Application Loader
- UI Update Manager
- PHP Processing Units (includes/)
- Security Layer
- Environment Handler
- Page Router

**┌─ Client Browser ─────────────────────────┐**

- ┌─ UI Layer ──────┐  ┌─ Scripts ────┐  │
- Components    │  │ - TypeScript │  │
- LESS/CSS     │  │ - AJAX       │  │
- Assets       │  │ - Utilities  │  │
- ┘  └─────────────┘   │
- ┬───────────────────────┘

**┌─────────────────▼───────────────────────┐**
- Server Application                       │
- ┌─ Frontend Controller ───────────────┐  │
- Page Loader                      │  │
- Security Check                   │  │
- ┬────────────────┘  │

- ┌──────────────────▼────────────────┐  │
- Data Processing Layer             │  │
- Save File Parser               │  │
- Player Info Extractor          │  │
- Gallery Processors             │  │
- ┬────────────────┘  │

- ┌──────────────────▼────────────────┐  │
- Data Storage                      │  │
- JSON Game Data                  │  │
- Localization Files             │  │
- ┘   │
- ┘

##### Key Relationships to Highlight

- Bidirectional data flow between the client and server
- Save file upload process
- Demonstrate how the localization system integrates with UI components
- Relationship between JSON data and gallery displays
- Security layer's position in the request flow

##### Technical Details to Note

- PHP-based backend structure
- TypeScript for frontend logic
- LESS preprocessing for styles
- JSON-based data storage
- Multi-language support system

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Browser Interface"]
        UILayer["UI Layer"]
        Scripts["Scripts Layer"]
        
        Browser --> UILayer
        Browser --> Scripts
        
        subgraph UIComponents
            Header["Header"]:::component
            Footer["Footer"]:::component
            Styles["Styling System"]:::component
            Assets["Static Assets"]:::component
        end
        
        subgraph ScriptComponents
            TypeScript["TypeScript Modules"]:::component
            AJAX["AJAX Handler"]:::component
            AppLoader["Application Loader"]:::component
            UIUpdate["UI Update Manager"]:::component
        end
        
        UILayer --> UIComponents
        Scripts --> ScriptComponents
    end
    
    subgraph Server
        FrontendController["Frontend Controller"]
        
        subgraph Processing
            SaveParser["Save File Parser"]:::component
            XMLExtractor["XML Data Extractor"]:::component
            PlayerInfo["Player Info Processor"]:::component
            Security["Security Layer"]:::component
            Environment["Environment Handler"]:::component
            Router["Page Router"]:::component
        end
        
        subgraph Storage
            GameData["Game Data Repository"]:::component
            LocaleFiles["Localization Files"]:::component
        end
        
        subgraph Galleries
            GalleryProcessor["Gallery Processors"]:::component
            GalleryDisplay["Gallery Display Logic"]:::component
        end
        
        subgraph Panels
            PanelProcessor["Panel Processors"]:::component
            PanelDisplay["Panel Display Logic"]:::component
        end
    end
    
    Browser --> FrontendController
    FrontendController --> Security
    Security --> Processing
    Processing --> Storage
    Processing --> Galleries
    Processing --> Panels
    
    %% Component Mappings
    click Assets "https://github.com/NicolasVero/stardew-dashboard/tree/master/assets/"
    click Header "https://github.com/NicolasVero/stardew-dashboard/blob/master/components/header.php"
    click Footer "https://github.com/NicolasVero/stardew-dashboard/blob/master/components/footer.php"
    click Styles "https://github.com/NicolasVero/stardew-dashboard/tree/master/styles/"
    click SaveParser "https://github.com/NicolasVero/stardew-dashboard/blob/master/includes/extract_data_from_save.php"
    click XMLExtractor "https://github.com/NicolasVero/stardew-dashboard/blob/master/includes/get_xml_data.php"
    click PlayerInfo "https://github.com/NicolasVero/stardew-dashboard/blob/master/includes/get_player_informations.php"
    click GameData "https://github.com/NicolasVero/stardew-dashboard/tree/master/data/json/"
    click LocaleFiles "https://github.com/NicolasVero/stardew-dashboard/tree/master/locales/languages/"
    click TypeScript "https://github.com/NicolasVero/stardew-dashboard/tree/master/scripts/typescript/"
    click AJAX "https://github.com/NicolasVero/stardew-dashboard/blob/master/scripts/typescript/ajax_save.ts"
    click AppLoader "https://github.com/NicolasVero/stardew-dashboard/blob/master/scripts/typescript/app_loader.ts"
    click UIUpdate "https://github.com/NicolasVero/stardew-dashboard/blob/master/scripts/typescript/update_display.ts"
    click Security "https://github.com/NicolasVero/stardew-dashboard/blob/master/includes/security_check.php"
    click Environment "https://github.com/NicolasVero/stardew-dashboard/blob/master/includes/load_environment.php"
    click Router "https://github.com/NicolasVero/stardew-dashboard/blob/master/includes/page_loader.php"
    click GalleryProcessor "https://github.com/NicolasVero/stardew-dashboard/tree/master/includes/galleries/"
    click PanelProcessor "https://github.com/NicolasVero/stardew-dashboard/tree/master/includes/panels/"
    
    classDef component fill:#f9f,stroke:#333,stroke-width:2px
    classDef storage fill:#ff9,stroke:#333,stroke-width:2px
    classDef processing fill:#9f9,stroke:#333,stroke-width:2px
    
    %% Legend
    subgraph Legend
        L1["Component"]:::component
        L2["Storage"]:::storage
        L3["Processing"]:::processing
    end
```
