How baka-world/chengdafourmbackend works
Project type and purpose
• This is a monolithic backend application written in Java with Spring Boot 3.4.6.
• It implements a forum system: user management, article publishing, comments, topics, and an admin dashboard.
File structure
• src/main/java/org/dacheng/forum – root package
• config/ – application-wide configuration (CORS, JSON, OpenAPI, security)
• controller/ – REST controllers for public API and admin endpoints
• entity/ – JPA entities and VO (view objects) under vo/
• exception/ – custom exceptions and global handler
• repository/ – Spring Data JPA repositories
• service/ + impl/ – service interfaces and implementations
• utils/ – misc. helper classes (encryption, avatar, data fix)
• resources/ – application.yml, SQL scripts
• test/ – unit & integration tests for controllers, services, utils
README for architecture insights
• Layered architecture following MVC + service + repository pattern
• Uses MySQL 8.0 (+ JPA), Redis (cache), Sa-Token (auth), FastJSON2, SpringDoc (Swagger)
• Dockerfile + optional docker-compose for containerized deployment
Main components & their relationships
a. Public API Layer
• Controllers (ArticleController, CommentController, UserController, TopicController, CommunityController)
• Admin Controllers (AdminArticleController, AdminCommentController, AdminDashboardController, AdminTopicController, AdminUserController)
b. Business Logic Layer
• Services (ArticleService, CommentService, UserService, TopicService, CommunityService) and their Impl classes
c. Data Access Layer
• Repositories (ArticleRepository, CommentRepository, UserRepository, TopicRepository, LikeRecordRepository, ViewRecordRepository)
• JPA Entities (Article, Comment, User, Topic, LikeRecord, ViewRecord)
d. Cross‐cutting Modules
• Configurations (CorsFilter, WebConfig, JacksonConfig, OpenApiConfig, StpInterfaceImpl for Sa-Token, GlobalExceptionHandler)
• Utils (Encrypt, GravatarUtil, DataHandle, DatabaseFixUtil, MessageHandle)
e. Persistence & Cache
• MySQL database for core data
• Redis for caching (optional/per configuration)
f. External Interfaces
• Swagger UI / OpenAPI docs
• Local file storage for avatars + Gravatar integration
• Docker (container deployment)
Architectural patterns & principles
• Layered architecture (Controller → Service → Repository)
• RESTful API design
• Exception handling via GlobalExceptionHandler
• Dependency injection for config, services, repos
• Use of DTO/VO for request/response separation from entities