A full-stack e-commerce platform built with the MERN stack (MongoDB, Express, React, Node.js). The application provides separate interfaces for customers and administrators to browse products, manage inventory, and process secure online payments.
- Product Browsing - Browse and search products with detailed information
- Shopping Cart - Add, update, and remove items from cart
- Order Placement - Checkout with delivery information
- Payment Integration - Secure Stripe payment gateway integration
- Order Tracking - View order history and status
- User Authentication - Secure login and registration
- Product Management - Add, edit, and delete products
- Image Upload - Cloudinary integration for product images
- Order Management - View and update order status
- Inventory Control - Track product availability
- Admin Dashboard - Centralized management panel
- React 19 - UI library
- Vite - Build tool and dev server
- React Router DOM - Client-side routing
- Tailwind CSS - Styling
- Axios - HTTP requests
- React Toastify - Notifications
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - NoSQL database
- Mongoose - ODM library
- JWT - Authentication tokens
- Bcrypt - Password hashing
- Stripe - Payment gateway
- Cloudinary - Image hosting
- Multer - File uploads
E-commerce/
├── frontend/ # React frontend application
│ ├── src/
│ │ ├── components/ # Reusable components
│ │ ├── pages/ # Page components
│ │ ├── context/ # Context API for state management
│ │ ├── assets/ # Images and static files
│ │ └── App.jsx # Main app component
│ └── package.json
│
├── backend/ # Express backend server
│ ├── controllers/ # Request handlers
│ ├── models/ # MongoDB schemas
│ ├── routes/ # API endpoints
│ ├── middleware/ # Custom middlewares
│ ├── config/ # Configuration files
│ ├── server.js # Entry point
│ └── package.json
│
├── admin/ # Admin dashboard
│ ├── src/
│ │ ├── components/ # Admin UI components
│ │ ├── pages/ # Admin pages
│ │ └── App.jsx
│ └── package.json
│
└── README.md
- Node.js (v18 or higher)
- MongoDB local or cloud instance
- Stripe account for payment processing
- Cloudinary account for image hosting
-
Clone the repository
git clone <repository-url> cd E-commerce
-
Setup Backend
cd backend npm install -
Setup Frontend
cd ../frontend npm install -
Setup Admin Panel
cd ../admin npm install
Create .env files in the backend directory with the following variables:
# Backend Environment Variables
PORT=5000
MONGODB_URI=<your-mongodb-connection-string>
JWT_SECRET=<your-jwt-secret-key>
STRIPE_SECRET_KEY=<your-stripe-secret-key>
CLOUDINARY_NAME=<your-cloudinary-name>
CLOUDINARY_API_KEY=<your-cloudinary-api-key>
CLOUDINARY_API_SECRET=<your-cloudinary-api-secret>Backend:
cd backend
npm run server # Development with nodemon
# or
npm start # ProductionFrontend:
cd frontend
npm run dev # DevelopmentAdmin Panel:
cd admin
npm run dev # DevelopmentThe application will be available at:
- Frontend:
http://localhost:5173 - Admin:
http://localhost:5174 - Backend API:
http://localhost:5000/api
POST /api/user/register- Register new userPOST /api/user/login- User loginPOST /api/user/admin-login- Admin login
GET /api/product/list- Get all productsPOST /api/product/add- Add new product (Admin)POST /api/product/remove- Remove product (Admin)
POST /api/cart/add- Add item to cartPOST /api/cart/remove- Remove item from cartPOST /api/cart/get- Get user cartPOST /api/cart/update- Update cart item quantity
POST /api/order/place- Place COD orderPOST /api/order/stripe- Create Stripe payment sessionPOST /api/order/verifyStripe- Verify Stripe paymentPOST /api/order/list- Get all orders (Admin)POST /api/order/status- Update order status (Admin)POST /api/order/userorders- Get user orders
The application integrates with Stripe for secure online payments:
- User selects Stripe payment method
- Checkout session is created via backend
- User is redirected to Stripe Checkout
- Payment is verified and order is confirmed
- JWT Authentication - Secure token-based authentication
- Password Hashing - Bcrypt for secure password storage
- Authorization Middleware - Role-based access control
- Environment Variables - Sensitive data protection
- CORS - Cross-origin request handling
This project is open source and available under the ISC License.
Built by [Your Name/Organization]
For issues or questions, please create an issue in the repository or contact the development team.