How minhdang0000/fashion-project works
Main components
• Admin Dashboard: Located under the “admin” directory. This part includes React components (e.g., Login, Navbar, Sidebar) and pages for managing products, orders, brands, suppliers, etc. It is likely used by the site administrators to manage inventory, orders, and other key aspects.
• Frontend (Customer Website): Found under the “frontend” directory. It uses React (with Vite, TailwindCSS, etc.) components and pages meant for regular users. Pages such as Home, Product, Cart, and Order indicate typical e-commerce functionality.
• Backend (API Server): In the “backend” folder you see Node.js-based backend code, including controllers, models, routes, middleware, and configuration files for MongoDB and Cloudinary. This part is responsible for the application’s business logic, database interactions, authentication, and serving data to the frontend and possibly the admin dashboard.
• Database & External Services: Although not explicitly named in the file tree, the “backend/config/mongodb.js” and “cloudinary.js” files imply that a MongoDB database and Cloudinary (for image storage) are integrated.
Architectural patterns and design principles
• Separation of concerns: The project clearly splits the client-side (admin vs. customer interfaces) from the server-side logic.
• MVC Pattern (or similar): The “backend” is organized into controllers, models, and routes, which follows a common pattern for Node/Express applications.
• API-first communication: Both client applications (admin and frontend) consume REST API endpoints provided by the backend.
• State management: The “frontend/src/context/ShopContext.jsx” suggests that a React context is used to manage application state (especially for shopping cart or user session data).
Detailed component breakdown
• Admin Dashboard:
• Components: Login, Navbar, Sidebar.
• Pages: Add, Brands, Invoices, List, Orders, SellStatistics, Suppliers.
• Technologies: React, Vite, TailwindCSS.
• Customer Frontend:
• Components: BestSeller, CartTotal, Footer, Hero, LatestCollection, Navbar, NewsletterBox, etc.
• Pages: Home, About, Cart, Collection, Contact, Login, Orders, Place Order, Product, Verify.
• Additional: Uses ShopContext for state management.
• Backend API:
• Controllers: Manage requests for cart, orders, products, and users.
• Models: Represent the schema for orders, products, and users.
• Routes: Provide endpoints for the various functionalities.
• Middleware: Includes authorization and file upload handling via multer.
• Configurations: Setup for MongoDB and Cloudinary.
• Technologies: Node.js, Express, MongoDB, and integration with external services.