# phatelot/fehwgc architecture

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

- Interactive diagram: https://gitdiagram.com/phatelot/fehwgc
- Repository: https://github.com/phatelot/fehwgc

## Overview

##### Main Application Components

a. Core Application Layer:
- App.svelte as the root component
- Main.ts as the application entry point

b. Feature Modules (Group these in logical containers):

Component Module:
- Character Management (character_chart.svelte, character_popup.svelte)
- Outfit System (outfit_chart.svelte, outfit_popup.svelte)
- Statistics (bmi_chart.svelte, global_stats.svelte)

Business Logic Module:
- State Management (state.ts)
- Change Engine (change_engine.ts)
- Donation Engine (donation_engine.ts)
- Metadata Handler (metadata.ts)

##### Data Flow Layer

- Data Import System (data_import directory)
- Asset Management (asset_utils.ts)
- State Management
- View Models (view_model.ts)

##### Asset Structure

Static asset organization:
- Public Assets (public directory)
- Character Assets
- Frames
- Traits

##### Utility Services

Utility functions:
- RNG Service (rng.ts)
- Stats Utilities (stats_utils.ts)
- Weight Utilities (weight_utils.ts)
- General Utilities (utils.ts)

Use these visualization guidelines:

##### Testing Integration
- Test files (.test.ts) as parallel structures
- Use a different border style for tested components

##### Build/Deploy Pipeline
- Vite configuration
- GitHub workflow integration
- DevContainer setup

##### Development Tools
- TypeScript configuration
- Svelte compiler
- Development server

Keep the following in mind:

##### How assets are managed and utilized

- High-level architecture visibility
- Component relationships
- Data flow patterns
- Development/deployment infrastructure

