# maliangnansheng/bbs-springboot architecture

> Architecture diagram of the GitHub repository maliangnansheng/bbs-springboot, 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/maliangnansheng/bbs-springboot
- Repository: https://github.com/maliangnansheng/bbs-springboot

## Overview

##### Main Components
- bbs-rest: The entry point serving RESTful APIs. This module holds the controllers, configuration (e.g., exception interceptors, swagger, login filters), and provides the interface for the front‑end to communicate with the back‑end.
- bbs-article: The article management module. It is split into sub‑modules:
– bbs-article-facade: Contains DTOs (data transfer objects) and service interfaces meant for exposing article functions.
– bbs-article-persistence: Implements the data access layer using MyBatis, with mapper XML files and entity objects.
– bbs-article-service: Implements the business logic. It also holds configuration classes (like Dubbo, Redis, Mybatis, etc.) and uses MapStruct for data mapping.
- bbs-user: The user management module with a similar three‑layer split:
– bbs-user-facade: Exposes user-related APIs via DTOs and service interfaces.
– bbs-user-persistence: Contains the ORM entities/mappers and database access logic.
– bbs-user-service: Implements business logic and configurations, including scheduling (for asynchronous tasks) and integration of RPC (Dubbo) services.
- bbs-common: This module provides common utilities, configuration, constants, and enumeration definitions used across other modules.
- db: Contains sample database scripts and example JSON files or MongoDB collection setup scripts reflecting the underlying database layer.

##### Representing the Layered Architecture
- Facade (API contract layer with DTOs used by RPC or REST endpoints),
- Service (contains business logic, configurations like Dubbo, Mongo, Redis, etc.),
- Persistence (data access, MyBatis mappers, entity classes, and MyBatis XML mappings).

##### Infrastructure and External Services
- External components such as:
- Databases: MySQL for structured data (and possibly MongoDB for storing large data and document storage).
- Caching: Redis and Redisson used on the service layers.
- Messaging/Queue: RocketMQ for asynchronous messaging tasks.
- RPC infrastructure: Dubbo framework and Zookeeper (for service registry/configuration) as part of the microservices integration.
- Object storage: A block representing third‑party cloud storage (like Qiniu Cloud as mentioned).

##### Interactions Between Components
- API requests coming into bbs-rest, which then invoke methods from bbs-article and bbs-user’s façade layers.
- The service layer in each module communicating with the persistence layer to perform CRUD operations.
- The persistence layer interacting with the underlying databases.
- Integration points where bbs-common is shared across modules.
- Communication between different modules using RPC (Dubbo) configurations, if applicable.
- Any asynchronous communication that might occur through RocketMQ.

##### Architectural Patterns and Design Principles
- The separation of concerns is evident in the layered architecture (facade, service, persistence).
- Microservices/integration patterns via Dubbo (with Zookeeper for registration) should be highlighted.
- RESTful design in bbs-rest and the decoupling between client (Vue front‑ends) and server (SpringBoot).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Components
    FE1("Vue2 Frontend"):::frontend
    FE2("Vue3 Frontend"):::frontend

    %% API Layer
    REST("REST API (bbs-rest)"):::internal

    %% Article Management Module
    subgraph "Article Management Module"
        A_Facade("Article Facade"):::internal
        A_Service("Article Service"):::internal
        A_Persistence("Article Persistence"):::internal
    end

    %% User Management Module
    subgraph "User Management Module"
        U_Facade("User Facade"):::internal
        U_Service("User Service"):::internal
        U_Persistence("User Persistence"):::internal
    end

    %% Shared Module
    COMMON("Common Utilities"):::internal

    %% External Infrastructure
    DB1("Database: MySQL"):::external
    DB2("Database: MongoDB"):::external
    CACHE("Cache: Redis"):::external
    MQ("Messaging: RocketMQ"):::external
    RPC("RPC: Dubbo"):::external
    ZK("Service Registry: Zookeeper"):::external
    CLOUD("Cloud Storage: Qiniu"):::external
    DBSCRIPTS("Database Scripts"):::external

    %% Frontend to API
    FE1 -->|"calls"| REST
    FE2 -->|"calls"| REST

    %% API routing to modules
    REST -->|"routes-to"| A_Facade
    REST -->|"routes-to"| U_Facade
    REST -->|"uses"| COMMON

    %% Article Module Flow
    A_Facade -->|"invokes"| A_Service
    A_Service -->|"logic"| A_Persistence
    A_Persistence -->|"CRUD"| DB1
    A_Persistence -->|"CRUD"| DB2
    A_Service -->|"cache"| CACHE
    A_Service -->|"async"| MQ
    A_Service -->|"RPC-call"| RPC

    %% User Module Flow
    U_Facade -->|"invokes"| U_Service
    U_Service -->|"logic"| U_Persistence
    U_Persistence -->|"CRUD"| DB1
    U_Persistence -->|"CRUD"| DB2
    U_Service -->|"cache"| CACHE
    U_Service -->|"async"| MQ
    U_Service -->|"RPC-call"| RPC

    %% Common Utilities used by service layers
    COMMON -->|"shared-config"| A_Service
    COMMON -->|"shared-config"| U_Service

    %% RPC Infrastructure
    RPC -->|"registers"| ZK

    %% External Cloud Storage for file uploads
    A_Service -->|"storage"| CLOUD
    U_Service -->|"storage"| CLOUD

    %% Database Scripts feeding into DB layer
    DBSCRIPTS -->|"initializes"| DB1

    %% Click Events for Internal Components
    click REST "https://github.com/maliangnansheng/bbs-springboot/tree/master/bbs-rest"
    click A_Facade "https://github.com/maliangnansheng/bbs-springboot/tree/master/bbs-article/bbs-article-facade"
    click A_Service "https://github.com/maliangnansheng/bbs-springboot/tree/master/bbs-article/bbs-article-service"
    click A_Persistence "https://github.com/maliangnansheng/bbs-springboot/tree/master/bbs-article/bbs-article-persistence"
    click U_Facade "https://github.com/maliangnansheng/bbs-springboot/tree/master/bbs-user/bbs-user-facade"
    click U_Service "https://github.com/maliangnansheng/bbs-springboot/tree/master/bbs-user/bbs-user-service"
    click U_Persistence "https://github.com/maliangnansheng/bbs-springboot/tree/master/bbs-user/bbs-user-persistence"
    click COMMON "https://github.com/maliangnansheng/bbs-springboot/tree/master/bbs-common"
    click DBSCRIPTS "https://github.com/maliangnansheng/bbs-springboot/tree/master/db"

    %% Styles
    classDef internal fill:#D0E1F9,stroke:#333,stroke-width:2px;
    classDef frontend fill:#C1F0C1,stroke:#393,stroke-width:2px;
    classDef external fill:#F9D0D0,stroke:#d33,stroke-width:2px,stroke-dasharray: 5,5;
```
