# zeroualihossam/news-tfg-website architecture

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

- Interactive diagram: https://gitdiagram.com/zeroualihossam/news-tfg-website
- Repository: https://github.com/zeroualihossam/news-tfg-website

## Overview

##### Project type and purpose
- This is a single-page front-end application built with Create React App (CRA).
- It functions as a news-viewing/aggregation UI: pulling data via client-side API calls, grouping news, and rendering multiple views (main, video, news list).

##### File structure
- Top level:
- public/ – static shell (index.html, manifest.json, robots.txt)
- src/ – application code
- Under src/:
- api/apiFunctions.js – encapsulates all fetch calls to external services
- assets/news_groups.json – local grouping metadata for news categories
- components/ – shared, presentational and layout components (header, footer, layout, toggle, spinner, news card)
- hooks/useSEO.js – a custom hook for setting meta tags/SEO per page
- pages/ – route-level components (HomePage, MainPage, MainPageVideo, NewsPage)
- App.jsx + index.js – application entry point and router setup
- Config/build: package.json, package-lock.json, CRA scripts for start, build, test, eject

##### README for additional insights
- Confirms standard CRA setup—no custom back-end or microservices.
- Deployment is static: “npm run build” outputs optimized bundle for hosting on any static server or CDN.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Top-level user and runtime
    Browser["Browser (User Agent)"]:::external

    %% Frontend Application
    subgraph "Frontend Application"
        direction TB

        subgraph "App Shell"
            direction TB
            HTML["index.html"]:::shell
            Manifest["manifest.json"]:::shell
        end

        subgraph "App Entry & Router"
            direction TB
            Entry["index.js"]:::entry
            AppRouter["App.jsx"]:::entry
        end

        subgraph "Pages"
            direction TB
            HomePage["HomePage.jsx"]:::page
            MainPage["MainPage.jsx"]:::page
            VideoPage["MainPageVideo.jsx"]:::page
            NewsList["NewsPage.jsx"]:::page
        end

        subgraph "Shared Components"
            direction TB
            Layout["Layout.jsx"]:::component
            Header["header.jsx"]:::component
            Footer["footer.jsx"]:::component
            ToggleSwitch["ToggleViewSwitch.jsx"]:::component
            Spinner["LoadingSpinner.jsx"]:::component
            NewsCard["news.jsx"]:::component
        end

        subgraph "Custom Hooks"
            direction TB
            SEOHook["useSEO.js"]:::hook
        end

        subgraph "Data Layer"
            direction TB
            APILayer["apiFunctions.js"]:::api
            NewsGroups["news_groups.json"]:::asset
        end
    end

    %% External services
    subgraph "External Services"
        ExternalAPI["News API (HTTP GET/JSON)"]:::external
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        direction TB
        Package["package.json / package-lock.json"]:::deploy
        BuildProcess["npm scripts / Webpack & Babel"]:::deploy
        Bundle["Static Bundle (JS/CSS)"]:::deploy
        Host["Static Hosting / CDN"]:::deploy
    end

    %% Relationships
    Browser -->|"loads shell"| HTML
    HTML -->|"Loads JS bundle"| AppRouter
    AppRouter -->|initializes| Entry
    Entry -->|renders| AppRouter
    AppRouter -->|"routes to"| HomePage
    AppRouter -->|routes to| MainPage
    AppRouter -->|routes to| VideoPage
    AppRouter -->|routes to| NewsList

    HomePage -->|"uses"| Header
    MainPage -->|"uses"| Header
    VideoPage -->|"uses"| Header
    NewsList -->|"uses"| Header

    HomePage -->|"uses"| Footer
    MainPage -->|"uses"| Footer
    VideoPage -->|"uses"| Footer
    NewsList -->|"uses"| Footer

    HomePage -->|"uses"| Layout
    MainPage -->|"uses"| Layout
    VideoPage -->|"uses"| Layout
    NewsList -->|"uses"| Layout

    HomePage -->|calls| APILayer
    MainPage -->|calls| APILayer
    VideoPage -->|calls| APILayer
    NewsList -->|calls| APILayer

    APILayer -->|HTTP GET / JSON| ExternalAPI
    ExternalAPI -->|JSON response| APILayer
    APILayer -->|data| NewsCard
    APILayer -->|data| Layout

    Any["Any Page"] -->|invokes| SEOHook
    NewsGroups -->|loaded by| APILayer
    NewsGroups -->|loaded by| Layout

    Package -->|defines build| BuildProcess
    BuildProcess -->|produces| Bundle
    Bundle -->|hosted on| Host
    Host -->|served to| Browser

    %% Click Events
    click HTML "https://github.com/zeroualihossam/news-tfg-website/blob/main/public/index.html"
    click Manifest "https://github.com/zeroualihossam/news-tfg-website/blob/main/public/manifest.json"
    click Entry "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/index.js"
    click AppRouter "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/App.jsx"
    click APILayer "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/api/apiFunctions.js"
    click NewsGroups "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/assets/news_groups.json"
    click SEOHook "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/hooks/useSEO.js"
    click HomePage "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/pages/HomePage.jsx"
    click MainPage "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/pages/MainPage.jsx"
    click VideoPage "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/pages/MainPageVideo.jsx"
    click NewsList "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/pages/NewsPage.jsx"
    click Layout "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/components/Layout.jsx"
    click Header "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/components/header/header.jsx"
    click Footer "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/components/footer/footer.jsx"
    click ToggleSwitch "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/components/ToggleViewSwitch.jsx"
    click Spinner "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/components/LoadingSpinner/LoadingSpinner.jsx"
    click NewsCard "https://github.com/zeroualihossam/news-tfg-website/blob/main/src/components/news/news.jsx"
    click Package "https://github.com/zeroualihossam/news-tfg-website/blob/main/package.json"

    %% Styles
    classDef shell fill:#B3E5FC,stroke:#0288D1,color:#000
    classDef entry fill:#E1F5FE,stroke:#0288D1,color:#000
    classDef page fill:#BBDEFB,stroke:#1976D2,color:#000
    classDef component fill:#E3F2FD,stroke:#42A5F5,color:#000
    classDef hook fill:#C8E6C9,stroke:#388E3C,color:#000
    classDef api fill:#DCEDC8,stroke:#689F38,color:#000
    classDef asset fill:#FFF9C4,stroke:#FBC02D,color:#000
    classDef external fill:#FFE0B2,stroke:#FB8C00,color:#000
    classDef deploy fill:#CFD8DC,stroke:#455A64,color:#000
```
