# fernandofedora/personal-finance-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/fernandofedora/personal-finance-tracker
- Repository: https://github.com/fernandofedora/personal-finance-tracker

## Overview

##### Project type and purpose
- This is a client-only, browser-based Personal Finance Tracker.
- It’s a static multi-page frontend app (no backend service), implemented in HTML, JavaScript, and CSS, using Local Storage for persistence, Chart.js for visualization, and Bootstrap for styling.

##### File structure
- Top-level “frontend” directory contains:
- index.html + main.js – the landing/dashboard page
- credit_card_history.html + credit_card_history.js – credit-card-specific view and logic
- plan_ahorro.html + plan_ahorro.js – a savings-plan view and logic
- There are no server directories or API controllers: all logic lives in JS files.
- Persistence is handled via the browser’s Local Storage API.
- Chart.js is loaded in each page to render visualizations; Bootstrap CSS/JS provides UI styling and components.

##### README for additional insights
- Features emphasize CRUD operations on transactions, categorization (income/expense), credit-card associations, and interactive bar charts.
- Data entries are JSON objects stored in Local Storage.
- No external services or databases.

a. Main components
1. UI Pages (HTML + CSS + Bootstrap)
– Dashboard (index.html)
– Credit-Card History (credit_card_history.html)
– Savings Plan (plan_ahorro.html)
2. Business Logic Modules (main.js, credit_card_history.js, plan_ahorro.js)
3. Data Store (Browser Local Storage)
4. Visualization Library (Chart.js)
5. External CSS/JS Framework (Bootstrap)
b. Relationships & interactions
- User interacts with UI → triggers event handlers in JS
- JS controllers (each page’s .js) read/write JSON records to Local Storage
- JS retrieves data from Local Storage → passes it to Chart.js → generates charts in the DOM
- UI form inputs → JS validation & persistence → update views and summary panels
c. Architectural patterns / design principles
- Single-page controller per page (each .js file acts as a mini-controller)
- Separation of concerns:
- View layer (HTML/CSS/Bootstrap)
- Controller layer (JavaScript modules)
- Model layer (Local Storage as a key-value store of transaction objects)
- Modular code per feature (transactions, credit cards, savings plans)
d. Key technologies & libraries
- HTML5, CSS3, Bootstrap (Styling & layout)
- Vanilla JavaScript (ES6 modules or namespaced scripts)
- Local Storage API (Persistence)
- Chart.js (Data visualization)

##### Detail
- That all controllers share the same Local Storage namespace (e.g., a “transactions” key).
- That transaction objects include title, amount, type, creditCard, date.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% View Layer
    subgraph "View Layer"
        direction TB
        Dashboard["Dashboard (index.html)"]:::view
        CreditCardPage["Credit-Card History (credit_card_history.html)"]:::view
        SavingsPlanPage["Savings Plan (plan_ahorro.html)"]:::view
    end

    %% Controller Layer
    subgraph "Controller Layer"
        direction TB
        DashboardLogic["Dashboard Logic (main.js)"]:::controller
        CreditCardLogic["Credit-Card History Logic (credit_card_history.js)"]:::controller
        SavingsPlanLogic["Savings Plan Logic (plan_ahorro.js)"]:::controller
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DataStore["Local Storage"]:::storage
    end

    %% Library Layer
    subgraph "Library Layer"
        direction TB
        ChartJS["Chart.js"]:::library
        Bootstrap["Bootstrap"]:::library
    end

    %% Connections for Dashboard
    Dashboard -->|"user events"| DashboardLogic
    DashboardLogic -->|"CRUD operations"| DataStore
    DataStore -->|"fetch data"| DashboardLogic
    DashboardLogic -->|"render charts"| ChartJS
    ChartJS -->|"draw charts in DOM"| Dashboard

    %% Connections for Credit-Card History
    CreditCardPage -->|"user events"| CreditCardLogic
    CreditCardLogic -->|"CRUD operations"| DataStore
    DataStore -->|"fetch data"| CreditCardLogic
    CreditCardLogic -->|"render charts"| ChartJS
    ChartJS -->|"draw charts in DOM"| CreditCardPage

    %% Connections for Savings Plan
    SavingsPlanPage -->|"user events"| SavingsPlanLogic
    SavingsPlanLogic -->|"CRUD operations"| DataStore
    DataStore -->|"fetch data"| SavingsPlanLogic
    SavingsPlanLogic -->|"render charts"| ChartJS
    ChartJS -->|"draw charts in DOM"| SavingsPlanPage

    %% Libraries usage
    Dashboard -->|"includes CSS/JS"| Bootstrap
    CreditCardPage -->|"includes CSS/JS"| Bootstrap
    SavingsPlanPage -->|"includes CSS/JS"| Bootstrap

    %% Click Events
    click Dashboard "https://github.com/fernandofedora/personal-finance-tracker/blob/main/frontend/index.html"
    click DashboardLogic "https://github.com/fernandofedora/personal-finance-tracker/blob/main/frontend/main.js"
    click CreditCardPage "https://github.com/fernandofedora/personal-finance-tracker/blob/main/frontend/credit_card_history.html"
    click CreditCardLogic "https://github.com/fernandofedora/personal-finance-tracker/blob/main/frontend/credit_card_history.js"
    click SavingsPlanPage "https://github.com/fernandofedora/personal-finance-tracker/blob/main/frontend/plan_ahorro.html"
    click SavingsPlanLogic "https://github.com/fernandofedora/personal-finance-tracker/blob/main/frontend/plan_ahorro.js"

    %% Styles
    classDef view fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef controller fill:#90EE90,stroke:#333,stroke-width:1px
    classDef storage fill:#FFA500,stroke:#333,stroke-width:1px
    classDef library fill:#DDA0DD,stroke:#333,stroke-width:1px
```
