A full-stack e-commerce application built with the MERN stack, featuring a modern React frontend, robust Node.js backend, and comprehensive admin panel.
- Overview
- Prerequisites
- Installation
- Usage
- Project Structure
- Features
- Technology Stack
- API Endpoints
- Contributing
- License
- Author
TuuShop is a complete e-commerce solution that allows users to browse products, manage their shopping cart, process payments through PayPal, and handle orders. The application includes an admin panel for managing products, orders, and users.
Before running this application, make sure you have the following installed:
- Node.js (v14 or higher)
- MongoDB
- npm or yarn package manager
-
Clone the repository:
git clone <repository-url> cd TuuShop
-
Install backend dependencies:
npm install
-
Install frontend dependencies:
cd frontend npm install cd ..
-
Create a
.env
file in the root directory and add the following environment variables:MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret PAYPAL_CLIENT_ID=your_paypal_client_id NODE_ENV=development PORT=8000
-
Seed the database with sample data (optional):
npm run data:import
To run both frontend and backend concurrently:
npm run dev
Backend server:
npm run server
Frontend development server:
npm run client
npm start
The application will be available at http://localhost:3000
(frontend) and http://localhost:8000
(backend).
TuuShop/
├── backend/
│ ├── config/ # Database configuration
│ ├── controllers/ # Route controllers
│ ├── data/ # Sample data
│ ├── middleware/ # Custom middleware
│ ├── models/ # Mongoose models
│ ├── routes/ # API routes
│ ├── utils/ # Utility functions
│ └── server.js # Express server setup
├── frontend/
│ ├── public/ # Static assets
│ └── src/
│ ├── components/ # Reusable React components
│ ├── screens/ # Page components
│ ├── slices/ # Redux slices
│ └── utils/ # Frontend utilities
└── package.json # Root package configuration
- Product browsing with search and filtering
- Product details with ratings and reviews
- Shopping cart management
- User authentication and registration
- Order placement and tracking
- PayPal payment integration
- User profile management
- Order history
- Product management (create, read, update, delete)
- Order management and status updates
- User management
- Image upload for products
- Sales analytics
- Responsive design with Bootstrap
- Redux state management
- JWT authentication
- MongoDB database with Mongoose ODM
- Image upload with Multer
- Pagination for products and orders
- Error handling middleware
- API validation
- React - JavaScript library for building user interfaces
- Redux Toolkit - State management
- React Router - Client-side routing
- React Bootstrap - UI components
- Axios - HTTP client
- Node.js - JavaScript runtime
- Express.js - Web framework
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- JWT - Authentication
- bcryptjs - Password hashing
- Multer - File upload handling
- PayPal API - Payment processing
GET /api/products
- Get all productsGET /api/products/:id
- Get single productPOST /api/products
- Create product (Admin)PUT /api/products/:id
- Update product (Admin)DELETE /api/products/:id
- Delete product (Admin)
POST /api/users/register
- Register userPOST /api/users/login
- Login userGET /api/users/profile
- Get user profilePUT /api/users/profile
- Update user profile
POST /api/orders
- Create orderGET /api/orders/:id
- Get order by IDGET /api/orders/myorders
- Get user ordersPUT /api/orders/:id/pay
- Update order to paid