How 201206030/novel-cloud works
Project type and purpose
• This is a full‐stack, microservice‐based novel portal platform (“novel-cloud”) built on Spring Cloud (Alibaba), Spring Boot 3, Vue 3. It provides novel home page, news, book management, user/member center, author center, resource upload, search capabilities, and monitoring.
Main components
• API Gateway (novel-gateway)
• Config & Discovery (Nacos, Spring Cloud Config)
• Business microservices:
• novel-home – homepage recommendations, friend links
• novel-news – news publishing
• novel-book – book/catalog/chapter/comment services
• novel-user – user registration, login, profile, bookshelf, reading history
• novel-author – author registration, income, author dashboard
• novel-resource – file uploads (images, captchas)
• novel-search – scheduled indexing to Elasticsearch, search API
• Infrastructure services:
• novel-monitor – Spring Boot Admin based health/metrics dashboard
• RabbitMQ – async messaging (e.g., events, notifications)
• MySQL (with ShardingSphere‐JDBC) – persistent storage
• Redis/Caffeine – cache layers
• Elasticsearch – full‐text search engine
• XXL-JOB – scheduled tasks for reindexing
• Shared libraries (novel-core): common DTOs, auth utilities, constants, config wrappers
Interactions & data flows
a. All external requests enter through novel-gateway (Spring Cloud Gateway).
b. novel-gateway uses service discovery (Nacos) to route to individual services.
c. Each service loads shared config from Nacos/Spring Config.
d. Services call one another via Feign clients (e.g., home calls book/user APIs; author calls book API; user and book emit/read messages via RabbitMQ).
e. Business services persist to MySQL (with sharding if configured) and cache frequent lookups in Redis/Caffeine.
f. novel-search polls or listens to change events (via RabbitMQ or XXL-JOB) to index data into Elasticsearch.
g. novel-monitor periodically polls all services’ /actuator endpoints for health and metrics.
h. novel-resource handles file uploads, stores metadata in Redis (e.g., captcha codes), and relays files to blob store or CDN.
Architectural patterns & principles
• Microservices with single‐responsibility service per domain
• API Gateway for unified entrypoint, authentication, CORS, rate‐limiting
• Service Discovery + Config Center (Nacos) for dynamic topology and centralized configuration
• Shared “core” libraries for consistency (auth, DTOs, constants)
• Declarative REST via Feign for inter-service calls
• Asynchronous messaging (RabbitMQ) for loose coupling and event propagation
• Cache Aside pattern: Redis/Caffeine for read‐heavy endpoints
• Scheduled tasks (XXL-JOB) for bulk operations (e.g., rebuild search index)
• Monitoring & alerting via Spring Boot Admin
Main business services & their communication
• home → book, home → news, home → user
• book → user, book → author
• author → book
• Search consuming book/user/author updates via MQ or scheduler.
• At bottom, show MySQL cluster, Redis/Caffeine cache, Elasticsearch, RabbitMQ, XXL-JOB, Nacos/Config.
• At top or side, show novel-monitor polling each service.