# 201206030/novel architecture

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

- Interactive diagram: https://gitdiagram.com/201206030/novel
- Repository: https://github.com/201206030/novel

## Overview

##### Project type and purpose
- This is a full-stack, front-back separated **monolithic** Java system (“novel”) for a learning-oriented novel portal.
- It provides three logical “sub-systems”:
- Novel Portal (front-end for readers)
- Author Backend (management for writers)
- Platform/Admin Backend (management for admins)
- It uses Spring Boot 3 + MyBatis-Plus + Spring AI on the back end, Vue 3 + Element-Plus on the front end, and integrates MySQL (with ShardingSphere), Redis/Caffeine caching, RabbitMQ messaging, Elasticsearch search, XXL-JOB scheduling, JWT auth, AOP, interceptors/filters, plus monitoring and CI/CD tools.

##### File structure
- **src/main/java/io/github/xxyopen/novel**
- controller (HTTP API endpoints, separated into front, author, admin… )
- service (business logic interfaces) & service/impl
- manager (cross-DAO orchestration, third-party wrappers, caching, messaging)
- dao (MyBatis mappers + entity classes)
- dto (request/response objects)
- core (cross-cutting → annotation, aspect, auth, config, filter, interceptor, json, task, wrapper, common)
- **src/main/resources**
- application.yml (feature toggles for ES, RabbitMQ, XXL-JOB, ShardingSphere)
- mapper XMLs for MyBatis
- shardingsphere-jdbc.yml, logback, swagger metadata
- config classes wire up: Spring Boot, security (JWT), CORS, AOP, caching, Redis, RabbitMQ, ES, ShardingSphere, OpenAPI, XXL-JOB.

##### README
- Confirms tech stack and feature list: novel recommendation, search, ranking, reading, commenting, subscription/payments, news, user/author/admin centers.
- Mentions optional components (Elasticsearch, RabbitMQ, XXL-JOB) toggled via config.
- Sketches high-level package structure.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    subgraph "Clients"
        BROWSER["Web Browser (Vue 3 Portal)"]:::presentation
        AUTHOR_UI["Author Admin UI"]:::presentation
        ADMIN_UI["Platform Admin UI"]:::presentation
    end

    %% Monolith
    subgraph "Novel Monolith"
        %% Presentation Layer
        subgraph "Presentation Layer"
            FRONT["Novel Portal API Layer"]:::presentation
            AUTHR["Author Backend API Layer"]:::presentation
            ADMIN["Platform/Admin Backend API Layer"]:::presentation
        end

        %% Application Layer
        subgraph "Application Layer"
            SERVI["Service Interfaces"]:::application
            SERVI_IMPL["Service Implementations"]:::application
            subgraph "Manager Layer"
                MAN_CACHE["Cache Managers"]:::application
                MAN_DAO["DAO Managers"]:::application
                MAN_MSG["Message Managers"]:::application
                MAN_MQ["MQ Managers"]:::application
                MAN_REDIS["Redis Managers"]:::application
            end
        end

        %% Persistence Layer
        subgraph "Persistence Layer"
            ENT["Entity Classes"]:::infra
            MAPI["Mapper Interfaces"]:::infra
            XML["MyBatis XMLs"]:::infra
        end

        %% Cross-Cutting/Core
        subgraph "Core / Cross-Cutting"
            ASPECT["Annotations & AOP"]:::application
            AUTH_CORE["Authentication Strategies"]:::application
            FILTER["Filters"]:::application
            INTER["Interceptors"]:::application
            JSON["JSON (de)serializers"]:::application
            WRAP["Wrappers"]:::application
            COMMON["Exception Handling & Utils"]:::application
            CONFIGS["Config Classes"]:::application
            LISTENER["RabbitMQ Listener"]:::application
            TASK["Scheduled Tasks"]:::application
        end
    end

    %% External Infrastructure
    subgraph "Infrastructure Services"
        MYSQL["MySQL (ShardingSphere)"]:::external
        REDIS["Redis / Caffeine"]:::external
        RABBITMQ["RabbitMQ"]:::external
        ES["Elasticsearch"]:::external
        XXL_JOB["XXL-JOB Scheduler"]:::external
    end

    %% Data Flows
    BROWSER -->|"HTTP/JSON"| FRONT
    AUTHOR_UI -->|"HTTP/JSON"| AUTHR
    ADMIN_UI -->|"HTTP/JSON"| ADMIN

    FRONT -->|"calls"| SERVI
    AUTHR -->|"calls"| SERVI
    ADMIN -->|"calls"| SERVI

    SERVI -->|"implemented by"| SERVI_IMPL
    SERVI_IMPL -->|"orchestrates"| MAN_CACHE
    SERVI_IMPL -->|"orchestrates"| MAN_DAO
    SERVI_IMPL -->|"orchestrates"| MAN_MSG
    SERVI_IMPL -->|"orchestrates"| MAN_MQ
    SERVI_IMPL -->|"orchestrates"| MAN_REDIS

    MAN_DAO -->|"reads/writes (SQL)"| MYSQL
    MAN_CACHE -->|"cache ops"| REDIS
    MAN_REDIS -->|"cache ops"| REDIS
    MAN_MSG -->|"publishes (AMQP)"| RABBITMQ
    MAN_MQ -->|"publishes (AMQP)"| RABBITMQ

    RABBITMQ -->|"deliver events"| LISTENER
    LISTENER -->|"triggers"| MAN_MSG

    SERVI_IMPL -->|"search/index"| ES
    TASK -->|"indexing jobs"| ES
    XXL_JOB -->|"schedules"| TASK

    %% Cross-cutting applied
    FILTER --> FRONT
    INTER --> FRONT
    AUTH_CORE --> FRONT
    ASPECT --> SERVI_IMPL

    %% Persistence internals
    MAPI --> ENT
    XML --> MAPI

    %% Click Events
    click FRONT "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/controller/front"
    click AUTHR "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/controller/author"
    click ADMIN "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/controller/admin"
    click SERVI "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/service"
    click SERVI_IMPL "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/service/impl"
    click MAN_CACHE "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/manager/cache"
    click MAN_DAO "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/manager/dao"
    click MAN_MSG "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/manager/message"
    click MAN_MQ "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/manager/mq"
    click MAN_REDIS "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/manager/redis"
    click ENT "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/dao/entity"
    click MAPI "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/dao/mapper"
    click XML "https://github.com/201206030/novel/tree/master/src/main/resources/mapper"
    click FILTER "https://github.com/201206030/novel/blob/master/src/main/java/io/github/xxyopen/novel/core/filter/XssFilter.java"
    click LISTENER "https://github.com/201206030/novel/blob/master/src/main/java/io/github/xxyopen/novel/core/listener/RabbitQueueListener.java"
    click TASK "https://github.com/201206030/novel/blob/master/src/main/java/io/github/xxyopen/novel/core/task/BookToEsTask.java"
    click CONFIGS "https://github.com/201206030/novel/tree/master/src/main/java/io/github/xxyopen/novel/core/config"

    %% Styles
    classDef presentation fill:#CCE5FF,stroke:#333,stroke-width:1px
    classDef application fill:#CCFFCC,stroke:#333,stroke-width:1px
    classDef infra fill:#FFDDCC,stroke:#333,stroke-width:1px
    classDef external fill:#F0F0F0,stroke:#333,stroke-width:1px
```
