# ic3w4r/finpercent architecture

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

- Interactive diagram: https://gitdiagram.com/ic3w4r/finpercent
- Repository: https://github.com/ic3w4r/finpercent

## Overview

##### Project type and purpose
- This is a single‐page financial “pocket audit” application (“finpercent”) built entirely in React + TypeScript and bundled with Vite.
- It provides budgeting, debt management, investment pooling, stock‐market insights, and user settings, all rendered client-side.

##### File structure
- No server‐side or monolithic backend folder—this is purely a front-end SPA with static assets in `public/`.
- `src/pages/` holds route targets (DashboardPage, DebtRepaymentPage, StockMarketPage, etc.).
- `src/components/` holds reusable UI and chart components (LineChart, PieChart, SankeyDiagram).
- State management via React Context: `src/context/CurrencyContext.tsx` and `src/contexts/ThemeContext.tsx`.
- Utility and style layers: `src/utils/`, `src/styles/`, PostCSS/Tailwind configuration, plus `vite.config.ts` for build.

##### README
- Minimal description: “The pocket fin audit.”
- No explicit mention of APIs, so assume external financial/stock data services (or mock JSON in `public/finpercentanim.json`).

- Client (Browser) running the React SPA.
- Static asset server or CDN (serves index.html, JS bundle, CSS, public JSON).
- External Financial Data APIs (currency exchange, market data).
- Optional Authentication Service if used (not explicit, but `SecuritySettings.tsx` hints at login/2FA).
- Browser Local Storage or Browser File Uploader (for user backups via `FileUploader`).
b. Relationships & data flow
- Browser requests `index.html` → CDN/static host → receives JS/CSS → SPA loads.
- At runtime, SPA uses React Router (defined in `src/routes.tsx`) to render pages.
- Components call external APIs (e.g., fetch currency rates, stock tickers).
- Context Providers wrap App to manage global theme/currency state.
- User interactions (file upload, settings change) read/write to local storage or send to API.
c. Architectural patterns
- Component-based architecture (atomic components in `components/ui/`, domain components in `components/debt/`, etc.).
- Context-based state management for cross-cutting concerns (theme, currency).
- Page–layout separation (`layouts/StockMarketLayout.tsx`).
- Clear separation of concerns: Charts, UI controls, pages.
d. Key technologies
- React + TypeScript, Vite (dev server & bundler), Tailwind CSS & PostCSS, React Router.
- Chart libraries (Sankey, line/pie chart implementations).

