How tranquockhanhdev/ecommerce-fashion works
The Synergy 4.0 project is a full-featured e-commerce website built on the Laravel Framework. Its purpose is to support online fashion stores, handling both customer-facing functionalities (product search, shopping cart, checkout, account management) and admin operations (product, category, order, and customer management). The project follows the Model-View-Controller (MVC) pattern, with distinct directories for controllers (including separate subdirectories for client and admin controllers), models, views, and additional configuration, service, and middleware components.
Main components of the system
• Client-side (Frontend):
• Blade templates found under resources/views and public/client (static assets like CSS, JavaScript, images)
• Client controllers and views handling account, shopping cart, product search, checkout, etc.
• Server-side (Backend):
• Laravel Controllers located in app/Http/Controllers, further split between client, admin, and authentication features.
• Models under app/Models that represent the business data (e.g., Account, Article, Order, Product, Category, etc.)
• Services such as VNPayService in app/Services for payment processing.
• Middleware (e.g., RoleMiddleware) to handle authorization and access control.
• Database:
• MySQL as indicated in the README, with migrations under database/migrations and seeders under database/seeders.
• External Services:
• Payment gateways (for example, integration with VNPay)
• Third-party libraries integrated via Composer and Node.js (for frontend builds via Laravel Mix/Vite)
Relationships and interactions
• Client (browser) sends requests routed through Laravel’s routing (defined in routes/web.php and routes/console.php).
• Requests are processed by controllers that separate admin and client logic.
• Controllers interact with models to perform CRUD operations on the database.
• Service classes (like VNPayService) are used by controllers to handle external payment processing.
• Middleware intercepts requests to enforce security (authentication and role-based access).
• Views (Blade templates) are used to render the UI for both customer-facing and admin-facing pages.
• Public static assets and storage (files under public/ and storage/) deliver images, CSS, and JavaScript.
Architectural patterns and design principles
• MVC architecture: Clear separation between data representation (Models), user interactions (Views), and application logic (Controllers).
• Modular structure: Separation of concerns between admin functionalities and client experiences.
• Service layer abstraction: Payment integration and possibly other business processes encapsulated in dedicated service classes.
• Middleware implementation for security.
• Controller Layer: Split into Admin and Client Controllers.
• Service Layer: Include VNPayService and any other services.
• Model Layer: Include key models (Account, Order, Product, etc.).
• Middleware: Represent RoleMiddleware responsible for securing routes.
• A separate block for the Database (MySQL) that interacts with Models.
• External components such as the payment gateway integration.
• Client sends HTTP requests to the server.
• Controllers receive requests, use middleware for authentication/authorization.
• Controllers interact with Models and Services to retrieve or store data.
• Responses are rendered using Blade Templates and then delivered back to the client.
• Rectangles for controllers and services.
• Rounded rectangles for external services or middleware.