How haiday03/hauisocialmedia_server works
Main Components
• Backend Server: The core application located in src/main/java/com/group4/HaUISocialMedia_server. This includes the main Application class (HaUiSocialMediaServerApplication.java).
• Controllers (REST Endpoints): Under the /rest package, these handle the HTTP requests for authentication, posts, notifications, and more.
• Services & Implementations: The business logic is abstracted in the /service and /service/impl packages (including AuthService, PostService, etc.).
• Repositories: Data access handled via Spring Data JPA style interfaces in the /repository package for each domain entity.
• Domain Models: Entities (in the /entity package) represent objects such as User, Group, Post, etc.
• Configuration: Includes setup for security (JWT authentication with JwtAuthenticationEntryPoint, JwtAuthenticationFilter, JwtTokenProvider, WebSecurityConfig) and real-time messaging (WebSocketConfig).
• Data Transfer Objects (DTOs): Located in the /dto package, these are used to transfer data between layers.
• Testing: Tests exist in the /src/test directory.
• Infrastructure & Build: Maven configuration (pom.xml, mvnw scripts) and configuration files (application.properties).
Relationships & Interactions
• The Controllers receive HTTP requests, passing data through DTOs.
• Each Controller then calls the relevant Service layer which encapsulates the business logic.
• Services interact with Repositories to persist or fetch data from the database.
• Configuration components (e.g., WebSecurityConfig) integrate with Controller endpoints to enforce security (JWT-based authentication).
• WebSocket components in the configuration and related endpoints support real-time interactions (for chat or notifications).
• Entities and DTOs illustrate the domain model and data transfer across the system.
Architectural Patterns & Design Principles
• Layered Architecture: Clearly defined separation in controllers, services, and repositories.
• RESTful API Design: The /rest package is organized to provide API endpoints for different functionalities.
• Security: Use of JWT (Json Web Tokens) with corresponding filters and handlers to secure endpoints.
• Real-Time Communication: Use of WebSocket configuration enabling live updates/notifications.
• Domain-Driven Design: Domain models (Entities) and DTOs capture business data and constraints.
Relevant Technologies and Frameworks
• Spring Boot (implied by the typical structure and Application class).
• Spring Security (JWT, authentication filters, access management).
• Spring Data JPA (Repositories and Entities for interacting with the database).
• Maven (for build and dependency management).
• Possibly WebSocket (real-time messaging support).