# lucas-hwang04/ezhousing architecture

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

- Interactive diagram: https://gitdiagram.com/lucas-hwang04/ezhousing
- Repository: https://github.com/lucas-hwang04/ezhousing

## Overview

##### Project type and purpose
- This is a lightweight, client-only single-page web application (“Expense Tracker Lite”) built with plain HTML, CSS, and JavaScript.
- It provides users a way to add, view, search, and delete expense/income transactions, display summary cards and charts, and persist data locally via browser localStorage.

##### File structure
- Top-level files only:
- index.html – the sole HTML entry point and UI container
- styles.css – dark-themed custom styling
- app.js – all front-end logic, including data model, UI updates, and chart rendering
- README.md – documentation
- No backend, no build or deployment scripts; optionally served via a simple Python static server.

##### Extract key insights from the README
- Tech stack: HTML5, CSS3, JS (ES6+), Chart.js (via CDN)
- Data model: each transaction stored as an object in localStorage
- Features include real-time search/filter, KPIs, pie and line charts

##### Main components
a. UI Layer
- index.html (markup containers for forms, transaction list, summary cards, chart canvases)
- styles.css (layout, theming)
b. Application Logic
- app.js
– Controller functions (addTransaction, deleteTransaction, filterTransactions)
– Model abstraction over localStorage (CRUD operations)
– View updates (DOM manipulation)
– Chart rendering module (invoking Chart.js APIs)
c. Persistence Layer
- Browser localStorage (JSON array of transaction objects)
d. External Library
- Chart.js (loaded via CDN)
e. (Optional) Static File Server
- Python HTTP server for local hosting

##### Relationships and data flows
- User → UI form (index.html)
- UI form submit → app.js controller → model (localStorage) → view (DOM update + charts)
- Search input → app.js filter → view update
- Delete action → app.js controller → model → view
- app.js → Chart.js library → chart canvases update

##### Architectural patterns & design principles
- Simple MVC-style separation:
- Model: localStorage data wrapper
- View: HTML/CSS + DOM update routines
- Controller: event handlers in app.js
- Single Page Application (SPA) without routing
- No build step, direct browser execution

##### Components
- Clear labels: index.html, styles.css, app.js, localStorage, Chart.js
- Rectangles for code modules

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        UI_HTML["index.html"]:::ui
        UI_CSS["styles.css"]:::ui
    end

    %% Application Logic
    subgraph "Application Logic"
        AppJS["app.js"]:::logic
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        Storage[(localStorage)]:::storage
    end

    %% External Library
    subgraph "External Library"
        ChartJS["Chart.js (CDN)"]:::external
    end

    %% Documentation
    subgraph "Documentation"
        README["README.md"]:::ui
    end

    %% User interactions
    User(["User"]):::external
    User -->|"interacts with UI"| UI_HTML
    UI_HTML -->|"loads styles"| UI_CSS
    UI_HTML -->|"includes script"| AppJS

    %% Logic flows
    AppJS -->|"add/delete/filter"| Storage
    AppJS -->|"update DOM"| UI_HTML
    AppJS -->|"renderChart() via"| ChartJS
    ChartJS -->|"draw charts on"| UI_HTML

    %% Click Events
    click UI_HTML "https://github.com/lucas-hwang04/ezhousing/blob/main/index.html"
    click UI_CSS "https://github.com/lucas-hwang04/ezhousing/blob/main/styles.css"
    click AppJS "https://github.com/lucas-hwang04/ezhousing/blob/main/app.js"
    click README "https://github.com/lucas-hwang04/ezhousing/blob/main/README.md"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef storage fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D8BFD8,stroke:#333,stroke-width:1px
```
