How markuskeiththomas/solartp works
Overall Project Purpose & Type
• The project is a full-stack eCommerce application (likely with a solar energy theme based on the project name “solartp” and page names such as “den-nang-luong-mat-troi” and “he-thong-dien-mat-troi”).
• It is divided into two main parts: a Java-based backend (using Maven, Spring Boot architecture patterns) and a React-based frontend (with TypeScript and React components).
Main Components
• Frontend (React):
• Displays the user interface with pages for products, cart checkout, user account management, etc.
• Contains components like ProductCard, CartItem, and various pages (Home, Product Detail, Login, SignUp, etc.).
• Defines API interactions with the backend (see the api folder with authApi.tsx, productApi.ts).
• Backend (Java – Spring Boot):
• The main application entry point is in EcommerceApplication.java.
• Organized into clearly defined layers:
○ Controllers (API endpoints managing Articles, Auth, Categories, Products, Files, etc.)
○ Services (handling the business logic: ArticleService, AuthService, CartService, CloudflareR2Service, etc.)
○ Repositories (data access layer interacting with the database through entities such as UserEntity, ProductEntity, etc.)
○ Entities / DTOs (models for carrying data back and forth)
○ Exception handling, configuration (e.g., CorsConfig, RedisConfig, SecurityConfig), and filters (e.g., JwtAuthenticationFilter).
• Database & Persistence:
• Migration scripts in src/main/resources/db/migration (e.g., V1__init_schema.sql) indicate a relational database is in use.
• The repository layer connects entities to the persistence store.
• Supporting Services:
• Redis configuration implies caching mechanisms.
• CloudflareR2 integration for file uploads or image storage.
• External email service integration for user notifications.
• A set of utility classes indicate shared logic (e.g., JWT handling, date formatting).
Relationships and Interactions
• The React frontend communicates with the Java backend via RESTful API calls.
• The backend controllers receive incoming requests, then delegate business logic to service layers.
• The services interact with repositories to perform CRUD operations on the database.
• Additional configurations (security, CORS) and filters (JWT authentication) secure and moderate the request flow.
• External integrations (CloudflareR2, possibly email services) are invoked from appropriate service components.
• Caching and session/state management use Redis as configured.
Architectural Patterns and Design Principles
• The backend follows a layered (MVC-like) architecture:
○ Controllers → Services → Repositories → Database.
• Use of configuration and filtering patterns for security and cross-origin resource handling.
• Separation of concerns is evident: the frontend focuses on presentation and API consumption while the backend handles business logic, persistence, and external integrations.
• Clear use of DTOs for data transfer and mapping utilities (ProductMapperUtils) to separate business models from transport objects.