A comprehensive e-commerce platform built with MongoDB, Express, React, and Node.js (MERN stack).
- User registration and login
- JWT authentication
- Role-based access control (Admin/Customer)
- User profile management
- Product catalog with categories
- Product variants and specifications
- Image upload and management
- Stock tracking
- Featured products
- Responsive product grid
- Detailed product pages with image galleries
- Category filtering
- Product search
- Related products
- Ratings and reviews
- Shopping cart functionality
- Order creation and processing
- Order status tracking
- Order history
- Order statistics
- Sales analytics
- Inventory management
- User management
- Order processing
- Content management system (CMS)
- Responsive design for mobile and desktop
- MongoDB database integration
- RESTful API architecture
- JWT authentication
- Image upload with multer
- Environment-based configuration
The project is organized into two main directories:
- backend/ - Node.js Express server with MongoDB
- frontend/ - React application with Bootstrap
- Node.js (v14 or higher)
- MongoDB (or MongoDB Atlas account)
- npm or yarn
-
Clone the repository
git clone https://github.com/ryanhellerud1/e-commerce-platform.git cd e-commerce-platform -
Install backend dependencies
cd backend npm install -
Install frontend dependencies
cd ../frontend npm install
Create a .env file in the backend directory with the following variables:
NODE_ENV=development
PORT=5001
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
Create a .env file in the frontend directory:
REACT_APP_API_URL=http://localhost:5001/api
REACT_APP_ENV=development
For production, update .env.production with your production API URL.
-
Start the backend server
cd backend npm run dev -
Start the frontend application
cd frontend npm start -
Open your browser and navigate to
http://localhost:3000
POST /api/users- Register a new userPOST /api/users/login- User loginGET /api/users/profile- Get user profile (protected)PUT /api/users/profile- Update user profile (protected)GET /api/users- Get all users (admin only)GET /api/users/:id- Get user by ID (admin only)DELETE /api/users/:id- Delete user (admin only)
GET /api/categories- Get all categoriesGET /api/categories/tree- Get hierarchical category treeGET /api/categories/:id- Get category by IDGET /api/categories/:id/children- Get category childrenGET /api/categories/:id/ancestors- Get category ancestorsPOST /api/categories- Create new category (admin only)PUT /api/categories/:id- Update category (admin only)DELETE /api/categories/:id- Delete category (admin only)
GET /api/products- Get all products (with filtering)GET /api/products/top- Get top-rated productsGET /api/products/featured- Get featured productsGET /api/products/count- Get total product count (admin only)GET /api/products/category/:categoryId- Get products by categoryGET /api/products/slug/:slug- Get product by slugGET /api/products/:id- Get product by IDPOST /api/products- Create new product (admin only)PUT /api/products/:id- Update product (admin only)DELETE /api/products/:id- Delete product (admin only)POST /api/products/:id/reviews- Create product review (protected)
GET /api/orders- Get all orders (admin only)GET /api/orders/myorders- Get current user's ordersGET /api/orders/stats- Get order statistics (admin only)GET /api/orders/:id- Get order by IDPOST /api/orders- Create new orderPUT /api/orders/:id/pay- Update order to paidPUT /api/orders/:id/deliver- Update order to delivered (admin only)PUT /api/orders/:id/status- Update order status (admin only)PUT /api/orders/:id/cancel- Cancel order
POST /api/upload- Upload image (admin only)
- Node.js - JavaScript runtime
- Express - Web framework
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- JWT - JSON Web Tokens for authentication
- Bcrypt - Password hashing
- Multer - File upload middleware
- UUID - Unique identifier generation
- React - UI library
- React Router - Navigation
- Bootstrap - CSS framework
- Axios - HTTP client
- Font Awesome - Icons
- React Context - State management
This project is licensed under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.