# null-pub/wealth-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/null-pub/wealth-tracker
- Repository: https://github.com/null-pub/wealth-tracker

## Overview

##### Project Type and Purpose
- This is a front-end, single-page application built with React and TypeScript.
- Its primary purpose is to track wealth and income, project future income and wealth, and allow users to import/export data—all stored locally in the browser’s local storage.
- The README emphasizes that this tool is for entertainment with basic financial projections and local data persistence.

##### Break Down the File Structure
- Top-level files such as package.json, vite.config.ts, index.html, and tsconfig.* indicate that the project uses modern tooling (Vite) along with JavaScript/TypeScript linting and formatting (ESLint, Prettier).
- The “src” folder is organized into several subdirectories:
– /app: Contains the main application entry point (src/app/index.ts) and configuration components (modals, config entries, scenario explorer, etc.). This represents the core UI and configuration logic.
– /capabilities: Contains modules for different features like net-wealth, projected-income, and projected-wealth. Each capability generally includes its own UI components (like charts, data entry screens, account tabs, etc.) and sometimes hooks.
– /shared: Provides reusable components (e.g., ag-grid components, confirm-dialog, formatters), hooks, models, store implementations (with versioned store models and migrations), utilities, and even a web-worker subfolder for offloading computations.
- The “docs” folder and assets indicate that there is documentation with static assets (likely for demo or usage instructions on GitHub pages).

##### Main Components & Their Relationships
- User Interface Layer:
– Main entry point: src/main.tsx initializing the React app.
– Application components: Located in src/app (and its config subdirectory) which handle global configuration and system settings.
– Capabilities modules: Divided into net-wealth, projected-income, and projected-wealth. Each module encapsulates feature-specific screens and business logic.
– Shared UI components: Reusable components used across different modules (e.g., ag-grid tables, card components, formatters, dialogs).
- State Management & Data Store:
– The state “store” logic is found in src/shared/store and the associated models in src/shared/models/store – note the versions (version-0 to version-5) with migrations, indicating that data structure evolution is handled.
– Local storage is used as the persistence layer for the application, as noted in the README.
- Utility and Helper Services:
– The shared utilities and web-worker code (src/shared/utility and src/shared/web-worker) are used for offloading intensive calculations (such as scenario processing or merit sequences) from the UI thread.
- External Libraries & Configuration:
– External dependencies (as seen in docs/assets) such as ag-charts, @mui components, date-fns, etc., play a significant role in UI rendering and data visualization.
– Configuration and tooling files (eslint, prettier, vite config) indicate that the project adheres to consistent code style and uses a modern build pipeline.

## Diagram (Mermaid)

```mermaid
graph TD
    ME["Main Entry (React App Entry)"]:::ui
    AC["App & Config (UI Layer)"]:::ui
    NW["Net-Wealth Module"]:::capability
    PI["Projected-Income Module"]:::capability
    PW["Projected-Wealth Module"]:::capability
    SC["Shared UI Components"]:::shared
    DS["Data Store & Versioned Models"]:::datastore
    LS["Local Storage (Browser)"]:::datastore
    US["Utility & Helper Services"]:::utility
    WW["Web Worker (Offload Computations)"]:::utility
    EL["External Libraries (React, MUI, ag-charts, etc.)"]:::external

    %% Data Flow
    ME -->|"initializes"| AC
    AC -->|"loads"| NW
    AC -->|"loads"| PI
    AC -->|"loads"| PW
    AC -->|"uses"| SC
    NW -->|"updates"| DS
    PI -->|"updates"| DS
    PW -->|"updates"| DS
    DS -->|"persists to"| LS
    SC -->|"reads/writes to"| DS
    SC -->|"triggers"| US
    US -->|"delegates to"| WW
    EL -.->|"integrates"| AC
    EL -.->|"integrates"| NW
    EL -.->|"integrates"| PI
    EL -.->|"integrates"| PW

    %% Click Events
    click ME "https://github.com/null-pub/wealth-tracker/blob/main/src/main.tsx"
    click AC "https://github.com/null-pub/wealth-tracker/tree/main/src/app"
    click NW "https://github.com/null-pub/wealth-tracker/tree/main/src/capabilities/net-wealth"
    click PI "https://github.com/null-pub/wealth-tracker/tree/main/src/capabilities/projected-income"
    click PW "https://github.com/null-pub/wealth-tracker/tree/main/src/capabilities/projected-wealth"
    click SC "https://github.com/null-pub/wealth-tracker/tree/main/src/shared"
    click DS "https://github.com/null-pub/wealth-tracker/tree/main/src/shared/store"
    click US "https://github.com/null-pub/wealth-tracker/tree/main/src/shared/utility"
    click WW "https://github.com/null-pub/wealth-tracker/tree/main/src/shared/web-worker"

    %% Styles
    classDef ui fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef capability fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef shared fill:#ffffe0,stroke:#000,stroke-width:2px;
    classDef datastore fill:#ffb6c1,stroke:#000,stroke-width:2px;
    classDef utility fill:#d3d3d3,stroke:#000,stroke-width:2px;
    classDef external fill:#f0e68c,stroke:#000,stroke-width:2px;
```
