How usualheart/zhoubao works
Main Components
• Frontend Client: The Vue application (located in the “vue” directory) contains the user-facing components. It handles views like the login page, Markdown editor, table-based weekly reports, and image/PDF preview, with appropriate routing (vue/src/router) and components.
• Backend Server: The Spring Boot application (Java code under “src/main/java/zhoubao”) that implements controllers (e.g., HtmlRESTController, ImgRESTController, UserRESTController, ZhouBaoRESTController), security configurations (MyAuthenticationSuccessHandler, SecurityByJdbcConfig), and business logic.
• Database: MySQL is used to store user accounts, weekly report data, and configurations. The project provides a SQL file “zhoubao.sql” for database initialization.
• File and Object Storage: The “modules/oss” package includes different storage implementations (e.g., LocalStorageService, MinioStorageService, OSSFactory) that manage file uploads and persistent storage for weekly reports.
• Static Resources: The “src/main/resources/static” folder, along with the Vue/static folder, serves static assets including CSS, JavaScript (bundled Vue app), images, and markdown templates.
Relationships and Interactions
• The Backend communicates with the MySQL database using repository classes. Represent the data access layer explicitly.
• The Backend interacts with a file storage abstraction via the OSS module to handle file uploads and file persistence.
• Security flows exist (via Spring Security configured in MyAuthenticationSuccessHandler and SecurityByJdbcConfig) to handle login and session management.
Key Architectural Patterns and Design Principles
• Layered Architecture: Clearly separate presentation (Vue client), service/controller logic (Spring Boot REST controllers and business logic), data access (repository and domain layers), and configuration/security.
• MVC Pattern: The backend mostly follows a model–view–controller pattern where request-handling controllers coordinate with domain objects and repositories.
• Separation of Concerns: Notice the splitting between authentication/security, file storage (oss modules), and data repositories.
• RESTful API Design: The backend controllers are designed to expose REST endpoints for the Vue frontend.
• Configuration-Based Deployment: The application uses an external YAML configuration (application.yml) and Maven for dependency management and build lifecycle.
Relevant Technologies, Frameworks, and Libraries
• Spring Boot (for backend operations, dependency injection, and web functionality)
• Spring Security (for securing REST endpoints)
• Maven (for building and dependency management)
• MyBatis/JPA-style repositories (via the Repository classes for database interactions)
• Vue.js (for the client-side application)
• Webpack (as seen in the vue/build folder, used in the Vue project)
• MySQL (as the relational database, as indicated by the SQL file and configuration)
• File storage libraries or integrations (local file systems and possibly Minio)
Elements
• From “Vue Frontend” to “Spring Boot Controllers” for REST API calls.
• From “Spring Boot Controllers” to “Data Repositories” and “OSS Module”.
• From backend components to the “MySQL Database”.
• Security flows separately to show how authentication and authorization checks are handled before processing requests.