##### Detailed and exhaustive breakdown
- For each chart component, annotate the data it consumes (time series, pie breakdown, flow).
- How `ThemeContext` and `CurrencyContext` wrap the root `App.tsx`.

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef static fill:#cccccc,stroke:#333,stroke-width:1px
    classDef runtime fill:#bbdefb,stroke:#333,stroke-width:1px
    classDef external fill:#c8e6c9,stroke:#333,stroke-width:1px

    subgraph "Build Pipeline"
        direction TB
        Src["Source Code (src/)"]:::runtime
        VITE["Vite Bundler / Dev Server"]:::runtime
        Bundle["Production Bundles (dist)"]:::runtime
        Src --> VITE --> Bundle
    end

    Browser["Browser"]:::runtime
    Static["Static Host / CDN"]:::static

    Browser -->|Fetch index.html & bundles| Static
    Static -->|Serves HTML, JS, CSS, public assets| Browser
    Bundle -->|Loads SPA| Browser

    subgraph "React SPA Runtime"
        direction TB
        ThemeCtx["ThemeContext Provider"]:::runtime
        CurrencyCtx["CurrencyContext Provider"]:::runtime
        App["App.tsx"]:::runtime
        Router["Router (src/routes.tsx)"]:::runtime

        ThemeCtx --> CurrencyCtx --> App --> Router

        subgraph Pages
            direction TB
            Dashboard["DashboardPage"]:::runtime
            DebtRepayment["DebtRepaymentPage"]:::runtime
            StockMarketPage["StockMarketPage"]:::runtime
            InvestmentPooling["InvestmentPoolingPage"]:::runtime
            Settings["SettingsPage"]:::runtime
            Profile["ProfilePage"]:::runtime
            ErrorPage["ErrorPage"]:::runtime
        end
        Router --> Pages

        subgraph "Core Domain Components"
            direction TB
            AccountBalance["AccountBalance"]:::runtime
            DebtManagement["DebtManagement"]:::runtime
            InvestmentPools["InvestmentPools"]:::runtime
            FinancialReport["FinancialReport"]:::runtime
            ProgressBar["ProgressBar"]:::runtime
            Navigation["Navigation"]:::runtime
            FileUploader["FileUploader"]:::runtime
        end
        Pages --> AccountBalance & DebtManagement & InvestmentPools & FinancialReport & ProgressBar & Navigation & FileUploader

        subgraph "UI Components"
            direction TB
            AnimatedAccordion["AnimatedAccordion"]:::runtime
            PageTransition["PageTransition"]:::runtime
            ProgressUI["Progress"]:::runtime
            Tabs["Tabs"]:::runtime
        end
        App --> UIComponents["UI Components"]
        UIComponents --> AnimatedAccordion & PageTransition & ProgressUI & Tabs

        subgraph "Debt-specific Components"
            direction TB
            Avalanche["AvalancheMethod"]:::runtime
            Snowball["SnowballMethod"]:::runtime
            Velocity["VelocityBanking"]:::runtime
            DebtGuide["DebtMethodGuide"]:::runtime
        end
        DebtRepayment --> Avalanche & Snowball & Velocity & DebtGuide

        subgraph "Charts Components"
            direction TB
            LineChart["LineChart"]:::runtime
            PieChart["PieChart"]:::runtime
            Sankey["SankeyDiagram"]:::runtime
        end
        Pages --> LineChart & PieChart & Sankey

        subgraph "Settings Components"
            direction TB
            CurrencySettings["CurrencySettings"]:::runtime
            NotificationSettings["NotificationSettings"]:::runtime
            SecuritySettings["SecuritySettings"]:::runtime
        end
        Settings --> CurrencySettings & NotificationSettings & SecuritySettings

        subgraph "Stock Market Components"
            direction TB
            KPIStockTicker["KPIStockTicker"]:::runtime
            MarketChart["MarketChart"]:::runtime
            ZoneOfPlay["ZoneOfPlay"]:::runtime
        end
        StockMarketPage --> KPIStockTicker & MarketChart & ZoneOfPlay

        subgraph "Stats & Status Components"
            direction TB
            StatsMethods["Stats Methods (Kakeibo, NWS, STOP)"]:::runtime
            StatusComponents["Status Components (BadgeAnimation, BalanceSheetAnalysis, KPIBreakdown, RankingCriteria)"]:::runtime
        end
        Pages --> StatsMethods & StatusComponents

        subgraph "Profile Components"
            direction TB
            ProfileHeader["ProfileHeader"]:::runtime
            ProfileStats["ProfileStats"]:::runtime
        end
        Profile --> ProfileHeader & ProfileStats

        subgraph "Utilities & Types"
            direction TB
            Utils["Utilities (animations.ts, currencies.ts)"]:::runtime
            Types["Type Definitions"]:::runtime
        end
        App --> Utils & Types

        subgraph "Styles & Config"
            direction TB
            CSS["Global CSS (index.css, App.css)"]:::runtime
            Tailwind["Tailwind/PostCSS Config"]:::runtime
            ViteCfg["vite.config.ts"]:::runtime
        end
        VITE --> ViteCfg
        App --> CSS & Tailwind

        subgraph "Static Assets"
            direction TB
            AnimJSON["finpercentanim.json"]:::static
            Sitemap["sitemap.xml"]:::static
            HTMLTemplate["index.html"]:::static
        end
        Static --> AnimJSON & Sitemap & HTMLTemplate

    end

    subgraph "External Services"
        direction TB
        CurrencyAPI["Currency Exchange API"]:::external
        StockAPI["Stock Market Data API"]:::external
        AuthAPI["Authentication Service"]:::external
    end
    App -->|Fetch data| CurrencyAPI & StockAPI & AuthAPI
    FileUploader -->|Read/Write| LocalStorage["Browser Local Storage"]:::runtime

    click App "https://github.com/ic3w4r/finpercent/blob/main/src/App.tsx"
    click Router "https://github.com/ic3w4r/finpercent/blob/main/src/routes.tsx"
    click Dashboard "https://github.com/ic3w4r/finpercent/blob/main/src/pages/DashboardPage.tsx"
    click DebtRepayment "https://github.com/ic3w4r/finpercent/blob/main/src/pages/DebtRepaymentPage.tsx"
    click StockMarketPage "https://github.com/ic3w4r/finpercent/blob/main/src/pages/StockMarketPage.tsx"
    click InvestmentPooling "https://github.com/ic3w4r/finpercent/blob/main/src/pages/InvestmentPoolingPage.tsx"
    click Settings "https://github.com/ic3w4r/finpercent/blob/main/src/pages/SettingsPage.tsx"
    click Profile "https://github.com/ic3w4r/finpercent/blob/main/src/pages/ProfilePage.tsx"
    click ErrorPage "https://github.com/ic3w4r/finpercent/blob/main/src/pages/ErrorPage.tsx"
    click ThemeCtx "https://github.com/ic3w4r/finpercent/blob/main/src/contexts/ThemeContext.tsx"
    click CurrencyCtx "https://github.com/ic3w4r/finpercent/blob/main/src/context/CurrencyContext.tsx"
    click AccountBalance "https://github.com/ic3w4r/finpercent/blob/main/src/components/AccountBalance.tsx"
    click DebtManagement "https://github.com/ic3w4r/finpercent/blob/main/src/components/DebtManagement.tsx"
    click InvestmentPools "https://github.com/ic3w4r/finpercent/blob/main/src/components/InvestmentPools.tsx"
    click FinancialReport "https://github.com/ic3w4r/finpercent/blob/main/src/components/FinancialReport.tsx"
    click ProgressBar "https://github.com/ic3w4r/finpercent/blob/main/src/components/ProgressBar.tsx"
    click Navigation "https://github.com/ic3w4r/finpercent/blob/main/src/components/Navigation.tsx"
    click FileUploader "https://github.com/ic3w4r/finpercent/blob/main/src/components/FileUploader.tsx"
    click Avalanche "https://github.com/ic3w4r/finpercent/blob/main/src/components/debt/AvalancheMethod.tsx"
    click Snowball "https://github.com/ic3w4r/finpercent/blob/main/src/components/debt/SnowballMethod.tsx"
    click Velocity "https://github.com/ic3w4r/finpercent/blob/main/src/components/debt/VelocityBanking.tsx"
    click DebtGuide "https://github.com/ic3w4r/finpercent/blob/main/src/components/debt/DebtMethodGuide.tsx"
    click LineChart "https://github.com/ic3w4r/finpercent/blob/main/src/components/charts/LineChart.tsx"
    click PieChart "https://github.com/ic3w4r/finpercent/blob/main/src/components/charts/PieChart.tsx"
    click Sankey "https://github.com/ic3w4r/finpercent/blob/main/src/components/charts/SankeyDiagram.tsx"
    click CurrencySettings "https://github.com/ic3w4r/finpercent/blob/main/src/components/settings/CurrencySettings.tsx"
    click NotificationSettings "https://github.com/ic3w4r/finpercent/blob/main/src/components/settings/NotificationSettings.tsx"
    click SecuritySettings "https://github.com/ic3w4r/finpercent/blob/main/src/components/settings/SecuritySettings.tsx"
    click KPIStockTicker "https://github.com/ic3w4r/finpercent/blob/main/src/components/stock-market/KPIStockTicker.tsx"
    click MarketChart "https://github.com/ic3w4r/finpercent/blob/main/src/components/stock-market/MarketChart.tsx"
    click ZoneOfPlay "https://github.com/ic3w4r/finpercent/blob/main/src/components/stock-market/ZoneOfPlay.tsx"
    click AnimJSON "https://github.com/ic3w4r/finpercent/blob/main/public/finpercentanim.json"
    click Sitemap "https://github.com/ic3w4r/finpercent/blob/main/public/sitemap.xml"
    click HTMLTemplate "https://github.com/ic3w4r/finpercent/blob/main/index.html"
    click ViteCfg "https://github.com/ic3w4r/finpercent/blob/main/vite.config.ts"
    click Src "https://github.com/ic3w4r/finpercent/blob/main/src/main.tsx"
```
