How tuan2305/ecommerce-store-spring works
Main Components
• Application Layer – The entry point (EcommerceStoreApplication.java) which bootstraps the Spring Boot application.
• Controller Layer – Several controllers (e.g., AdminController, AuthController, CartController, PaymentController, SellerController, etc.) handle HTTP endpoints. The README highlights seller-related endpoints (login, OTP-based verification, seller management), so include a dedicated section for Seller operations.
• Service Layer – Implements business logic. There are service interfaces (e.g., AuthService, ProductService) and their corresponding implementations in the “impl” package.
• Data Access Layer – Repositories (AddressRepository, OrderRepository, ProductRepository, etc.) for interaction with the underlying database.
• Domain/Model – Classes representing the core data structures (e.g., Order, Product, Seller, Cart, etc.) along with enumerations for statuses and roles.
• Configuration – The config package hosts configurations such as AppConfig, JWT_CONSTANT, JwtProvider, and token validators for handling JWT security.
• Utility Modules – Helper classes like OtpUtil which support functions like generating OTP.
• Exception Handling – Dedicated exception classes and a global exception mechanism that manage runtime errors and validate inputs.
Relationships and Data Flow
• How HTTP requests flow from the client to the REST controllers.
• From Controllers, illustrate that calls are forwarded to the Service layer where the business logic is processed.
• The Service layer then interacts with the Repositories for CRUD operations and fetching/persisting data.
• Integration points for security (JWT configuration and OTP validation) which are processed either directly in controllers or through dedicated service methods.
Architectural Patterns
• MVC (Model-View-Controller) or RESTful Architecture: Controllers are clearly segmented from business logic (services) and persistence (repositories).
• Dependency Inversion and Inversion of Control: The usage of service interfaces and repository interfaces along with Spring Boot’s auto-wiring.
• Security Pattern: Use of JWT for authentication and OTP for seller validation – indicating tight integration of security concerns in the configuration and controller layers.
Technology, Frameworks, and Libraries
• Java with Spring Boot framework as the backbone for the application.
• Maven as the build and dependency management system.
• JWT for authentication and OTP for seller verification.
• Likely a relational database accessed via Spring Data JPA repositories.
• Any external email services for OTP dispatch (referenced in the EmailService).