# hypnoticsiege/stock-viewer architecture

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

- Interactive diagram: https://gitdiagram.com/hypnoticsiege/stock-viewer
- Repository: https://github.com/hypnoticsiege/stock-viewer

## Overview

##### Main Components

a. Frontend Layer:
- Client Browser
- Views (EJS Templates)
- Static Assets (CSS)
- Chart.js Visualization

b. Backend Layer:
- Express.js Server
- Static Data Store (JSON files)

##### Component Organization

**┌─ Client Layer ─────────────────────┐**
- Web Browser                        │
- ┬───────────────────┘
- ↓
**┌─ Presentation Layer ────────────────────────────┐**
- ┌─────────────┐  ┌──────────┐  ┌────────────┐  │
- index.ejs  │  │ chart.ejs│  │  Partials  │  │
- ┘  └──────────┘  └────────────┘  │
- ↑             ↑              ↑         │
- ┴──────────────┘         │
- ┬─────────────────────────┘
- ↓
**┌─ Application Layer ───────────────────────────┐**
- ┌─────────────────────┐  ┌────────────────┐  │
- Express.js       │  │   Chart.js     │  │
- Server          │  │   Rendering     │  │
- ┬─────┘  └────────┬───────┘  │
- ┼────────────────┼───────────┘
- ↓                ↑
**┌─ Data Layer ──────────────────────────────────┐**
- ┌─────────────────────────────────────────┐   │
- Static JSON Files             │   │
- (AAPL.json, JPM.json, TSLA.json)      │   │
- ┘   │
- ┘

##### Important Elements to Highlight

a. Client-Side Features:
- TailwindCSS styling (input.css)
- Chart.js visualization library
- EJS templating system

b. Server-Side Components:
- Express.js routing and serving
- Static file serving
- JSON data reading

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]:::client
    end

    subgraph Presentation
        IndexView["index.ejs"]:::frontend
        ChartView["chart.ejs"]:::frontend
        Partials["UI Components"]:::frontend
        CSS["TailwindCSS Styles"]:::frontend
    end

    subgraph Application
        Express["Express.js Server"]:::server
        ChartJS["Chart.js Rendering"]:::server
    end

    subgraph Data
        JSON["Static JSON Files"]:::data
        AAPL["AAPL.json"]:::data
        JPM["JPM.json"]:::data
        TSLA["TSLA.json"]:::data
    end

    Browser --> IndexView
    Browser --> ChartView
    IndexView --> Express
    ChartView --> Express
    Express --> ChartJS
    ChartJS --> Browser
    Express --> JSON
    JSON --> AAPL & JPM & TSLA
    IndexView --> Partials
    ChartView --> Partials
    CSS --> Browser

    %% Click Events
    click IndexView "https://github.com/HypnoticSiege/stock-viewer/blob/main/views/index.ejs"
    click ChartView "https://github.com/HypnoticSiege/stock-viewer/blob/main/views/chart.ejs"
    click Partials "https://github.com/HypnoticSiege/stock-viewer/tree/main/views/partials"
    click CSS "https://github.com/HypnoticSiege/stock-viewer/blob/main/public/css/input.css"
    click Express "https://github.com/HypnoticSiege/stock-viewer/blob/main/src/app/index.js"
    click JSON "https://github.com/HypnoticSiege/stock-viewer/tree/main/data"
    click AAPL "https://github.com/HypnoticSiege/stock-viewer/blob/main/data/AAPL.json"
    click JPM "https://github.com/HypnoticSiege/stock-viewer/blob/main/data/JPM.json"
    click TSLA "https://github.com/HypnoticSiege/stock-viewer/blob/main/data/TSLA.json"

    %% Styles
    classDef client fill:#a8dadc,stroke:#457b9d,stroke-width:2px
    classDef frontend fill:#457b9d,stroke:#1d3557,stroke-width:2px,color:#fff
    classDef server fill:#e63946,stroke:#1d3557,stroke-width:2px,color:#fff
    classDef data fill:#f4a261,stroke:#264653,stroke-width:2px

    %% Legend
    subgraph Legend
        Client_["Client"]:::client
        Frontend_["Frontend"]:::frontend
        Server_["Server"]:::server
        Data_["Data"]:::data
    end
```
