# magic9701/nepalebc architecture

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

- Interactive diagram: https://gitdiagram.com/magic9701/nepalebc
- Repository: https://github.com/magic9701/nepalebc

## Overview

##### Project type and purpose
- This is a static, single-page React application (a personal blog) that runs entirely in the browser and is deployed (via GitHub Pages or any static host).
- Its purpose is to present blog posts, photos and a short video about the author’s Nepal EBC journey, all sourced from local JSON and static assets.

##### File structure
- Top-level config: .env, ESLint, Prettier, package.json + lock, jsconfig for IDE paths.
- public/ holds index.html, manifest.json, robots.txt and screenshot images.
- src/ is the application root:
- index.jsx → bootstraps React (ReactDOM.render → App).
- App.jsx → sets up BrowserRouter and global providers (e.g., reportWebVitals, ScrollToTop).
- src/pages/ → page-level components (MainPage, About, Article, SingleArticle, Contact, Video).
- src/components/ → reusable UI pieces (Nav, Footer, Card variants, PhotoGallery, SectionTitle, Layout wrapper).
- src/data/blog/blog.json → the blog post metadata/content.
- src/styles/ → global SCSS (reset, base) and per-component .module.scss styling.
- Tests (App.test.js), setupTests.js for Jest, reportWebVitals.js for performance logging.

##### README for additional insights
- Confirms single-page blog, deployed on GitHub Pages.
- No mention of a backend or external APIs—data is loaded from a local JSON file.
- Static screenshots suggest no dynamic server-side rendering.

a. Main components:
1. User’s Web Browser (Client)
2. Static Host/CDN (GitHub Pages or equivalent)
3. React Application
- Router Layer
- Page Components
- Shared UI Components
- Data Layer (fetching from blog.json)
5. Build Pipeline (npm scripts: lint, test, build)
b. Relationships and interactions:
- Browser → HTTP GET index.html from Host/CDN
- index.html → loads bundled JS/CSS
- React App initializes, Router picks path → corresponding Page component renders
- Components request blog.json (local HTTP fetch) → render cards, articles
- Components pull assets (photos, video) from /static-assets folders
c. Architectural patterns/design principles:
- Single-Page Application with client-side routing (React Router)
- Component-driven UI (function components + CSS modules)
- Separation of concerns: pages vs. shared components vs. assets vs. data
- Local JSON as a simple data layer (no remote API)
- Build → static bundle (no server logic)
d. Key technologies/frameworks/libraries:
- React, React Router
- CSS Modules + SCSS
- Jest + React Testing Library
- ESLint, Prettier
- GitHub Pages (or static file server)