This will give other developers a clear understanding of:
- How components interact
- Where to find specific functionality
- How data flows through the application
- How the testing infrastructure is organized
- How the build and deployment process works

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        Entry["Main Entry Point"]:::core
        App["App Component"]:::core
        Styles["Application Styles"]:::core
        Entry --> App
        App --> Styles
    end

    subgraph "Feature Components"
        subgraph "Character Management"
            CharChart["Character Chart"]:::ui
            CharPopup["Character Popup"]:::ui
            CharList["Characters List"]:::ui
        end

        subgraph "Outfit System"
            OutfitChart["Outfit Chart"]:::ui
            OutfitPopup["Outfit Popup"]:::ui
        end

        subgraph "UI Components"
            Box["Box Component"]:::ui
            Portrait["Portrait"]:::ui
            Traits["Traits"]:::ui
            MenuPopup["Menu Popup"]:::ui
        end

        subgraph "Statistics"
            BMIChart["BMI Chart"]:::ui
            GlobalStats["Global Stats"]:::ui
            WeightLabel["Weight Label"]:::ui
        end
    end

    subgraph "Business Logic"
        State["State Management"]:::logic
        ChangeEngine["Change Engine"]:::logic
        DonationEngine["Donation Engine"]:::logic
        Metadata["Metadata Handler"]:::logic
        ViewModel["View Model"]:::logic
    end

    subgraph "Data Import"
        ImportScripts["Import Scripts"]:::data
        TSVtoJSON["TSV to JSON"]:::data
        ImageDL["Image Downloader"]:::data
    end

    subgraph "Asset Management"
        PublicAssets["Public Assets"]:::assets
        CharAssets["Character Assets"]:::assets
        Frames["Frames"]:::assets
        TraitsAssets["Traits Assets"]:::assets
        AssetUtils["Asset Utilities"]:::assets
    end

    subgraph "Utilities"
        RNG["RNG Service"]:::util
        StatsUtils["Stats Utilities"]:::util
        WeightUtils["Weight Utilities"]:::util
        GenUtils["General Utilities"]:::util
    end

    subgraph "Infrastructure"
        DevContainer["DevContainer Config"]:::infra
        GHWorkflow["GitHub Workflow"]:::infra
        TSConfig["TypeScript Config"]:::infra
        ViteConfig["Vite Config"]:::infra
    end

    %% Core relationships
    App --> State
    App --> ViewModel
    State --> ChangeEngine
    State --> DonationEngine
    ViewModel --> Metadata

    %% Feature relationships
    CharChart --> State
    OutfitChart --> State
    BMIChart --> StatsUtils
    GlobalStats --> StatsUtils
    WeightLabel --> WeightUtils

    %% Asset relationships
    AssetUtils --> PublicAssets
    AssetUtils --> CharAssets
    AssetUtils --> Frames
    AssetUtils --> TraitsAssets

    %% Data import relationships
    ImportScripts --> TSVtoJSON
    ImportScripts --> ImageDL
    TSVtoJSON -.-> PublicAssets
    ImageDL -.-> PublicAssets

    %% Click events
    click Entry "https://github.com/Phatelot/fehwgc/blob/main/src/main.ts"
    click App "https://github.com/Phatelot/fehwgc/blob/main/src/App.svelte"
    click Styles "https://github.com/Phatelot/fehwgc/blob/main/src/app.css"
    click CharChart "https://github.com/Phatelot/fehwgc/blob/main/src/lib/character_chart.svelte"
    click CharPopup "https://github.com/Phatelot/fehwgc/blob/main/src/lib/character_popup.svelte"
    click CharList "https://github.com/Phatelot/fehwgc/blob/main/src/lib/characters_list.svelte"
    click OutfitChart "https://github.com/Phatelot/fehwgc/blob/main/src/lib/outfit_chart.svelte"
    click OutfitPopup "https://github.com/Phatelot/fehwgc/blob/main/src/lib/outfit_popup.svelte"
    click Box "https://github.com/Phatelot/fehwgc/blob/main/src/lib/box.svelte"
    click Portrait "https://github.com/Phatelot/fehwgc/blob/main/src/lib/portrait.svelte"
    click Traits "https://github.com/Phatelot/fehwgc/blob/main/src/lib/traits.svelte"
    click MenuPopup "https://github.com/Phatelot/fehwgc/blob/main/src/lib/menu_popup.svelte"
    click BMIChart "https://github.com/Phatelot/fehwgc/blob/main/src/lib/bmi_chart.svelte"
    click GlobalStats "https://github.com/Phatelot/fehwgc/blob/main/src/lib/global_stats.svelte"
    click WeightLabel "https://github.com/Phatelot/fehwgc/blob/main/src/lib/weight_label.svelte"
    click State "https://github.com/Phatelot/fehwgc/blob/main/src/lib/state.ts"
    click ChangeEngine "https://github.com/Phatelot/fehwgc/blob/main/src/lib/change_engine.ts"
    click DonationEngine "https://github.com/Phatelot/fehwgc/blob/main/src/lib/donation_engine.ts"
    click Metadata "https://github.com/Phatelot/fehwgc/blob/main/src/lib/metadata.ts"
    click ViewModel "https://github.com/Phatelot/fehwgc/blob/main/src/lib/view_model.ts"
    click ImportScripts "https://github.com/Phatelot/fehwgc/tree/main/data_import/"
    click TSVtoJSON "https://github.com/Phatelot/fehwgc/blob/main/data_import/tsv_to_json.py"
    click ImageDL "https://github.com/Phatelot/fehwgc/blob/main/data_import/dl_img.py"
    click PublicAssets "https://github.com/Phatelot/fehwgc/tree/main/public/"
    click CharAssets "https://github.com/Phatelot/fehwgc/tree/main/public/characters/"
    click Frames "https://github.com/Phatelot/fehwgc/tree/main/public/frames/"
    click TraitsAssets "https://github.com/Phatelot/fehwgc/tree/main/public/traits/"
    click AssetUtils "https://github.com/Phatelot/fehwgc/blob/main/src/lib/asset_utils.ts"
    click RNG "https://github.com/Phatelot/fehwgc/blob/main/src/lib/rng.ts"
    click StatsUtils "https://github.com/Phatelot/fehwgc/blob/main/src/lib/stats_utils.ts"
    click WeightUtils "https://github.com/Phatelot/fehwgc/blob/main/src/lib/weight_utils.ts"
    click GenUtils "https://github.com/Phatelot/fehwgc/blob/main/src/lib/utils.ts"
    click DevContainer "https://github.com/Phatelot/fehwgc/blob/main/.devcontainer/devcontainer.json"
    click GHWorkflow "https://github.com/Phatelot/fehwgc/blob/main/.github/workflows/onPush.yml"
    click TSConfig "https://github.com/Phatelot/fehwgc/blob/main/tsconfig.json"
    click ViteConfig "https://github.com/Phatelot/fehwgc/blob/main/vite.config.ts"

    %% Styling
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef ui fill:#FF9800,stroke:#F57C00,color:white
    classDef logic fill:#4CAF50,stroke:#388E3C,color:white
    classDef data fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef assets fill:#FFEB3B,stroke:#FBC02D,color:black
    classDef util fill:#607D8B,stroke:#455A64,color:white
    classDef infra fill:#795548,stroke:#5D4037,color:white
```
