# duvancode/cloundserverextension architecture

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

- Interactive diagram: https://gitdiagram.com/duvancode/cloundserverextension
- Repository: https://github.com/duvancode/cloundserverextension

## Overview

##### Project type and purpose
- This is a Chrome Extension (manifest.json at the root) written in vanilla JavaScript.
- Purpose: a “Clound Server” UI that allows users to register/login (via traditional, OAuth2.0 or QR), upload/download files, and sync clipboard across devices by talking to an external backend service.

##### File structure
- Top‐level
- manifest.json – Chrome extension manifest
- package.json / build.js – build scripts or local dev tooling
- src/index.html, login.html, register.html – entry pages for the extension’s popup or UI panels
- src/css/… – style sheets (Tailwind + custom CSS)
- src/images/… – static assets
- src/libs/ – JavaScript modules organized by feature and layer
· home/, login/, register/ – each has components, events, lib wrappers
· services/general.service.js – HTTP/API calls to the external server
· utils/ – generic methods, string helpers, i18n (en.js, es.js), lang controller, config

##### README insights
- Describes features (registration, login, file upload, cloud clipboard).
- Notes a “front-end architecture proposal in vanilla JS.”
- No backend code here → the extension calls a remote API.

##### Elements
- UI → Events → Services → External API → Services → UI
- Background ↔ External API (for real-time clipboard sync)
- UI/Background ↔ chrome.storage or chrome.runtime
- Blue for UI/UI modules
- Green for services layer
- Yellow for utils/i18n
- Orange for Chrome APIs
- Red for external backend

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Chrome Extension" 
        direction TB

        %% UI Pages
        subgraph "Home Page (src/index.html)"
            direction TB
            HomePage["Home Page"]:::ui
            H_Comp["home.components.js"]:::ui
            H_Events["home.events.js"]:::events
            H_Lib["home.lib.js"]:::library
            H_Entry["home.js"]:::library

            HomePage -->|"renders"| H_Comp
            H_Comp -->|"binds"| H_Events
            H_Events -->|"calls logic"| H_Lib
            H_Lib -->|"entry point"| H_Entry
            H_Events -->|"uses"| Srv
        end

        subgraph "Login Page (src/login.html)"
            direction TB
            LoginPage["Login Page"]:::ui
            L_Comp["login.components.js"]:::ui
            L_Events["login.events.js"]:::events
            L_Lib["login.lib.js"]:::library
            L_Entry["login.js"]:::library

            LoginPage -->|"renders"| L_Comp
            L_Comp -->|"binds"| L_Events
            L_Events -->|"calls logic"| L_Lib
            L_Lib -->|"entry point"| L_Entry
            L_Events -->|"uses"| Srv
        end

        subgraph "Register Page (src/register.html)"
            direction TB
            RegisterPage["Register Page"]:::ui
            R_Comp["register.components.js"]:::ui
            R_Events["register.events.js"]:::events
            R_Lib["register.lib.js"]:::library
            R_Entry["register.js"]:::library

            RegisterPage -->|"renders"| R_Comp
            R_Comp -->|"binds"| R_Events
            R_Events -->|"calls logic"| R_Lib
            R_Lib -->|"entry point"| R_Entry
            R_Events -->|"uses"| Srv
        end

        %% Services and Utils
        Srv["general.service.js"]:::service
        subgraph "Utilities Layer"
            direction TB
            Utils_Generic["generic.methods.js"]:::utils
            Utils_String["string.methods.js"]:::utils
            Utils_LangCtrl["lang.controller.js"]:::utils
            Utils_EN["en.js"]:::utils
            Utils_ES["es.js"]:::utils
            Utils_Tailwind["tailwind.config.js"]:::utils

            Utils_LangCtrl --> Utils_EN
            Utils_LangCtrl --> Utils_ES
        end

        %% Background
        Background["Background/Service Worker"]:::bg
        Background -->|"WebSocket|Polling"| ClipboardAPI

        %% Chrome APIs
        subgraph "Chrome APIs"
            direction TB
            Chrome_Storage["chrome.storage"]:::chrome
            Chrome_Runtime["chrome.runtime"]:::chrome
            Chrome_Clipboard["chrome.clipboard"]:::chrome
        end

        %% Connections within extension
        HomePage -->|"chrome.storage.get"| Chrome_Storage
        LoginPage -->|"chrome.runtime.sendMessage"| Chrome_Runtime
        Background -->|"chrome.clipboard.write"| Chrome_Clipboard
        Srv -->|"formats/errors"| Utils_Generic
        Srv -->|"i18n"| Utils_LangCtrl
    end

    %% External Backend Services
    subgraph "External Backend" 
        direction TB
        AuthAPI["Auth Service (POST /login, /register)"]:::external
        FileAPI["File Storage Service (upload/download)"]:::external
        ClipboardAPI["Clipboard Sync Service (WebSocket)"]:::external
    end

    %% Data Flows to External
    Srv -->|"POST /login"| AuthAPI
    Srv -->|"POST /upload"| FileAPI
    Srv -->|"GET /download"| FileAPI
    Background -->|"WebSocket connect"| ClipboardAPI

    %% Click Events
    click HomePage "https://github.com/duvancode/cloundserverextension/blob/master/src/index.html"
    click LoginPage "https://github.com/duvancode/cloundserverextension/blob/master/src/login.html"
    click RegisterPage "https://github.com/duvancode/cloundserverextension/blob/master/src/register.html"
    click H_Comp "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/home/home.components.js"
    click H_Events "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/home/home.events.js"
    click H_Lib "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/home/home.lib.js"
    click H_Entry "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/home/home.js"
    click L_Comp "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/login/login.components.js"
    click L_Events "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/login/login.events.js"
    click L_Lib "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/login/login.lib.js"
    click L_Entry "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/login/login.js"
    click R_Comp "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/register/register.components.js"
    click R_Events "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/register/register.events.js"
    click R_Lib "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/register/register.lib.js"
    click R_Entry "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/register/register.js"
    click Srv "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/services/general.service.js"
    click Utils_Generic "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/utils/generic.methods.js"
    click Utils_String "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/utils/string.methods.js"
    click Utils_LangCtrl "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/utils/lang.controller.js"
    click Utils_EN "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/utils/lang/en.js"
    click Utils_ES "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/utils/lang/es.js"
    click Utils_Tailwind "https://github.com/duvancode/cloundserverextension/blob/master/src/libs/utils/tailwind.config.js"
    click Chrome_Storage "https://github.com/duvancode/cloundserverextension/blob/master/manifest.json"
    click Chrome_Runtime "https://github.com/duvancode/cloundserverextension/blob/master/manifest.json"
    click Chrome_Clipboard "https://github.com/duvancode/cloundserverextension/blob/master/manifest.json"
    click Background "https://github.com/duvancode/cloundserverextension/blob/master/manifest.json"
    click FileAPI "https://github.com/duvancode/cloundserverextension/tree/master/src/images/"
    click build.js "https://github.com/duvancode/cloundserverextension/blob/master/build.js"
    click package.json "https://github.com/duvancode/cloundserverextension/blob/master/package.json"

    %% Stylesheets click events
    click style1 "https://github.com/duvancode/cloundserverextension/blob/master/src/css/general.css"
    click style2 "https://github.com/duvancode/cloundserverextension/blob/master/src/css/index.css"
    click style3 "https://github.com/duvancode/cloundserverextension/blob/master/src/css/input.css"
    click style4 "https://github.com/duvancode/cloundserverextension/blob/master/src/css/login.css"
    click style5 "https://github.com/duvancode/cloundserverextension/blob/master/src/css/output.css"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#005cbf
    classDef events fill:#b8daff,stroke:#004085
    classDef library fill:#cce5ff,stroke:#005cbf
    classDef service fill:#d4edda,stroke:#155724
    classDef utils fill:#fff3cd,stroke:#856404
    classDef chrome fill:#ffe5b4,stroke:#d39e00
    classDef external fill:#f8d7da,stroke:#721c24
    classDef bg fill:#e2e3e5,stroke:#6c757d
```
