# karakanb/devo architecture

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

- Interactive diagram: https://gitdiagram.com/karakanb/devo
- Repository: https://github.com/karakanb/devo

## Overview

##### Project Type & Purpose
- Devo is a browser extension (for both Google Chrome and Mozilla Firefox) that serves as a custom new-tab page by aggregating content from several platforms (GitHub Trending, Hacker News, Product Hunt, Designer News, DEV Community, Lobsters, and TabNews).
- Its key functionality is to fetch and display external web content while locally caching the data for 30 minutes to reduce API calls and improve performance.
- The front-end is built using Vue.js. The extension uses Vue single-file components (with .vue extensions), custom layouts, and a state management layer (store.js) for handling application state and caching.

##### Analysis of the File Structure
- Top-Level Files & Configurations:
- Files like package.json, babel.config.js, vue.config.js, .gitignore, and .editorconfig indicate standard JavaScript (Vue) project configurations and build settings.
- The presence of Netlify configuration (netlify.toml) and several GitHub workflows (in .github/workflows) suggest CI/CD integration and automated testing/analysis.
- Public Directory:
- index.html, which is likely the root HTML file for the extension’s new tab UI.
- src Directory:
- Contains App.vue – the main application component.
- The components directory is structured with subdirectories for each supported platform (GitHub, Hacker News, ProductHunt, etc.) where each platform’s UI components (typically named Body.vue and Row.vue) are defined.
- layouts directory offers multiple layout options (e.g., SingleColumn, TwoColumns, ThreeColumns) that the UI can use in order to render the news cards or platform components flexibly.
- settings.js and store.js imply that platform configurations and state management (possibly including caching logic) are handled in these files.
- The bodies.js file is a central point for managing and exporting the different platform body components.
- Scripts Directory:
- Contains deployment and build-related scripts (e.g., deploy-chrome.sh, prepare-zip.sh, update-manifest.sh), which are useful for building and packaging the extension.

- Browser Environment:
- “Client Browser” where the extension operates. This includes two primary runtime contexts:
▸ The New Tab UI (rendered from public/index.html and bootstrapped by src/main.js).
▸ The Background Script (public/background.js) which may handle background tasks such as managing cache timing.
- UI Layer (Front-end) Components:
- Main Application Component (App.vue): This is the central Vue component that ties the UI together.
- Layouts: Illustrate the different layout components (from src/layouts) such as SingleColumn, TwoColumns, etc. They determine how content (cards) is arranged.
- News/Platform Cards: Represent each platform’s group of components. For example, separate sub-modules for GitHub, Hacker News, Product Hunt, Designer News, DEV Community, Lobsters, and TabNews. Each group includes a Body component and a Row component.
- Shared Components: Elements like Card.vue, PlatformCard.vue, LayoutSelect.vue, ToggleSwitch.vue, and Loading.vue that provide shared visuals or UI interactions.

- Data & State Management Layer:
- Settings (settings.js): Represent configuration details for each platform.
- Bodies Aggregator (bodies.js): Acts as a registry for platform-specific display components.

- External Services:
- Caching Mechanism: Show that the extension caches data for 30 minutes at the client side, possibly by representing local storage (or in-memory caching) in conjunction with store.js.

- Build & Deployment:
- Deployment Scripts: Represent the processes involved by the scripts (e.g., deploy-chrome.sh for packaging the extension, update-manifest.sh for managing manifest versioning).
- CI/CD Pipelines: Highlight the GitHub workflows (and Netlify deployment) showing that code quality and deployment automation are integral parts of the development lifecycle.