##### Detailed breakdown
- Left side: Developer machine → npm scripts (lint, test, build) → generates /build.
- Top center: Static Host/CDN serving /build/index.html + assets.
- Bottom center: Browser loads index.html → bundle.js → React initialization.
- Center: React Router with five route branches → calls to Page components.
- Right side: Data layer (local fetch of blog.json) and Assets store (requests for images/video).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer and Build Pipeline
    DevMachine["Developer Machine"]:::component
    NPMScripts["npm scripts (lint, test, build)"]:::pipeline
    BuildOutput["Build Output (/build)"]:::pipeline

    DevMachine --> NPMScripts --> BuildOutput

    %% Static Host/CDN
    Host["Static Host/CDN"]:::host
    BuildOutput --> Host

    %% Public Assets served
    Host --> indexHTML["index.html"]:::host
    Host --> manifest["manifest.json"]:::host
    Host --> robots["robots.txt"]:::host

    indexHTML --> Browser["User Web Browser"]:::browser

    %% React Application Initialization
    Browser --> ReactApp["React Application"]:::component

    subgraph "React Application"
        direction TB
        Router["Router Layer"]:::component
        click Router "https://github.com/magic9701/nepalebc/blob/main/src/App.jsx"

        subgraph "Page Components"
            direction TB
            MainPage["MainPage"]:::component
            click MainPage "https://github.com/magic9701/nepalebc/blob/main/src/pages/MainPage/MainPage.jsx"
            AboutPage["AboutPage"]:::component
            click AboutPage "https://github.com/magic9701/nepalebc/blob/main/src/pages/About/AboutPage.jsx"
            ArticlePage["ArticlePage"]:::component
            click ArticlePage "https://github.com/magic9701/nepalebc/blob/main/src/pages/Article/ArticlePage.jsx"
            SingleArticlePage["SingleArticlePage"]:::component
            click SingleArticlePage "https://github.com/magic9701/nepalebc/blob/main/src/pages/SingleArticle/SingleArticlePage.jsx"
            ContactPage["ContactPage"]:::component
            click ContactPage "https://github.com/magic9701/nepalebc/blob/main/src/pages/Contact/ContactPage.jsx"
            VideoPage["VideoPage"]:::component
            click VideoPage "https://github.com/magic9701/nepalebc/blob/main/src/pages/Video/VideoPage.jsx"
        end

        subgraph "Shared UI Components"
            direction TB
            Nav["Navigation"]:::component
            click Nav "https://github.com/magic9701/nepalebc/blob/main/src/components/Nav/Nav.jsx"
            Footer["Footer"]:::component
            click Footer "https://github.com/magic9701/nepalebc/blob/main/src/components/Footer/Footer.jsx"
            BlogCard["BlogCard"]:::component
            click BlogCard "https://github.com/magic9701/nepalebc/blob/main/src/components/Card/BlogCard.jsx"
            BlogLongCard["BlogLongCard"]:::component
            click BlogLongCard "https://github.com/magic9701/nepalebc/blob/main/src/components/Card/BlogLongCard.jsx"
            PhotoGallery["PhotoGallery"]:::component
            click PhotoGallery "https://github.com/magic9701/nepalebc/blob/main/src/components/PhotoGallery/MainPhotoGallery.jsx"
            SectionTitle["SectionTitle"]:::component
            click SectionTitle "https://github.com/magic9701/nepalebc/blob/main/src/components/SectionTitle/SectionTitle.jsx"
            MainLayout["Layout Wrapper"]:::component
            click MainLayout "https://github.com/magic9701/nepalebc/blob/main/src/components/Layout/MainLayout.jsx"
            ScrollToTop["ScrollToTop"]:::component
            click ScrollToTop "https://github.com/magic9701/nepalebc/blob/main/src/components/ScrollToTop.jsx"
        end

        DataLayer["blog.json"]:::data
        click DataLayer "https://github.com/magic9701/nepalebc/blob/main/src/data/blog/blog.json"

        subgraph "Static Assets"
            direction TB
            Icons["Icons"]:::assets
            click Icons "https://github.com/magic9701/nepalebc/tree/main/src/assets/icons"
            Photos["Photos"]:::assets
            click Photos "https://github.com/magic9701/nepalebc/tree/main/src/assets/photos"
            Video["Video"]:::assets
            click Video "https://github.com/magic9701/nepalebc/blob/main/src/assets/video/mainpage-video.mp4"
        end

        Router -->|routes to| MainPage
        Router --> AboutPage
        Router --> ArticlePage
        Router --> SingleArticlePage
        Router --> ContactPage
        Router --> VideoPage

        ReactApp --> Router
        ReactApp --> DataLayer
        ReactApp --> Icons
        ReactApp --> Photos
        ReactApp --> Video
        ReactApp --> Nav
        ReactApp --> Footer
        ReactApp --> BlogCard
        ReactApp --> BlogLongCard
        ReactApp --> PhotoGallery
        ReactApp --> SectionTitle
        ReactApp --> MainLayout
        ReactApp --> ScrollToTop
    end

    %% Entry Point
    Entry["Entry Point (index.jsx)"]:::component
    click Entry "https://github.com/magic9701/nepalebc/blob/main/src/index.jsx"
    Browser --> Entry --> ReactApp

    classDef component fill:#E3F2FD,stroke:#90CAF9,color:#0D47A1
    classDef pipeline fill:#FFF3E0,stroke:#FFB74D,color:#E65100
    classDef host fill:#ECEFF1,stroke:#B0BEC5,color:#37474F
    classDef browser fill:#E8F5E9,stroke:#66BB6A,color:#1B5E20
    classDef data fill:#E8F5E9,stroke:#43A047,color:#1B5E20
    classDef assets fill:#F3E5F5,stroke:#BA68C8,color:#4A148C
```
