How menathndgd/mern-ecommerce works
Main Components
• User Frontend: Located in the “frontend” directory – built with React.js, this part handles all customer interactions such as browsing products, managing the shopping cart, authentication, and order placement.
• Admin Dashboard: Found in the “admin” directory – also a React.js application, used for product management, category management, order processing, and user role management.
• Backend API: In the “backend” directory – developed using Node.js and Express.js, it contains controllers, models, routes, and middleware. It interacts with the MongoDB database and external services.
• Database: MongoDB serves as the NoSQL database for storing products, orders, users, and other application data.
• External Services: Include integrations with Stripe for payments and Cloudinary for image storage & management, as well as JWT for authentication handling.
Relationships and Interactions
• Authentication: Use JWT as a part of the security workflow; illustrate this between the clients (frontend/admin) and backend.
• Third-party Services: Show connections from the backend to services like Stripe (for payment transactions), Cloudinary (for handling images), and any other external API integrations.
• Environment Configuration: Note that environment variables (as seen in the .env files in each project) configure connections (like VITE_BACKEND_URL and MONGODB_URI) and should be considered when demonstrating deployment interactions.
Architectural Patterns
• Separation of Concerns: The system is clearly partitioned into distinct client applications (user and admin) and the backend REST API.
• MVC (Model-View-Controller) Pattern in the Backend: Controllers manage request processing, models define the data schema, and routes map endpoints.
• Use of Middleware: Identify usage of middleware such as authentication checks (adminAuth) and multipart file handling (multer) in the backend.
• Micro Frontends or Modular Frontends: While both admin and user interfaces are React-based, highlight that each is independently developed and deployed.
Technologies and Frameworks
• Frontend: React.js, Vite for bundling, Tailwind CSS for styling, and ESLint for code quality.
• Backend: Node.js, Express.js, MongoDB for storage, JWT for authentication, and middleware such as multer.
• Third-Party Services: Stripe for payments and Cloudinary for images.
• Deployment & Build: Note Vercel configuration files in admin, backend, and frontend directories that suggest deployment to Vercel.