How naitikmangal/ecommerce works
Main Components
• Frontend (Customer-Facing): This is located in the "frontend" directory and contains all the React components, pages (e.g., Home, Product, Cart, Checkout), assets, context for state management (ShopContext), and styling using Tailwind CSS.
• Admin Panel: Found in the "admin" directory, it includes its own set of React components and pages (e.g., Login, List, Add, Order, PaymentTracking) designed for shop administration tasks like adding products, managing orders, and handling users.
• Backend API: Located in the "backend" directory. It’s a Node.js/Express server that handles RESTful API endpoints for products, users, orders, and carts. This module also contains configuration for MongoDB, middleware for authentication and file uploads, and controllers for business logic.
• Database: Integrated via MongoDB, as suggested by the configuration file “mongodb.js” under backend/config.
• External Services: While not extensive, the project integrates with Cloudinary for image storage (see cloudinary.js) and payment integration as mentioned in the README.
Relationships and Interactions
• The Frontend and Admin Panel are separate React applications communicating with the Backend.
• The Backend exposes RESTful endpoints for CRUD operations on products, users, orders, and carts.
• Both frontend applications will interact with the backend using API calls, with authentication relying on JWT tokens.
• The Backend communicates with MongoDB for database operations.
• Optionally, the backend may also interact with external services like Cloudinary for asset management.
Architectural Patterns and Technologies
• The project leverages the MERN stack (MongoDB, Express, React, Node.js) with Tailwind CSS for styling.
• The backend follows RESTful conventions and uses middleware for authentication and file handling.
• The frontend applications are structured around reusable React components and utilize context (e.g., ShopContext) for state management.
• The clear separation between admin and customer-facing modules is an important design decision ensuring distinct user experiences and responsibilities.
Additional Details
• Labels and descriptions for tools and libraries such as React, Express, Tailwind CSS, and JWT.
• Configuration or build scripts like Vite configurations, Tailwind configs, and ESLint settings that are relevant for the context but keep the overall focus on runtime components.
• To capture the fact that the system is split into two distinct frontends (for customers and admins) that communicate with a shared backend.