How rishinion/e-commerce-virtual-bazar works
Project Type and Purpose
• This is a full-stack MERN (MongoDB, Express, React, Node.js) e-commerce web application with two user roles (“Admin” and “Shopper”) and an integrated dynamic chatbot for order assistance and FAQs.
File Structure
• Top-level “client” folder contains a Vite-powered React app (App.jsx, Chatbot.jsx) organized into:
• pages/ (shopping, admin, auth, not-found)
• components/ (admin-view, shopping-view, auth, common, ui)
• store/ (Redux slices for auth, admin, shop)
• lib, config, assets
• Top-level “server” folder contains an Express.js REST API:
• routes/ (auth, shop, admin, common, chatbot)
• controllers/ (business logic for each route)
• models/ (Mongoose schemas)
• helpers/ (cloudinary, PayPal integrations, chatbot engine)
• chatbot.js (chatbot server logic)
README Insights
• Features: user registration/login (JWT + CORS), product management, cart & orders, payment via PayPal, Cloudinary image uploads, dynamic chatbot.
• Stack: React, Node.js/Express, MongoDB, REST API, Redux, Tailwind/CSS modules.
a. Main Components
• User Interface (React SPA)
• API Layer (Express Server) with sub-modules:
• Auth Service (JWT issuance, validation)
• Shop Service (products, cart, orders, reviews, search)
• Admin Service (product & order administration)
• Common Service (features, FAQs)
• Chatbot Service (chatbot.js + controllers/helpers)
• Database (MongoDB Atlas)
• External Services: Cloudinary (image hosting), PayPal (payments), Optional Chatbot NLP provider (if any)
b. Relationships & Data Flows
• Browser → React Components → Redux Actions → REST Calls → Express API
• Express API Routes → Controllers → Mongoose Models → MongoDB
• Controllers call Helpers → communicate with Cloudinary/PayPal & return results
• Chatbot widget in React → WebSocket or HTTP → Chatbot Service → logic & external NLP → replies
c. Architectural Patterns & Principles
• Layered Architecture (Presentation → API/Service → Persistence)
• Modular REST Micro-services within one Node process (logical separation by routes/controllers)
• State Management in client via Redux slices (auth, shop, admin)
• Separation of Concerns: image and payment logic in helpers, domain logic in controllers
d. Key Technologies
• React (Vite), Redux Toolkit, Tailwind CSS
• Node.js, Express.js, Mongoose
• JWT, CORS for security
• MongoDB, Cloudinary, PayPal