How eddyy1410/gundam-sale-app works
Project type and purpose
• This is a Spring Boot monolithic backend API for a mobile “Gundam Shop” e-commerce app.
• It exposes RESTful endpoints for user authentication, product catalog, shopping cart, orders, notifications, store location and real-time chat.
• It follows a Layered Architecture (Presentation, Business, Data Access, Domain, plus cross-cutting concerns like security and configuration).
File structure
• Top-level build files (pom.xml, mvnw) and a README.md.
• src/main/java/com/huyntd/superapp/gundam_shop/ contains:
• configuration/ – Spring, security, OpenAPI, Google token verifier
• controller/ – REST controllers by resource (Authentication, User, Category, Product)
• dto/ – request/response objects for each endpoint
• exception/ – AppException, ErrorCode, GlobalExceptionHandler
• mapper/ – MapStruct-style mappers between DTOs and Entities
• model/ – JPA Entities (User, Product, Category, Order, CartItem, Conversation, Message, Notification, etc.) and enums
• repository/ – Spring Data JPA repositories per aggregate
• service/ – Business logic interfaces and implementations (AuthenticationService, UserService, CategoryService, ProductService)
• src/main/resources/application.properties for DB connection
• src/test for unit/integration tests
• uploads/ directory for file storage (product images, etc.)
README for further insights
• Confirms use of Spring MVC, Spring Data JPA, Spring Security (JWT), Swagger/OpenAPI
• Database: MySQL or SQL Server, auto-generated tables via Hibernate
• Features: registration/login, product listing, details, cart, billing, notifications, map, chat
a. Main components
• Client: Mobile App (iOS/Android)
• API Server (monolith) subdivided into:
• Presentation Layer: Controllers + Swagger UI
• Business Layer: Service interfaces & implementations
• Data Access Layer: Repositories
• Domain Layer: JPA Entities (models)
• DTO/Mapper Layer: DTOs and mappers
• Configuration & Security: JWT filter, OAuth2 token verifier, CORS, etc.
• Exception Handling: GlobalExceptionHandler
• Database: MySQL (tables for Users, Products, Orders, CartItems, Conversations, Messages, Notifications…)
• External Services:
• OAuth2 Provider (Google)
• Payment Gateways (VNPay, ZaloPay, PayPal)
• /Geo API for store locations
• Real-time Chat Engine (WebSocket server or Firebase)
• File Storage (uploads folder or cloud storage)
b. Relationships and data flow
• Client → HTTP(S) → Controller
• Controller → Service → Repository → Database
• Service uses Mapper to convert between DTOs and Entities
• SecurityConfig applies JWT filter before controllers
• Swagger UI sits alongside controllers under /swagger-ui.html
• For chat, Client ↔ WebSocket/Firebase (bypass standard REST flow)
• Payment flows: Client → API → External Payment Gateway → API → Database
c. Architectural patterns & design principles
• Layered Architecture for separation of concerns
• Dependency Injection for loose coupling
• DTO pattern for API contracts
• Centralized exception handling (@ControllerAdvice)
• Security as a cross-cutting concern (JWT, OAuth2)
• Use of standard Spring Boot auto-configuration
d. Key technologies/frameworks
• Spring Boot, Spring MVC (REST controllers)
• Spring Security (JWT), Google OAuth2
• Spring Data JPA, Hibernate, MySQL
• Swagger/OpenAPI 3
• Maven build
• Java 17+