# jamebal/jmal-cloud-view architecture

> Architecture diagram of the GitHub repository jamebal/jmal-cloud-view, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jamebal/jmal-cloud-view
- Repository: https://github.com/jamebal/jmal-cloud-view

## Overview

##### Project’s Nature and Purpose
- This is a web-based personal cloud storage (网盘) application. The README clearly outlines that it supports integration with multiple OSS providers (e.g., Alibaba Cloud OSS, Tencent Cloud OSS, MinIO), online preview for various file types, and even editing capabilities for Office documents, flowcharts, and mind maps.

##### File Structure to Identify Key Components
- Frontend Application:
- The “src” folder contains Vue.js components, views (under src/views for different pages such as home, login, file management, settings), router, store (Vuex modules for app, user, settings), and API interfaces (in src/api) to interact with backend services.
- The “public” folder and configuration files (vue.config.js, babel.config.js, postcss.config.js) indicate the building and serving of static assets.
- UI Components & Libraries:
- Numerous components (e.g., FileTree, SearchDialog, MonacoEditorVue, Office editors like Drawio and OnlyOfficeEditor) are used to build the rich user interface.
- The assets under “src/assets” and “public/resource” provide third-party libraries including Element UI, axios, and others.
- Communication and Data Interaction:
- The “src/api” folder defines all API endpoints for file management, user, permissions, and other operations.
- The “src/sse” folder contains code for handling server-sent events, revealing real-time communication.
- Docker, Nginx, and Deployment:
- Configuration files such as Dockerfile, docker-compose hints, nginx.conf, and files under the “docker” directory denote containerized deployment and reverse proxy usage.
- The multiple .env files and GitHub workflows indicate an environment-aware configuration and CI/CD integration.
- External Services:
- The README suggests integration with external OSS providers. Although that logic is in the separate backend, the frontend must communicate with it through API calls.

##### Main Components & Their Relationships
- Frontend (Web Client):
- User Interface Layer – built with Vue.js, comprising layouts, components (file tree, dialogs, preview components, etc.), and views.
- API Layer – encapsulated in “src/api” and util functions (like request.js) that handle HTTP communications.
- State Management Layer – using Vuex (found in “src/store”) for managing state across the application.
- Real-Time Component – SSE handling for updates (src/sse) for dynamic data push.
- Backend Service (External – jmal-cloud-server):
- RESTful API that handles business logic, authentication, file storage management, and integration with multiple OSS providers.
- Database:
- MongoDB (as referenced in the README and the provided scripts for backup/restoration) serves as the persistent storage for user data and meta-information.
- Deployment and Infrastructure:
- Docker Containers – separate containers for the frontend (this project), the backend service, and the database. Docker Compose is used to orchestrate these containers.
- Nginx – used as a reverse proxy or to serve static content (with configuration files present in the root and under docker/nginx-drawio).
- External OSS Services:
- Third-party cloud storage providers (Alibaba, Tencent, MinIO) that are integrated via the backend, which the frontend indirectly interacts with.

##### Architectural Patterns & Design Principles
- Component-Based Architecture in the Frontend: Vue components are organized in a modular way, promoting separation of concerns.
- API-Driven Communication: The clear separation between the UI (in “src/api”) and backend logic supports a REST-based integration.
- Containerized Deployment: Docker and Nginx configuration files indicate an architecture that is consistent across environments.
- Real-Time Updates: SSE implementation indicates that the design supports reactive data updates without full page refreshes.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend (Vue.js Client)
    subgraph "Frontend (Vue.js Client)"
        UI["Frontend UI"]:::frontend
        API["API Communication Layer"]:::api
        Vuex["State Management (Vuex)"]:::state
        SSE["Real-Time SSE"]:::realTime
        Router["Routing System"]:::frontend
        Assets["Assets (src/assets)"]:::infrastructure
        Resources["Public Resources (public/resource)"]:::infrastructure
    end

    %% Backend Service
    Backend["Backend API Service"]:::backend

    %% Database
    DB["MongoDB"]:::database

    %% External OSS Providers
    OSS["External OSS Integration"]:::backend

    %% Deployment & Infrastructure
    subgraph "Deployment & Infrastructure"
        NginxProxy["Nginx Reverse Proxy"]:::infrastructure
        FrontContainer["Frontend Container"]:::container
        BackContainer["Backend Container"]:::container
        MongoContainer["MongoDB Container"]:::container
        Dockerfile["Dockerfile"]:::infrastructure
        DockerDir["docker/"]:::infrastructure
        NginxConf["nginx.conf"]:::infrastructure
    end

    %% CI/CD Integration
    CI_CD["CI/CD Integration"]:::ci

    %% Component Relationships
    API -->|"APICalls"| Backend
    Backend -->|"DataPersistence"| DB
    Backend -->|"FileManagement"| OSS
    Backend -->|"PushEvents"| SSE

    %% Deployment Links: Frontend deployment
    UI ---|"DeployedOn"| FrontContainer
    API ---|"DeployedOn"| FrontContainer
    Vuex ---|"DeployedOn"| FrontContainer
    SSE ---|"DeployedOn"| FrontContainer
    Router ---|"DeployedOn"| FrontContainer
    Assets ---|"DeployedOn"| FrontContainer
    Resources ---|"DeployedOn"| FrontContainer

    %% Deployment Links: Backend and Database deployment
    Backend ---|"DeployedOn"| BackContainer
    DB ---|"DeployedOn"| MongoContainer

    %% Deployment Configuration Flow
    CI_CD --> Dockerfile
    Dockerfile --> FrontContainer
    Dockerfile --> BackContainer
    Dockerfile --> MongoContainer

    NginxProxy --> FrontContainer
    NginxProxy --> BackContainer

    CI_CD --> DockerDir
    CI_CD --> NginxConf

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#00008B,stroke-width:2px;
    classDef api fill:#98FB98,stroke:#006400,stroke-width:2px;
    classDef state fill:#E0FFFF,stroke:#20B2AA,stroke-width:2px;
    classDef realTime fill:#FFFACD,stroke:#DAA520,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#006400,stroke-width:2px;
    classDef database fill:#FFDAB9,stroke:#FF8C00,stroke-width:2px;
    classDef container fill:#D3D3D3,stroke:#696969,stroke-width:2px;
    classDef infrastructure fill:#E6E6FA,stroke:#9370DB,stroke-width:2px;
    classDef ci fill:#FFB6C1,stroke:#FF69B4,stroke-width:2px;

    %% Click Events
    click UI "https://github.com/jamebal/jmal-cloud-view/tree/master/src/"
    click API "https://github.com/jamebal/jmal-cloud-view/tree/master/src/api"
    click Vuex "https://github.com/jamebal/jmal-cloud-view/tree/master/src/store"
    click SSE "https://github.com/jamebal/jmal-cloud-view/tree/master/src/sse"
    click Router "https://github.com/jamebal/jmal-cloud-view/tree/master/src/router"
    click OSS "https://github.com/jamebal/jmal-cloud-view/blob/master/src/api/oss.js"
    click Assets "https://github.com/jamebal/jmal-cloud-view/tree/master/src/assets"
    click Resources "https://github.com/jamebal/jmal-cloud-view/tree/master/public/resource"
    click Dockerfile "https://github.com/jamebal/jmal-cloud-view/tree/master/Dockerfile"
    click DockerDir "https://github.com/jamebal/jmal-cloud-view/tree/master/docker/"
    click NginxConf "https://github.com/jamebal/jmal-cloud-view/blob/master/nginx.conf"
    click CI_CD "https://github.com/jamebal/jmal-cloud-view/tree/master/.github/workflows"
```
