# yin-hongwei/music-website architecture

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

- Interactive diagram: https://gitdiagram.com/yin-hongwei/music-website
- Repository: https://github.com/yin-hongwei/music-website

## Overview

The music-website project is a full-stack music application that consists of three distinct modules:
1. A music client (music-client) for the end-user interface built with Vue3, TypeScript, Vuex, and related frontend technologies.
2. A management platform (music-manage) also built using Vue3 for administrators to manage songs, users, and other content.
3. A backend server (music-server) implemented in Java using Spring Boot and MyBatis, with additional integrations like Redis for caching, MySQL for persistence, and Minio for object storage.

a. Main components:
- Client Application: The “music-client” directory represents the user-facing interface. It includes typical Vue components (views, layouts, assets, and API modules) used for music playback, comment handling, and searching.
- Management Application: The “music-manage” folder contains the administrator interface built with similar Vue technologies. It is focused on backend management tasks (e.g., managing users, songs, comments, etc.).
- Backend Server: The “music-server” directory constitutes the service layer built using Spring Boot. This module contains business logic implementations, REST API controllers, service interfaces, data mappers (MyBatis), and configurations. It also includes Docker-related files, indicating containerized deployment, and SQL scripts to set up the MySQL database.
- Database and Cache: A MySQL database (referenced in the SQL files and connection configs) stores the persistent data, whereas a Redis instance is used as a cache.
- Object Storage: Minio is set up to handle file storage (e.g., for music files and images) as backed by the Java configuration in the server.
- External Deployment Components: Docker configurations are provided to facilitate containerized deployment (as referenced by multiple dockerfiles and docker-compose.yml).

b. Relationships and interactions between these components:
- The client and management applications communicate with the backend via HTTP/REST APIs (using Axios in the frontend).
- The backend server handles requests from both the client and the management application.
- The server interacts with MySQL for CRUD operations, uses Redis for caching frequently accessed data, and integrates with Minio for storage operations.
- Deployment layers (using Docker) ensure that these components can run in isolated containers while interconnected through network mappings.

c. Architectural patterns/design principles:
- Separation of concerns: There is a clear division between the presentation layer (the two distinct Vue-based frontends) and the business/data layer (Spring Boot application).
- MVC pattern: Within the backend, controllers, services, and mappers indicate the usage of a layered (Model-View-Controller) approach.
- RESTful API design: The server exposes multiple controllers (e.g., SongController, UserSupportController, etc.) that serve different operational needs.
- Containerization: Usage of Docker for simplified deployment and environment consistency.

d. Technologies and frameworks to note:
- Frontend: Vue3, TypeScript, Vue-Router, Vuex, Axios, ElementPlus, Echarts.
- Backend: Spring Boot, MyBatis, Redis, Minio, Docker, Maven.
- Database: MySQL; Cache: Redis.
- Development tools: IntelliJ, VSCode, NodeJS CLI for dependency management.

2. For the frontend, delineate two sections:
- Music Client (end-user interface) with components like App.vue, views (Home, SignIn, SignUp, etc.), and API communication modules.
- Music Management (admin interface) with its layout components, views for user/song management, dialogs, etc.
4. The backend server should be represented with key sub-components:
- REST Controllers for various domains (songs, users, comments, banners, etc.)
- Services encapsulating business logic.
- Data access layer (Mappers, MyBatis integration) interfacing with MySQL.
- Configurations managing external systems like Redis caching and Minio integration.
5. Outside the server, add the database (MySQL), Redis cache, and Minio (for file storage) as backend service components.
6. Docker as a container orchestration layer which encapsulates the server and possibly even the client applications.

- Clear labels: Ensure each component (e.g., “Music Client”, “Management Console”, “Backend Server”, “MySQL”, “Redis”, “Minio”, “Docker”) has an unambiguous label.
- Annotations: Brief notes on what each component is responsible for (for example, “Vue3 SPA using Axios for REST calls” for the client).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Components
    subgraph "Frontend Components"
        MC["Music Client\n(Vue3 SPA)"]:::frontend
        MM["Music Management\n(Admin Interface)"]:::frontend
    end

    %% Backend Server Components
    subgraph "Backend Server"
        BS["Backend Server Core"]:::backend
        RC["REST Controllers\n(Spring Boot Controllers)"]:::backend
        SL["Service Layer\n(Business Logic)"]:::backend
        DA["Data Access Layer\n(MyBatis Mappers)"]:::backend
        CF["Configurations\n(Redis & Minio Setup)"]:::backend
    end

    %% External Data Stores
    MySQL["MySQL Database"]:::database
    Redis["Redis Cache"]:::external
    Minio["Minio Storage"]:::external

    %% Docker Configurations
    subgraph "Docker Configurations"
        DDC["Backend Docker Compose"]:::docker
        DDF["Backend Dockerfile"]:::docker
        VCDC["Vue Client Dockerfile"]:::docker
        VMDDF["Vue Manage Dockerfile"]:::docker
    end

    %% Connections from Frontend to Backend
    MC -->|"HTTP_API"| RC
    MM -->|"HTTP_API"| RC

    %% Backend internal components flow
    BS --> RC
    RC -->|"delegates"| SL
    SL -->|"invokes"| DA
    SL -->|"uses"| CF
    DA -->|"CRUD"| MySQL
    CF -->|"manages"| Redis
    CF -->|"manages"| Minio

    %% Docker Deployment connects to Frontend and Backend
    DDC ---|"deploys"| BS
    VCDC ---|"deploys"| MC
    VMDDF ---|"deploys"| MM

    %% Click Events for Frontend
    click MC "https://github.com/yin-hongwei/music-website/tree/master/music-client/"
    click MM "https://github.com/yin-hongwei/music-website/tree/master/music-manage/"

    %% Click Event for Backend Core
    click BS "https://github.com/yin-hongwei/music-website/tree/master/music-server/"

    %% Click Event for REST Controllers
    click RC "https://github.com/yin-hongwei/music-website/tree/master/music-server/src/main/java/com/example/yin/controller/"

    %% Click Event for Service Layer
    click SL "https://github.com/yin-hongwei/music-website/tree/master/music-server/src/main/java/com/example/yin/service/"

    %% Click Event for Data Access Layer
    click DA "https://github.com/yin-hongwei/music-website/tree/master/music-server/src/main/java/com/example/yin/mapper/"

    %% Click Event for Configurations
    click CF "https://github.com/yin-hongwei/music-website/tree/master/music-server/src/main/java/com/example/yin/config/"

    %% Click Event for MySQL Scripts
    click MySQL "https://github.com/yin-hongwei/music-website/blob/master/music-server/sql/tp_music.sql"

    %% Click Events for Docker Configurations
    click DDC "https://github.com/yin-hongwei/music-website/blob/master/music-server/docker-server/docker-compose.yml"
    click DDF "https://github.com/yin-hongwei/music-website/tree/master/music-server/docker-server/dockerfile"
    click VCDC "https://github.com/yin-hongwei/music-website/tree/master/music-server/docker-vue-client/dockerfile"
    click VMDDF "https://github.com/yin-hongwei/music-website/tree/master/music-server/docker-vue-manage/dockerfile"

    %% Styles
    classDef frontend fill:#e0f7fa,stroke:#006064,stroke-width:2px
    classDef backend fill:#e8f5e9,stroke:#1b5e20,stroke-width:2px
    classDef database fill:#fff9c4,stroke:#f57f17,stroke-width:2px
    classDef external fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px
    classDef docker fill:#fce4ec,stroke:#880e4f,stroke-width:2px
```
