# jhandl/finsim architecture

> Architecture diagram of the GitHub repository jhandl/finsim, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jhandl/finsim
- Repository: https://github.com/jhandl/finsim

## Overview

##### Component Details

- Wizard Component
- Chart Manager
- Events Table Manager
- File Manager
- Drag & Drop
- Table Manager
- A "Utils" sub-component showing:
- DOM Utils
- Format Utils
- Notification Utils

- Simulator (Central component)
- Config Manager
- Equities Calculator
- Real Estate Calculator
- Revenue Calculator
- Events Manager

- Configuration Files
- Local Storage
- File System (for saves)

##### Interaction Flows

- User input flow from UI to Core Logic
- Data flow between Core Logic components
- Configuration loading paths
- Simulation result paths back to UI

##### Technical Details

Annotations for:
- Browser-based execution environment
- Client-side storage mechanisms
- File format specifications
- Supported simulation types

##### Premium feature boundaries for future monetization

Remember to include version transition paths as this project has a clear evolution planned from a client-side application to a full-stack solution with premium features and multiple deployment options.

## Diagram (Mermaid)

```mermaid
%%{init: {
  'theme': 'base',
  'themeVariables': {
    'primaryColor': '#2b2b2b',
    'primaryTextColor': '#fff',
    'primaryBorderColor': '#7C0000',
    'lineColor': '#F8B229',
    'secondaryColor': '#006100',
    'tertiaryColor': '#fff'
  }
}}%%

flowchart TB
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef future fill:none,stroke:#95a5a6,stroke-dasharray: 5 5
    classDef utils fill:#95a5a6,stroke:#7f8c8d,color:white

    subgraph Frontend["Frontend Layer"]
        WebUI["Web UI"]:::frontend
        click WebUI "https://github.com/jhandl/FinSim/blob/main/src/frontend/web/WebUI.js"
        
        subgraph UIComponents["UI Components"]
            Wizard["Wizard Component"]:::frontend
            click Wizard "https://github.com/jhandl/FinSim/blob/main/src/frontend/web/components/Wizard.js"
            ChartMgr["Chart Manager"]:::frontend
            click ChartMgr "https://github.com/jhandl/FinSim/blob/main/src/frontend/web/components/ChartManager.js"
            EventsTbl["Events Table Manager"]:::frontend
            click EventsTbl "https://github.com/jhandl/FinSim/blob/main/src/frontend/web/components/EventsTableManager.js"
            FileMgr["File Manager"]:::frontend
            click FileMgr "https://github.com/jhandl/FinSim/blob/main/src/frontend/web/components/FileManager.js"
            DragDrop["Drag & Drop"]:::frontend
            click DragDrop "https://github.com/jhandl/FinSim/blob/main/src/frontend/web/components/DragAndDrop.js"
            TblMgr["Table Manager"]:::frontend
            click TblMgr "https://github.com/jhandl/FinSim/blob/main/src/frontend/web/components/TableManager.js"
        end

        subgraph FrontendUtils["Frontend Utils"]
            DOMUtils["DOM Utils"]:::utils
            click DOMUtils "https://github.com/jhandl/FinSim/blob/main/src/frontend/web/utils/DOMUtils.js"
            FormatUtils["Format Utils"]:::utils
            click FormatUtils "https://github.com/jhandl/FinSim/blob/main/src/frontend/web/utils/FormatUtils.js"
            NotifUtils["Notification Utils"]:::utils
            click NotifUtils "https://github.com/jhandl/FinSim/blob/main/src/frontend/web/utils/NotificationUtils.js"
        end

        AbstractUI["Abstract UI Layer"]:::frontend
        click AbstractUI "https://github.com/jhandl/FinSim/blob/main/src/frontend/AbstractUI.js"
        UIMgr["UI Manager"]:::frontend
        click UIMgr "https://github.com/jhandl/FinSim/blob/main/src/frontend/UIManager.js"
    end

    subgraph Core["Core Business Logic Layer"]
        Simulator["Simulator"]:::core
        click Simulator "https://github.com/jhandl/FinSim/blob/main/src/core/Simulator.js"
        ConfigMgr["Config Manager"]:::core
        click ConfigMgr "https://github.com/jhandl/FinSim/blob/main/src/core/Config.js"
        
        subgraph Calculators["Calculators"]
            EqCalc["Equities Calculator"]:::core
            click EqCalc "https://github.com/jhandl/FinSim/blob/main/src/core/Equities.js"
            RECalc["Real Estate Calculator"]:::core
            click RECalc "https://github.com/jhandl/FinSim/blob/main/src/core/RealEstate.js"
            RevCalc["Revenue Calculator"]:::core
            click RevCalc "https://github.com/jhandl/FinSim/blob/main/src/core/Revenue.js"
        end
        
        EventsMgr["Events Manager"]:::core
        click EventsMgr "https://github.com/jhandl/FinSim/blob/main/src/core/Events.js"
        CoreUtils["Core Utils"]:::utils
        click CoreUtils "https://github.com/jhandl/FinSim/blob/main/src/core/Utils.js"
    end

    subgraph Data["Data Layer"]
        Config["Configuration Files"]:::data
        click Config "https://github.com/jhandl/FinSim/blob/main/config/finance-simulation-config.json"
        LocalStorage["Local Storage"]:::data
        FileSystem["File System"]:::data
    end

    subgraph Future["Future Extensions"]
        Backend["Backend Services"]:::future
        ExtData["External Data Sources"]:::future
        Payment["Payment Integration"]:::future
        AI["AI Analysis"]:::future
    end

    %% Connections
    WebUI --> AbstractUI
    AbstractUI --> UIMgr
    UIMgr --> UIComponents
    UIComponents --> FrontendUtils
    UIMgr --> Simulator
    Simulator --> Calculators
    Simulator --> EventsMgr
    Simulator --> ConfigMgr
    ConfigMgr --> Config
    Simulator --> LocalStorage
    FileMgr --> FileSystem
    
    %% Future Connections
    Simulator -.-> Backend
    Backend -.-> ExtData
    Backend -.-> Payment
    Backend -.-> AI
```
