# mfing26/webdevelopmentprojects architecture

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

- Interactive diagram: https://gitdiagram.com/mfing26/webdevelopmentprojects
- Repository: https://github.com/mfing26/webdevelopmentprojects

## Overview

##### Project Type and Purpose
- This repo contains two front-end projects:
a. “Simple HTML Webpages” – a pure static site (Home, Add-Product, Product) for a fictional skincare brand.
b. “my-app” – a Create-React-App single‐page application (SPA) that displays happiness rankings fetched from an external API.

##### File Structure
- Top level:
- README.md (overall description)
- React/my-app (CRA project)
- Simple HTML Webpages (static pages)
- “Simple HTML Webpages”:
- index.html, add-product.html, product.html
- /css for page styles
- /images for assets
- “my-app”:
- public/ for static HTML shell (index.html, manifest, robots.txt)
- src/
– components/ (Footer, NavBar, SpotlightCard, SplitText) – reusable UI blocks
– pages/ (HomePage, FilterPage, FactorsPage, LoginPage, RegisterPage) – routed views
– services/api.js – HTTP client for external “Happiness Rankings” API
– assets/, css/, styles.css – images and styling
– index.js, App.js – app bootstrap and root component

##### README for Additional Insights
- Confirms that:
- Static site is purely client-side.
- React app is a front-end only SPA with no custom backend—data comes from a third-party API.

a. Main Components
1. User’s Web Browser (entry point)
2. Static Web Server (serves both projects as static assets)
– Simple HTML Pages
– React App (public/ + bundled src/)
3. SPA Subsystems (inside the React App)
- Routing Layer (React Router serving pages)
- Page Components (pages/*.js)
- UI Components (components/*.js)
- Styles & Assets (css/, assets/)
- API Service (services/api.js)
4. External Service – “Happiness Rankings API”
b. Relationships and Data Flow
- Browser → Web Server: requests HTML/CSS/JS for either the static site or SPA.
- SPA (in-browser) → External API: fetches JSON data via services/api.js.
- SPA’s Service Layer → UI: passes fetched data to Page Components → renders via UI Components.
c. Architectural Patterns & Principles
- Static-site hosting model for Simple HTML – no dynamic backend.
- SPA architecture for React:
- Unidirectional data flow (Service → Page → Component)
- Separation of concerns: components vs. pages vs. services
- Client-side routing (single index.html)
d. Key Technologies
- HTML/CSS/JS (static pages)
- React, ReactDOM, React Router
- Axios or fetch in services/api.js
- CSS modules or global styles (css/, styles.css)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External User
    Browser(["User's Web Browser"]):::external

    %% Deployment Context
    StaticHost(["Static Web Server (e.g., GitHub Pages / Nginx)"]):::host

    Browser -->|requests assets| StaticHost

    %% Static Site Subgraph
    subgraph "Simple HTML Webpages" 
        direction TB
        SH_index["index.html"]:::static
        SH_add["add-product.html"]:::static
        SH_prod["product.html"]:::static
        SH_css["css/ (styles)"]:::static
        SH_images["images/ (assets)"]:::static
    end

    StaticHost --> SH_index
    StaticHost --> SH_add
    StaticHost --> SH_prod
    StaticHost --> SH_css
    StaticHost --> SH_images

    %% React SPA Subgraph
    subgraph "React SPA (my-app)" 
        direction TB

        subgraph "Public Shell"
            direction TB
            SPA_index["index.html"]:::static
            SPA_manifest["manifest.json"]:::static
            SPA_robots["robots.txt"]:::static
        end

        subgraph "App Bootstrap & Routing"
            direction TB
            SPA_bootstrap["src/index.js"]:::react
            SPA_root["src/App.js"]:::react
        end

        subgraph "Routing Layer (Pages)"
            direction TB
            Page_home["HomePage.js"]:::react
            Page_filter["FilterPage.js"]:::react
            Page_factors["FactorsPage.js"]:::react
            Page_login["LoginPage.js"]:::react
            Page_register["RegisterPage.js"]:::react
        end

        subgraph "UI Components"
            direction TB
            UI_nav["NavBar.js"]:::react
            UI_footer["Footer.js"]:::react
            UI_spotlight["SpotlightCard.js"]:::react
            UI_split["SplitText.js"]:::react
        end

        subgraph "Service Layer"
            direction TB
            API_service["services/api.js"]:::service
        end

        subgraph "Styles & Assets"
            direction TB
            SPA_styles["styles.css, css/"]:::static
            SPA_assets["assets/"]:::static
        end
    end

    StaticHost -->|"serves SPA shell"| SPA_index
    StaticHost --> SPA_manifest
    StaticHost --> SPA_robots

    SPA_index --> SPA_bootstrap
    SPA_bootstrap --> SPA_root
    SPA_root --> Page_home
    SPA_root --> Page_filter
    SPA_root --> Page_factors
    SPA_root --> Page_login
    SPA_root --> Page_register

    Page_home --> UI_nav
    Page_home --> UI_footer
    Page_home --> UI_spotlight
    Page_filter --> UI_nav
    Page_filter --> UI_footer
    Page_factors --> UI_nav
    Page_factors --> UI_footer
    Page_login --> UI_nav
    Page_login --> UI_footer
    Page_register --> UI_nav
    Page_register --> UI_footer

    Page_home --> API_service
    Page_filter --> API_service
    Page_factors --> API_service

    API_service -->|"fetches JSON"| ExternalAPI

    %% External Service
    ExternalAPI[(Happiness Rankings API)]:::external

    %% Click Events
    click SH_index "https://github.com/mfing26/webdevelopmentprojects/blob/main/Simple HTML Webpages/index.html"
    click SH_add "https://github.com/mfing26/webdevelopmentprojects/blob/main/Simple HTML Webpages/add-product.html"
    click SH_prod "https://github.com/mfing26/webdevelopmentprojects/blob/main/Simple HTML Webpages/product.html"
    click SH_css "https://github.com/mfing26/webdevelopmentprojects/tree/main/Simple HTML Webpages/css/"
    click SH_images "https://github.com/mfing26/webdevelopmentprojects/tree/main/Simple HTML Webpages/images/"
    click SPA_index "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/public/index.html"
    click SPA_manifest "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/public/manifest.json"
    click SPA_robots "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/public/robots.txt"
    click SPA_bootstrap "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/index.js"
    click SPA_root "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/App.js"
    click Page_home "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/pages/HomePage.js"
    click Page_filter "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/pages/FilterPage.js"
    click Page_factors "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/pages/FactorsPage.js"
    click Page_login "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/pages/LoginPage.js"
    click Page_register "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/pages/RegisterPage.js"
    click UI_nav "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/components/NavBar.js"
    click UI_footer "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/components/Footer.js"
    click UI_spotlight "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/components/SpotlightCard.js"
    click UI_split "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/components/SplitText.js"
    click API_service "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/services/api.js"
    click SPA_styles "https://github.com/mfing26/webdevelopmentprojects/blob/main/React/my-app/src/styles.css"
    click SPA_assets "https://github.com/mfing26/webdevelopmentprojects/tree/main/React/my-app/src/assets/"

    %% Styles
    classDef static fill:#e0f7fa,stroke:#006064,color:#000
    classDef react fill:#e8f5e9,stroke:#1b5e20,color:#000
    classDef service fill:#fff3e0,stroke:#e65100,color:#000
    classDef external fill:#f5f5f5,stroke:#9e9e9e,color:#000
    classDef host fill:#ede7f6,stroke:#5e35b1,color:#000
```