##### Architectural Patterns & Design Principles
- Component-Based Architecture: Emphasize that the UI is composed of multiple, reusable Vue components organized by functionality.
- Separation of Concerns: Illustrate how the UI, state management (store), and configuration (settings) are separated. This further extends to separating content from presentation (using layout components).
- Extensibility: Note that adding new platforms is straightforward by following standardized component patterns (adding a body component, updating the bodies.js registry, modifying settings.js, and store.js)—this design promotes good maintainability and scalability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser Environment
    subgraph "Browser Environment"
        newTab["New Tab UI"]:::browser
        background["Background Script"]:::browser
    end

    %% UI Layer (Front-end)
    subgraph "UI Layer (Front-end)"
        mainApp["Main Vue App"]:::internal
        layouts["Layout Components"]:::internal
        subgraph "Platform Cards"
            github["GitHub Cards"]:::internal
            hacker["HackerNews Cards"]:::internal
            product["ProductHunt Cards"]:::internal
            designer["DesignerNews Cards"]:::internal
            dev["DEV Community Cards"]:::internal
            lobsters["Lobsters Cards"]:::internal
            tabnews["TabNews Cards"]:::internal
        end
        subgraph "Shared UI Components"
            card["Card Component"]:::internal
            platformCard["PlatformCard Component"]:::internal
            layoutSelect["LayoutSelect Component"]:::internal
            toggleSwitch["ToggleSwitch Component"]:::internal
            loading["Loading Component"]:::internal
        end
    end

    %% Data & State Management
    subgraph "Data & State Management"
        store["Store (State Management)"]:::data
        settings["Settings"]:::data
        bodies["Bodies Aggregator"]:::data
    end

    %% External Services
    subgraph "External Services"
        apis["External APIs"]:::external
    end

    %% Build & Deployment / CI-CD
    subgraph "Build & Deployment / CI-CD"
        deployment["Deployment Scripts"]:::deployment
        cicd["CI/CD & Config"]:::deployment
    end

    %% Connections
    newTab -->|"bootstraps"| mainApp
    mainApp -->|"renders"| layouts
    mainApp -->|"renders"| github
    mainApp -->|"renders"| hacker
    mainApp -->|"renders"| product
    mainApp -->|"renders"| designer
    mainApp -->|"renders"| dev
    mainApp -->|"renders"| lobsters
    mainApp -->|"renders"| tabnews
    mainApp -->|"uses"| card
    mainApp -->|"uses"| platformCard
    mainApp -->|"uses"| layoutSelect
    mainApp -->|"uses"| toggleSwitch
    mainApp -->|"uses"| loading
    background -->|"updatesCache"| store
    mainApp -- "fetchData" --> store
    store -->|"fetch"| apis
    store -->|"configUses"| settings
    store -->|"registry"| bodies
    layouts -->|"arranges"| github
    layouts -->|"arranges"| hacker
    layouts -->|"arranges"| product
    layouts -->|"arranges"| designer
    layouts -->|"arranges"| dev
    layouts -->|"arranges"| lobsters
    layouts -->|"arranges"| tabnews
    cicd -->|"triggers"| deployment

    %% Click Events
    click newTab "https://github.com/karakanb/devo/blob/master/public/index.html"
    click background "https://github.com/karakanb/devo/blob/master/public/background.js"
    click mainApp "https://github.com/karakanb/devo/blob/master/src/App.vue"
    click layouts "https://github.com/karakanb/devo/tree/master/src/layouts/"
    click github "https://github.com/karakanb/devo/tree/master/src/components/GitHub/"
    click hacker "https://github.com/karakanb/devo/tree/master/src/components/HackerNews/"
    click product "https://github.com/karakanb/devo/tree/master/src/components/ProductHunt/"
    click designer "https://github.com/karakanb/devo/tree/master/src/components/DesignerNews/"
    click dev "https://github.com/karakanb/devo/tree/master/src/components/Devto/"
    click lobsters "https://github.com/karakanb/devo/tree/master/src/components/Lobsters/"
    click tabnews "https://github.com/karakanb/devo/tree/master/src/components/TabNews/"
    click card "https://github.com/karakanb/devo/blob/master/src/components/Card.vue"
    click platformCard "https://github.com/karakanb/devo/blob/master/src/components/PlatformCard.vue"
    click layoutSelect "https://github.com/karakanb/devo/blob/master/src/components/LayoutSelect.vue"
    click toggleSwitch "https://github.com/karakanb/devo/blob/master/src/components/ToggleSwitch.vue"
    click loading "https://github.com/karakanb/devo/blob/master/src/components/Loading.vue"
    click store "https://github.com/karakanb/devo/blob/master/src/store.js"
    click settings "https://github.com/karakanb/devo/blob/master/src/settings.js"
    click bodies "https://github.com/karakanb/devo/blob/master/src/components/bodies.js"
    click deployment "https://github.com/karakanb/devo/tree/master/scripts/"
    click cicd "https://github.com/karakanb/devo/tree/master/.github/workflows/"

    %% Styles
    classDef browser fill:#e3f2fd,stroke:#1e88e5,stroke-width:2px;
    classDef internal fill:#c8e6c9,stroke:#388e3c,stroke-width:2px;
    classDef data fill:#ffe0b2,stroke:#f57c00,stroke-width:2px;
    classDef external fill:#fff9c4,stroke:#fbc02d,stroke-width:2px;
    classDef deployment fill:#d1c4e9,stroke:#7e57c2,stroke-width:2px;
```
