How harunagangx/mern-ecommerce-website works
Main Components Identification
• Clients Frontend: This part of the project (located in the "clients" directory) covers all user-facing pages, such as home, product detail, cart, login, and order management. It uses React, Redux, React Router, and SCSS for styling.
• Admin Frontend: Separated into its (admin) directory, it provides specialized interfaces for managing products, categories, users, and orders. It also employs React, Redux, and custom component layouts.
• Backend Server: Found in the "server" directory, this is the core of the application. It is built with Node.js and Express.js, exposing RESTful API endpoints to manage products, orders, categories, users, and payments. It connects to MongoDB using Mongoose, integrates Stripe for payment processing, and contains middleware for authentication, error handling, and file uploads.
• Database: Although the database is not a dedicated directory in the codebase, MongoDB (accessed via Mongoose) is the persistent layer for data storage across users, orders, products, and categories.
• External Services: Include integration with Stripe for payment processing as noted in the README.
Relationship and Interaction Mapping
• The Backend interacts with the MongoDB database for all data persistence operations.
• Additionally, various middlewares (like authentication via JWT and file upload handling with Multer) support the backend service, so these can be noted as internal components of the server block.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly separate the concerns of the admin interface, client interface, and backend API.
• MVC (Model-View-Controller) pattern on the backend is implied by segregating controllers, models, and routes.
• Unidirectional Data Flow: In the frontends, connections between React components and Redux represent a predictable state flow.
• Modular Structure: The distinct folder paths (actions, reducers, pages, components) indicate a modular design; include these details to highlight how components interact within their layer.
• API Gateway: The server functions as a central hub that all frontends interact with.