How namnguyen1409/sp25-hsf302-group3-se1889vj works
Project type and purpose
• This is a full-stack Java Spring Boot web application with two user interfaces (admin and customer) built with Thymeleaf, backed by Microsoft SQL Server.
• Features include authentication/authorization (JWT + Spring Security), file upload/storage, scheduled tasks, real-time notifications (WebSocket), payment integration (VNPay), and reCAPTCHA.
File structure
• Top-level artifacts:
• pom.xml, Maven wrapper (.mvn): build and dependency management.
• src/main/java: Spring Boot application code organized by layers and packages (controller, service, repository, entity, dto, mapper, config, security, etc.)
• src/main/resources: application.yml, static assets (CSS/JS/images), Thymeleaf templates (admin, customer, auth, common, fragments).
• uploads/, temps/: file storage roots.
• src/test: unit/integration tests.
• Patterns/architectural choices:
• Layered architecture (Controller → Service → Repository → Database)
• DTO/Mapper layer to decouple API models from entities
• Specification package for dynamic query filtering
• Spring Security filter chain with JWTAuthenticationFilter + custom entry point + user-details service
• WebSocketConfig + WebSocketController for push notifications
• Scheduler for housekeeping (AutoDeleteTempFile)
• External integrations: Google reCAPTCHA, VNPay API.
Extract insights from README
• Relies on SQL Server for persistence
• application.yml holds configuration for datasource, reCAPTCHA, VNPay, owner seed data
• DataInitializer seeds default owner account + initial lookup data
• Needs uploads/ and temps/ directories on disk for file I/O
• Entry point: Sp25Hsf302Group3Se1889vjApplication
a. Main components
• User Browsers – Admin UI and Customer UI (Thymeleaf + static CSS/JS)
• Spring Boot Application
– Web Layer: MVC Controllers (admin, common, customer)
– Service Layer: Business services and implementations
– Data Access Layer: Spring Data JPA Repositories + Specification classes
– Mapping Layer: DTOs + Mappers (MapStruct or manual)
– Security Layer: JWT filters, CustomUserDetailsService, WebSecurityConfig
– WebSocket Module: WebSocketConfig + NotificationController
– Scheduler Module: AutoDeleteTempFile
– File Storage Module: StorageService + filesystem storage
– Configuration Components: AuditorAware, ModelMapper, ThymeleafConfig, VNPayConfig, etc.
• Database: SQL Server (hsf302) with tables for User, Product, Order, etc.
• External Services:
– Google reCAPTCHA API
– VNPay Payment Gateway
b. Relationships & interactions
• Browser → HTTP(S) → Spring MVC Controllers
• Controllers ↔ Services ↔ Repositories ↔ Database
• Controllers ↔ Mappers ↔ DTOs for request/response
• Security filters intercept HTTP requests → validate JWT → load user details
• FileController handles multipart uploads → StorageService writes to uploads/
• Scheduler deletes old files from temps/ on a schedule
• WebSocketController pushes notifications to connected browsers over ws://
• On checkout, Service calls VNPayService → HTTP to VNPay API → callback to VNPayController
• RecaptchaService requests Google recaptcha endpoint
c. Architectural patterns / design principles
• Layered (Onion/Clean) architecture
• Dependency injection for all components (Spring @Component/@Service)
• Single Responsibility: Controllers for HTTP, Services for business rules, Repos for data access
• DTO/Mapper separation to prevent entity leakage
• Specification pattern for dynamic filtering of queries
• Event scheduling for background tasks
• Token-based / stateless authentication
d. Key technologies & frameworks
• Java 21, Spring Boot, Spring MVC, Spring Data JPA
• Thymeleaf templating engine
• Microsoft SQL Server
• Spring Security + JWT
• WebSocket (Spring)
• Maven build system
• External APIs: reCAPTCHA, VNPay