# upc-pre-202510-1asi0730-4368/catch-up architecture

> Architecture diagram of the GitHub repository upc-pre-202510-1asi0730-4368/catch-up, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/upc-pre-202510-1asi0730-4368/catch-up
- Repository: https://github.com/upc-pre-202510-1asi0730-4368/catch-up

## Overview

##### Project Type and Purpose
- This is a single‐page application (SPA) front-end built with Vue 3 and Vite.
- It fetches news articles and sources from an external API and displays them in multiple languages (i18n).
- There is no custom backend—data is retrieved directly from third-party endpoints.

##### High-Level Architecture Layers
Layer 1: Presentation (Vue Components & Pages)
Layer 2: Domain Model (Entities & Assemblers)
Layer 3: Data Access (API Services)
Layer 4: External Services & Hosting

##### Main Components
- index.html / Vite Dev Server & Build
- src/main.js — Vue app bootstrap
- src/App.vue — Root application shell
- src/i18n.js + src/locales/*.json — Internationalization layer
- src/public components — Header/Footer/LanguageSwitcher
- src/news/components — ArticleList, ArticleItem, SourceList, SourceItem, UnavailableContent
- src/shared/logo-api.service.js — Logo fetching service
- src/news/services/news-api.service.js — News API client
- src/news/services/*.assembler.js — Transform raw JSON into domain entities
- src/news/model/*.entity.js — Article and Source domain objects
- src/style.css — Global styles

##### External Dependencies & Environment
- .env.development / .env.production — API URLs, keys, feature flags
- External HTTP endpoints (News API, Logo API)

##### Architectural Patterns & Principles
- Layered architecture: separation of concerns between UI, domain logic, and data access.
- Single Responsibility Principle: each service or assembler does one job.
- Composition: Vue components compose smaller components (e.g., ArticleList contains ArticleItem).
- Dependency‐inversion: components depend on abstract services, not on raw fetch calls.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction
    USER["User"]:::external

    %% Browser Client with Presentation, Domain, Data
    subgraph "Browser (Client)"
        style Browser fill:none stroke:#888 stroke-dasharray:5 5

        %% Presentation Layer
        subgraph "Presentation Layer"
            INDEX["index.html"]:::codeMod
            VITE["Vite Dev Server & Build"]:::codeMod
            MAIN["main.js"]:::codeMod
            APP["App.vue"]:::codeMod
            I18N["i18n.js"]:::codeMod
            LOCALE_EN["en.json"]:::codeMod
            LOCALE_ES["es.json"]:::codeMod
            FOOTER["Footer"]:::codeMod
            LANGSW["LanguageSwitcher"]:::codeMod
            ARTICLE_LIST["ArticleList"]:::codeMod
            ARTICLE_ITEM["ArticleItem"]:::codeMod
            SOURCE_LIST["SourceList"]:::codeMod
            SOURCE_ITEM["SourceItem"]:::codeMod
            UNAVAIL["UnavailableContent"]:::codeMod
        end

        %% Domain Layer
        subgraph "Domain Layer"
            ART_ENT["ArticleEntity"]:::domain
            SRC_ENT["SourceEntity"]:::domain
            ART_ASM["ArticleAssembler"]:::domain
            SRC_ASM["SourceAssembler"]:::domain
        end

        %% Data Layer
        subgraph "Data Layer"
            NEWS_SVC["NewsAPIService"]:::codeMod
            LOGO_SVC["LogoAPIService"]:::codeMod
        end
    end

    %% External Services & Hosting
    subgraph "External"
        NEWS_API["News REST Endpoint"]:::external
        LOGO_API["Logo REST Endpoint"]:::external
        CDN["Static Host / CDN"]:::external
    end

    %% Data Flows
    USER -->|"1: interact"| ARTICLE_LIST
    ARTICLE_LIST -->|"2: fetchArticles()"| NEWS_SVC
    SOURCE_LIST -->|"2: fetchSources()"| NEWS_SVC
    NEWS_SVC -->|"3: HTTP GET"| NEWS_API
    NEWS_API -->|"4: JSON"| NEWS_SVC
    NEWS_SVC -->|"5: transform"| ART_ASM
    ART_ASM -->|"6: create"| ART_ENT
    NEWS_SVC -->|"5: transform"| SRC_ASM
    SRC_ASM -->|"6: create"| SRC_ENT
    LOGO_SVC -->|"3: HTTP GET"| LOGO_API
    LOGO_API -->|"4: JSON"| LOGO_SVC

    %% Bootstrap & Hosting
    VITE -->|"build"| CDN
    CDN -->|"serves"| INDEX
    INDEX -->|"loads"| MAIN
    MAIN -->|"bootstrap"| APP

    %% Click Events
    click INDEX "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/index.html"
    click VITE "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/vite.config.js"
    click MAIN "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/main.js"
    click APP "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/App.vue"
    click I18N "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/i18n.js"
    click LOCALE_EN "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/locales/en.json"
    click LOCALE_ES "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/locales/es.json"
    click FOOTER "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/public/footer-content.component.vue"
    click LANGSW "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/public/language-switcher.component.vue"
    click ARTICLE_LIST "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/news/components/article-list.component.vue"
    click ARTICLE_ITEM "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/news/components/article-item.component.vue"
    click SOURCE_LIST "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/news/components/source-list.component.vue"
    click SOURCE_ITEM "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/news/components/source-item.component.vue"
    click UNAVAIL "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/news/components/unavailable-content.component.vue"
    click ART_ENT "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/news/model/article.entity.js"
    click SRC_ENT "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/news/model/source.entity.js"
    click NEWS_SVC "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/news/services/news-api.service.js"
    click LOGO_SVC "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/shared/logo-api.service.js"
    click ART_ASM "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/news/services/article.assembler.js"
    click SRC_ASM "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/src/news/services/source.assembler.js"
    click ENV_DEV "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/.env.development"
    click ENV_PROD "https://github.com/upc-pre-202510-1asi0730-4368/catch-up/blob/main/.env.production"

    %% Styles
    classDef codeMod fill:#BFDBFE,stroke:#1E40AF;
    classDef domain fill:#A7F3D0,stroke:#166534;
    classDef external fill:#FDBA74,stroke:#C2410C;
```
