# baka-world/bbs-springboot architecture

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

- Interactive diagram: https://gitdiagram.com/baka-world/bbs-springboot
- Repository: https://github.com/baka-world/bbs-springboot

## Overview

a. Facade Layer (bbs-article-facade):
- This module defines the DTOs and service interfaces exposed to clients.
b. Business/Service Layer (bbs-article-service):
- Contains the Spring Boot application startup, controller classes (REST endpoints), configuration classes (for MyBatis, Redis, Dubbo, MongoDB, etc.), service implementations, scheduler tasks, interceptors, and mapstruct converters.
c. Persistence Layer (bbs-article-persistence):
- Responsible for database interactions using MyBatis via Mapper interfaces, Entities, and XML mapper configuration files.
- It as “Data Access Layer” or “Persistence Layer.”
d. Common Module (bbs-common):
- Contains shared configurations, constants, enums, and utilities.

##### External/infrastructure components
- External databases like MySQL and MongoDB (as specified in the README and configuration files).
- A Redis cache component.
- Registration and RPC framework with Dubbo and Zookeeper.
- Optionally, include RocketMQ for messaging if further details about its use are found in the configurations.
- Integration points for external object storage (七牛云) and WebSocket for real-time communication.

- From the service layer, indicate calls toward the “Persistence Layer” for CRUD operations.

##### Architectural design principles
- Modularization: separate modules for facade, service, and persistence encourage a clean separation of concerns.
- Use of industry best practices—such as dependency injection configuration in Spring Boot, declarative transaction management (likely within MyBatis configuration), and the use of interceptors for cross-cutting concerns (as seen in the interceptors directory).
- Use of mapstruct for DTO conversion, which helps decouple internal entities from externally exposed DTOs.
- The project employs a microservices/RPC approach (via Dubbo) even within its modular structure, so show how internal services may also expose or consume remote services.

## Diagram (Mermaid)

```mermaid
graph TD
    A["Frontend (Vue)"]:::externalService
    B["API/Facade Layer"]:::internalModule
    C["Business/Service Layer"]:::internalModule
    D["Persistence Layer"]:::internalModule
    E["Common Module"]:::internalModule
    F["MySQL"]:::externalService
    G["MongoDB"]:::externalService
    H["Redis"]:::externalService
    I["Zookeeper/Dubbo"]:::externalService
    J["RocketMQ"]:::externalService
    K["七牛云"]:::externalService
    L["WebSocket"]:::externalService

    %% Internal Layer Flow
    A -->|"HTTP_request"| B
    B -->|"DTO_request"| C
    C -->|"CRUD_operations"| D

    %% External Integrations from Business/Service Layer
    C -->|"Cache_calls"| H
    C -->|"Messaging_calls"| J
    C -->|"RPC_calls"| I
    C -->|"ObjectStorage_calls"| K
    C -->|"RealTime_comm"| L

    %% Data Access interactions
    D -->|"JDBC/ORM"| F
    D -->|"ODM_calls"| G

    %% Common module usage by internal layers
    E -->|"shared_utilities"| B
    E -->|"shared_utilities"| C
    E -->|"shared_utilities"| D

    %% Click Events for component mapping
    click B "https://github.com/baka-world/bbs-springboot/tree/open-one/bbs-article/bbs-article-facade"
    click C "https://github.com/baka-world/bbs-springboot/tree/open-one/bbs-article/bbs-article-service"
    click D "https://github.com/baka-world/bbs-springboot/tree/open-one/bbs-article/bbs-article-persistence"
    click E "https://github.com/baka-world/bbs-springboot/tree/open-one/bbs-common"

    %% Styles
    classDef internalModule fill:#aqua,stroke:#333,stroke-width:2px;
    classDef externalService fill:#ffcccc,stroke:#333,stroke-width:2px;
```
