A modern, full-featured E-Commerce Platform built using the MERN Stack (MongoDB, Express, React, Node.js)
Featuring Secure Authentication, Stripe Payments, Cloudinary Integration, and Real-time Communication via Socket.IO.
ShopVerse is a Full-Stack MERN E-Commerce Web App built to simulate a real-world online shopping platform.
It enables users to register, browse products, add items to their cart, place orders, and make secure payments.
The backend integrates Socket.IO, Stripe, and Ethereal Email to provide a complete, real-time shopping experience.
| Feature | Description |
|---|---|
| π€ User Authentication | JWT-based login & signup with secure password hashing (bcrypt). |
| ποΈ Product Management | Products stored in MongoDB, images hosted via Cloudinary. |
| π Cart System | Persistent Redux cart across sessions. |
| π³ Payment Gateway | Stripe integration with test mode support. |
| π§ Email Confirmation | Nodemailer + Ethereal for fake order confirmation mails. |
| β‘ Real-Time Communication | Socket.IO backend broadcasting live pings and events. |
| βοΈ Cloud Hosted DB | MongoDB Atlas with dynamic schema models. |
| πΌοΈ Responsive UI | Built with TailwindCSS + PicoCSS for modern styling. |
| π§Ύ Order Tracking | Fetch user-specific order history dynamically. |
SHOPVERSE/
β
βββ backend/
β βββ config/
β β βββ cloudinary.js
β β βββ db.js
β β
β βββ controllers/
β β βββ adminController.js
β β βββ orderController.js
β β βββ productController.js
β β βββ userController.js
β β
β βββ data/
β β βββ products.js
β β
β βββ middleware/
β β βββ adminMiddleware.js
β β βββ authMiddleware.js
β β βββ uploadMiddleware.js
β β
β βββ models/
β β βββ orderModel.js
β β βββ productModel.js
β β βββ userModel.js
β β
β βββ routes/
β β βββ adminRoutes.js
β β βββ orderRoutes.js
β β βββ productRoutes.js
β β βββ uploadRoutes.js
β β βββ userRoutes.js
β β
β βββ utils/
β β βββ generateToken.js
β β βββ sendEmail.js
β β βββ sendRealEmail.js
β β
β βββ testSocketClient.js
β βββ server.js
β βββ .env
β βββ package.json
β βββ package-lock.json
β
βββ frontend/
β βββ public/
β β βββ vite.svg
β β
β βββ src/
β β βββ assets/
β β β βββ react.svg
β β β βββ Facetime.jpeg
β β β βββ Google_Meet-Logo.wine.svg
β β β
β β βββ components/
β β β βββ Footer.jsx
β β β βββ Navbar.jsx
β β β βββ PrivateRoute.jsx
β β β
β β βββ pages/
β β β βββ CancelPage.jsx
β β β βββ CartPage.jsx
β β β βββ ContactPage.jsx
β β β βββ HomePage.jsx
β β β βββ LoginPage.jsx
β β β βββ MyOrdersPage.jsx
β β β βββ PaymentsPage.jsx
β β β βββ ProductPage.jsx
β β β βββ ProfilePage.jsx
β β β βββ RegisterPage.jsx
β β β βββ SuccessPage.jsx
β β β
β β βββ redux/
β β β βββ slices/
β β β β βββ cartSlice.js
β β β β βββ productSlice.js
β β β β βββ userSlice.js
β β β βββ store.js
β β β
β β βββ utils/
β β β βββ api.js
β β β βββ socket.js (frontend socket.io client)
β β β
β β βββ App.jsx
β β βββ main.jsx
β β βββ index.css
β β βββ .env
β β
β βββ index.html
β βββ vite.config.js
β βββ tailwind.config.js
β βββ postcss.config.js
β βββ eslint.config.js
β βββ package.json
β βββ package-lock.json
β βββ .env
β
βββ .gitignore
βββ README.md
βββ package.json
Contains all server-side logic of the application.
Built using Node.js, Express.js, MongoDB, and Socket.IO.
| Subfolder | Purpose |
|---|---|
| config/ | Database and third-party service configurations (e.g., MongoDB, Cloudinary). |
| controllers/ | Business logic for users, products, orders, and admin tasks. |
| data/ | Seed data for initial setup or testing. |
| middleware/ | Middleware functions that enhance route behavior (authentication, role protection, file uploads). |
| models/ | Defines MongoDB schemas for users, products, and orders using Mongoose. |
| routes/ | Defines Express routes, mapping endpoints to controllers. |
| utils/ | Helper utilities like JWT generation and email services. |
| server.js | Initializes the Express app, sets up Socket.IO, connects to MongoDB. |
- authMiddleware.js β Verifies JWT token for private routes.
- adminMiddleware.js β Restricts route access to admin users only.
- uploadMiddleware.js β Validates and manages file uploads (e.g., product images).
| Controller | Responsibility |
|---|---|
userController.js |
Registration, login, profile management. |
productController.js |
Product listing, creation, and updates. |
orderController.js |
Handles order creation and retrieval for users. |
adminController.js |
Admin-side operations (dashboard, analytics - future). |
db.js: Establishes connection to MongoDB Atlas.cloudinary.js: Configures Cloudinary SDK for image uploads.
Defines how data is stored and structured in MongoDB.
- userModel.js β name, email, password (hashed), isAdmin.
- productModel.js β name, price, image URL, brand, stock, etc.
- orderModel.js β order items, payment status, delivery, timestamps.
Built using React + Vite, this folder contains all client-side code.
| Subfolder | Purpose |
|---|---|
| components/ | Reusable React components (e.g., Navbar, PrivateRoute). |
| pages/ | Represents each view/screen (Home, Cart, Login, etc.). |
| redux/ | Handles global application state. |
| utils/ | Shared functions like API and Socket.IO setup. |
| assets/ | Static images, icons, and other UI assets. |
- App.jsx β Root of the application containing routes.
- main.jsx β Mounts React app to the DOM.
- index.css β TailwindCSS base and global styles.
- api.js β Configured Axios instance with automatic JWT header injection.
- socket.js β Handles real-time event connections via Socket.IO.
Redux Toolkit organizes the state logic into slices:
cartSlice.jsβ Cart operations and persistence.productSlice.jsβ Fetches and stores product data.userSlice.jsβ Manages authentication state and user details.
The root store (store.js) combines all slices and provides them globally.
| File | Description |
|---|---|
.gitignore |
Specifies files ignored by Git. |
README.md |
Complete project documentation. |
package.json |
Project metadata and dependencies. |
ShopVerse integrates Stripe for secure online payments.
During development, all payments are processed in Stripe Test Mode, meaning no real money is involved.
Use the following test card information on the payment page (Stripe Checkout) when completing a purchase.
| Field | Test Value | Description |
|---|---|---|
| Card Number | 4242 4242 4242 4242 |
Universal Visa test card accepted for all successful payments. |
| Expiration Date | Any future date (e.g., 12 / 34) |
Must be a valid future month and year. |
| CVC / CVV | Any 3-digit number (e.g., 123) |
Simulates a valid security code. |
| Cardholder Name | Any name (e.g., Test User) |
Optional β for testing purposes only. |
| ZIP / Postal Code | Any 5-digit number (e.g., 10001) |
Simulates valid billing details. |
Stripe allows you to simulate various outcomes using specific card numbers:
| Card Number | Result | Description |
|---|---|---|
4242 4242 4242 4242 |
Successful Payment | Standard approval flow. |
4000 0566 5566 5556 |
Declined Payment | Simulates a generic decline. |
4000 0000 0000 9995 |
Requires Authentication | Triggers 3D Secure authentication. |
4000 0000 0000 9987 |
Insufficient Funds | Simulates a failed transaction due to low balance. |
4000 0000 0000 9979 |
Card Expired | Simulates expired card error. |
Tip: You can find more test cards in the official Stripe Test Card Documentation.
- Modular Design: Each feature (user, product, order) lives in its own controller, route, and model.
- Separation of Concerns: Business logic, routing, and data handling are independent.
- Reusability: Middleware and utility functions reduce code duplication.
- Scalability: Easily extendable for admin dashboards, notifications, or analytics.
- Real-time Ready: Built-in Socket.IO server for live updates and pings.
- Security: JWT-based authentication, bcrypt password hashing, and CORS control.
Before running the project, create separate .env files for both backend and frontend.
PORT=5001
MONGO_URI=your_mongo_uri
JWT_SECRET=your_secret
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret
STRIPE_SECRET_KEY=your_stripe_key
ETHEREAL_USER=your_ethereal_username
ETHEREAL_PASS=your_ethereal_password
Note: ETHEREAL_USER and ETHEREAL_PASS are used for sending fake emails via Ethereal Email during testing. Stripe test mode works over HTTP during development but requires HTTPS in production.
VITE_API_BASE_URL=http://localhost:5001/api
VITE_SOCKET_URL=http://localhost:5001
Set these URLs to your deployed backend address when deploying the app online.
How to Run the Project
- Backend Setup
cd backend npm install npm run devThis starts the Express + Socket.IO server on: π http://localhost:5001
- Frontend Setup
cd frontend npm install npm run devThis launches the Vite-powered React frontend on: π http://localhost:5173
Once youβve set up and started both servers, use this checklist to verify all core functionalities of ShopVerse.
| Step | Description | Expected Result |
|---|---|---|
| 1 | Run backend (npm run dev) |
Server starts and displays: Server running with Socket.IO on port 5001 |
| 2 | Run frontend (npm run dev) |
React app launches at http://localhost:5173 |
| 3 | Test Login/Register | User successfully registers and JWT token is stored in localStorage |
| 4 | Add Product to Cart | Product count updates dynamically in the cart |
| 5 | Checkout with Stripe | Payment success/cancel redirects work correctly |
| 6 | Check Backend Console | Ethereal email confirmation log appears |
| 7 | Test Socket.IO | Console logs show ping messages every 5 seconds |
ShopVerse includes backend-powered real-time communication via Socket.IO, allowing instant updates, live notifications, and heartbeat checks between the client and server.
| Event Name | Description |
|---|---|
ping |
Emitted automatically every 5 seconds from the backend to confirm active connection. |
userRegistered |
Triggered when a new user successfully registers on the platform. |
orderPlaced (future) |
Will notify the admin dashboard in real time when a new order is placed. |
paymentSuccess (future) |
Planned event for pushing live payment confirmation to users. |
A simple test client is included in the backend to verify that real-time communication is working correctly.
cd backend
node testSocketClient.js
ShopVerse is designed for scalability and future expansion. Below are planned enhancements and potential integrations to make the platform even more powerful:
| Feature | Description | Status |
|---|---|---|
| Admin Dashboard | Manage products, orders, and users with live updates. | Coming Soon |
| Inventory Automation | Auto-update stock levels post-purchase. | In Planning |
| Real-Time Order Tracking | Track order status dynamically via Socket.IO. | In Development |
| Live Chat (User β Admin) | One-to-one chat powered by Socket.IO and Redux. | Planned |
| Analytics Dashboard | Insights on revenue, sales, and user metrics. | Research Phase |
| Multi-Vendor Marketplace | Allow multiple sellers to manage products. | Roadmap |
| Push Notifications | Browser notifications for updates and offers. | Planned |
| UI Enhancements | Advanced animations, dark mode toggle, etc. | Continuous |
ShopVerse is built as a foundation for scalable e-commerce solutions β focusing on modularity, performance, and real-time interaction.
Future updates aim to extend its capabilities for enterprise-level applications.
| Architectural Goal | Description |
|---|---|
| Modular Design | Separate backend and frontend with API-driven architecture. |
| Real-Time Communication | Use of Socket.IO for live updates and event-based triggers. |
| Scalable Infrastructure | Deployable on cloud platforms with horizontal scaling options. |
| Data Security | JWT authentication, bcrypt hashing, and secure cookie handling. |
| Extensibility | Easy integration of new modules like admin dashboard or chat. |
| Automation | Plans to automate inventory, order status, and email updates. |
| Deployment Flexibility | Ready for containerization (Docker) and CI/CD pipelines. |
If you liked this project, donβt forget to star β the repo!
Feedback, suggestions, and collaborations are always welcome!
Sanskriti β Full Stack Developer (MERN)



















