# macalistair1/nepalipulse architecture

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

- Interactive diagram: https://gitdiagram.com/macalistair1/nepalipulse
- Repository: https://github.com/macalistair1/nepalipulse

## Overview

##### Project type and purpose
- Nepali Pulse is a static, mobile-friendly web application (front-end only) that aggregates real-time data on fuel prices, share market trends, music videos, gold/silver rates, currency exchange, bank interest rates, social hashtags, and date conversion.
- There is no custom backend in this repository; all data is fetched at runtime from external public APIs.

##### File structure
- Top-level HTML pages (bank.html, oil.html, earthquake.html, etc.) each correspond to a feature/view.
- Common assets and utilities:
- index.html: main navigation shell (mobile-frame UI)
- styles.css, calendar.css: global and feature CSS
- common.js, script.js: shared JavaScript functions and routing logic
- feature-specific JS files (oil.js, banks.js, date-convert.js, etc.) implement data fetch & DOM updates
- No server-side code, build scripts, or configuration files beyond static assets.

##### README for insights
- Describes each feature, usage, and technology stack: HTML5, CSS3, vanilla JS.
- Mentions mobile frame background for an “app-like” UI.
- Hosts via GitHub Pages (static site).

a. Main components
- User’s Browser (Mobile-sized viewport)
- Front-End Static Host (e.g., GitHub Pages/CDN)
- Static Assets: HTML, CSS, JS, Images
- External Data Providers/APIs:
– Nepal Oil Corporation API
– Share Market Data API
– YouTube Data API (top music videos)
– Metals Price API (gold, silver)
– Currency Exchange API
– Bank Rates API
– Social Media Trending Hashtags API
– (Date conversion uses local library; no external call)
b. Relationships & data flow
1. Browser requests HTML/CSS/JS from Static Host
2. Browser loads index.html → common.js → renders navigation frame
3. User selects a feature → feature-specific HTML/JS loaded or routed
4. Feature JS makes HTTP(S) requests to external API
5. API responds with JSON → JS parses and updates the DOM
c. Architectural patterns & design principles
- Static Multi-Page Application with shared utilities (common.js)
- Separation of concerns: each feature has its own HTML/JS pair plus shared styling
- Client-side rendering of data via asynchronous HTTP calls
- Reuse of assets and common modules to minimize duplication
d. Key technologies/frameworks
- HTML5, CSS3
- Vanilla JavaScript (ES6 modules or IIFE pattern)
- Fetch API / XMLHttpRequest for REST calls
- JSON as the data interchange format
- Hosting via GitHub Pages (or any static site CDN)

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["User's Browser\n(Mobile Viewport)"]:::frontend
    StaticHost["Static Host\n(GitHub Pages/CDN)"]:::static

    StaticHost -->|"serves HTML/CSS/JS/Assets"| Browser

    subgraph "Frontend Code"
        indexHTML["Index\n(index.html)"]:::static
        stylesCSS["Global Styles\n(styles.css)"]:::static
        calendarCSS["Calendar Styles\n(calendar.css)"]:::static
        commonJS["Shared JS Utilities\n(common.js)"]:::frontend
        scriptJS["Routing & Init Logic\n(script.js)"]:::frontend
        assetsDir["Assets\n(assets/)"]:::static
    end

    StaticHost --> indexHTML
    StaticHost --> stylesCSS
    StaticHost --> calendarCSS
    StaticHost --> commonJS
    StaticHost --> scriptJS
    StaticHost --> assetsDir

    indexHTML --> Browser
    stylesCSS --> Browser
    calendarCSS --> Browser
    commonJS --> Browser
    scriptJS --> Browser
    assetsDir --> Browser

    subgraph "Features"
        oilHTML["Fuel Price View\n(oil.html)"]:::frontend
        oilJS["Fuel Price Logic\n(oil.js)"]:::frontend

        bankHTML["Bank Rates View\n(bank.html)"]:::frontend
        bankJS["Bank Rates Logic\n(bank.js)"]:::frontend

        dateHTML["Date Conversion View\n(date-convert.html)"]:::frontend
        dateJS["Date Conversion Logic\n(date-convert.js)"]:::frontend
        dateList["Date List Helper\n(date-list.js)"]:::frontend

        earthquakeHTML["Earthquake View\n(earthquake.html)"]:::frontend
        earthquakeJS["Earthquake Logic\n(earthquake.js)"]:::frontend

        hashtagsHTML["Top Hashtags View\n(top-hashtags.html)"]:::frontend
        hashtagsJS["Top Hashtags Logic\n(top-hashtags.js)"]:::frontend

        musicHTML["Music Video View\n(top-music-video.html)"]:::frontend
        musicJS["Music Video Logic\n(top-music-video.js)"]:::frontend

        lakesHTML["Top Lakes View\n(top-lakes.html)"]:::frontend
        lakesJS["Top Lakes Logic\n(lakes.js)"]:::frontend

        mountainsHTML["Top Mountains View\n(top-mountains.html)"]:::frontend
        mountainsJS["Top Mountains Logic\n(mountains.js)"]:::frontend

        patroJS["Nepali Calendar\n(patro.js)"]:::frontend
    end

    scriptJS --> oilHTML
    oilHTML --> oilJS
    oilJS -->|"GET /fuel-prices"| OilAPI

    scriptJS --> bankHTML
    bankHTML --> bankJS
    bankJS -->|"GET /bank-rates"| BankAPI

    scriptJS --> dateHTML
    dateHTML --> dateJS
    dateJS -->|"uses local library"| dateList

    scriptJS --> earthquakeHTML
    earthquakeHTML --> earthquakeJS
    earthquakeJS -->|"GET /earthquake-data"| EarthquakeAPI

    scriptJS --> hashtagsHTML
    hashtagsHTML --> hashtagsJS
    hashtagsJS -->|"GET /trending-hashtags"| HashtagsAPI

    scriptJS --> musicHTML
    musicHTML --> musicJS
    musicJS -->|"GET /top-music-videos"| YouTubeAPI

    scriptJS --> lakesHTML
    lakesHTML --> lakesJS
    lakesJS -->|"GET /lakes-data"| LakesAPI

    scriptJS --> mountainsHTML
    mountainsHTML --> mountainsJS
    mountainsJS -->|"GET /mountains-data"| MountainsAPI

    scriptJS --> patroJS

    subgraph "External APIs"
        OilAPI[(Nepal Oil Corporation API)]:::external
        BankAPI[(Bank Rates API)]:::external
        EarthquakeAPI[(Earthquake Data API)]:::external
        HashtagsAPI[(Social Media Hashtags API)]:::external
        YouTubeAPI[(YouTube Data API)]:::external
        LakesAPI[(Top Lakes Data API)]:::external
        MountainsAPI[(Top Mountains Data API)]:::external
    end

    classDef frontend fill:#D6EAF8,stroke:#21618C,stroke-width:1px
    classDef static fill:#F9E79F,stroke:#B7950B,stroke-width:1px
    classDef external fill:#ABEBC6,stroke:#1E8449,stroke-width:1px

    click indexHTML "https://github.com/macalistair1/nepalipulse/blob/main/index.html"
    click stylesCSS "https://github.com/macalistair1/nepalipulse/blob/main/styles.css"
    click calendarCSS "https://github.com/macalistair1/nepalipulse/blob/main/calendar.css"
    click commonJS "https://github.com/macalistair1/nepalipulse/blob/main/common.js"
    click scriptJS "https://github.com/macalistair1/nepalipulse/blob/main/script.js"
    click assetsDir "https://github.com/macalistair1/nepalipulse/tree/main/assets/"
    click oilHTML "https://github.com/macalistair1/nepalipulse/blob/main/oil.html"
    click oilJS "https://github.com/macalistair1/nepalipulse/blob/main/oil.js"
    click bankHTML "https://github.com/macalistair1/nepalipulse/blob/main/bank.html"
    click bankJS "https://github.com/macalistair1/nepalipulse/blob/main/bank.js"
    click dateHTML "https://github.com/macalistair1/nepalipulse/blob/main/date-convert.html"
    click dateJS "https://github.com/macalistair1/nepalipulse/blob/main/date-convert.js"
    click dateList "https://github.com/macalistair1/nepalipulse/blob/main/date-list.js"
    click earthquakeHTML "https://github.com/macalistair1/nepalipulse/blob/main/earthquake.html"
    click earthquakeJS "https://github.com/macalistair1/nepalipulse/blob/main/earthquake.js"
    click hashtagsHTML "https://github.com/macalistair1/nepalipulse/blob/main/top-hashtags.html"
    click hashtagsJS "https://github.com/macalistair1/nepalipulse/blob/main/top-hashtags.js"
    click musicHTML "https://github.com/macalistair1/nepalipulse/blob/main/top-music-video.html"
    click musicJS "https://github.com/macalistair1/nepalipulse/blob/main/top-music-video.js"
    click lakesHTML "https://github.com/macalistair1/nepalipulse/blob/main/top-lakes.html"
    click lakesJS "https://github.com/macalistair1/nepalipulse/blob/main/lakes.js"
    click mountainsHTML "https://github.com/macalistair1/nepalipulse/blob/main/top-mountains.html"
    click mountainsJS "https://github.com/macalistair1/nepalipulse/blob/main/mountains.js"
    click patroJS "https://github.com/macalistair1/nepalipulse/blob/main/patro.js"
```
