A full-stack e-commerce application built with the MERN stack (MongoDB, Express, React, Node.js).
This project provides a robust platform for online shopping, featuring user authentication, product management, shopping cart functionality, order processing, and administrative controls.
- User Authentication: Secure user registration, login, and profile management.
- Product Management: Browse, search, and view product details. Admins can create, update, and delete products.
- Shopping Cart: Add items to the cart, update quantities, and remove items.
- Order Processing: Place orders, view order history, and track order status.
- Payment Integration: Seamless integration with PayPal for secure online payments.
- Admin Dashboard: Comprehensive interface for administrators to manage products, users, and orders.
- Responsive Design: User-friendly interface that adapts to various screen sizes.
- Image Uploads: Functionality for uploading product images.
- Frontend: React, React Router, Redux Toolkit, React Bootstrap, React Icons, Axios, React Toastify, React Helmet Async
- Backend: Node.js, Express.js, Mongoose, Bcryptjs, JWT (jsonwebtoken), Multer, Nodemon, Dotenv, Concurrent.js
- Database: MongoDB
- Deployment: (Not explicitly specified in code, but MERN stack implies deployment on platforms like Heroku, AWS, etc.)
To get this project up and running locally, follow these steps:
-
Clone the repository:
git clone https://github.com/rbishal50/proShop.git cd proShop -
Set up the backend:
- Navigate to the
backenddirectory:cd backend - Install backend dependencies:
npm install
- Create a
.envfile in thebackenddirectory and add your MongoDB connection URI and JWT secret:PORT=8000 MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key - Seed the database with initial data (users and products):
npm run data:import
- To destroy all data (use with caution):
npm run data:destroy
- Navigate to the
-
Set up the frontend:
- Navigate to the
frontenddirectory:cd ../frontend - Install frontend dependencies:
npm install
- Ensure your frontend can communicate with the backend. The
proxyinfrontend/package.jsonis set tohttp://localhost:8000.
- Navigate to the
-
Run the application:
- In the root directory (
proShop), start both the backend and frontend servers simultaneously:npm run dev
- Alternatively, you can start them separately:
- Backend:
npm start(ornpm run serverfor nodemon) - Frontend:
npm start(from thefrontenddirectory)
- Backend:
- In the root directory (
-
Access the application: Open your browser and navigate to
http://localhost:3000.
ProShop is a fully functional e-commerce platform. Here's how you can use it:
- Browsing Products:
- The homepage displays featured products and the latest arrivals.
- Use the search bar in the header to find specific products.
- Navigate through product categories and pages using the pagination controls.
- Product Details: Click on any product to view its detailed description, price, rating, and reviews.
- Shopping Cart:
- Add products to your cart by clicking the "Add To Cart" button on the product page.
- View your cart contents by clicking the "Cart" icon in the header.
- Adjust quantities or remove items directly from the cart screen.
- User Accounts:
- Register for a new account or log in if you already have one.
- Once logged in, you can view your profile, update your information, and see your order history.
- Checkout Process:
- Proceed to checkout from the cart.
- Enter your shipping address.
- Select your preferred payment method (PayPal is integrated).
- Place your order.
- Admin Functionality:
- If you log in as an admin user (default:
admin@email.com/123456), you will have access to an "Admin" dropdown in the header. - From the admin menu, you can manage Products (list, create, edit, delete), Users (list, edit, delete), and Orders (list, view details, mark as delivered).
- If you log in as an admin user (default:
proShop/
├── backend/
│ ├── config/
│ ├── controllers/
│ ├── data/
│ ├── middlewares/
│ ├── models/
│ ├── routes/
│ ├── utils/
│ ├── .env.example
│ ├── server.js
│ └── seeder.js
├── frontend/
│ ├── public/
│ │ ├── index.html
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src/
│ │ ├── assets/
│ │ │ └── styles/
│ │ ├── components/
│ │ ├── constants.js
│ │ ├── screens/
│ │ │ ├── admin/
│ │ │ ├── App.js
│ │ │ ├── CartScreen.jsx
│ │ │ ├── HomeScreen.jsx
│ │ │ ├── LoginScreen.jsx
│ │ │ ├── OrderScreen.jsx
│ │ │ ├── PaymentScreen.jsx
│ │ │ ├── PlaceOrderScreen.jsx
│ │ │ ├── ProductScreen.jsx
│ │ │ ├── ProfileScreen.jsx
│ │ │ ├── RegisterScreen.jsx
│ │ │ └── ShippingScreen.jsx
│ │ ├── reportWebVitals.js
│ │ ├── setupTests.js
│ │ ├── slices/
│ │ ├── store.js
│ │ └── utils/
│ ├── package.json
│ └── README.md
├── .gitignore
├── package.json
└── README.md
-
Backend:
expressmongoosedotenvbcryptjsjsonwebtokencookie-parsermulternodemonconcurrently
-
Frontend:
reactreact-domreact-scriptsreact-bootstrapreact-router-domreact-redux@reduxjs/toolkitaxiosreact-toastifyreact-iconsreact-helmet-async@paypal/react-paypal-jsreact-router-bootstrapbootstrap
The backend exposes several API endpoints for the frontend to consume:
-
Products (
/api/products)GET /: Get all products (with pagination and search).GET /top: Get top-rated products.GET /:id: Get a single product by ID.POST /: Create a new product (Admin only).PUT /:id: Update a product (Admin only).DELETE /:id: Delete a product (Admin only).POST /:id/reviews: Create a review for a product.
-
Users (
/api/users)POST /auth: Authenticate user and get token.POST /: Register a new user.POST /logout: Log out user and clear cookie.GET /profile: Get user profile.PUT /profile: Update user profile.GET /: Get all users (Admin only).GET /:id: Get user by ID (Admin only).PUT /:id: Update user by ID (Admin only).DELETE /:id: Delete user by ID (Admin only).
-
Orders (
/api/orders)POST /: Create a new order.GET /mine: Get logged-in user's orders.GET /:id: Get order by ID.PUT /:id/pay: Update order to paid.PUT /:id/deliver: Update order to delivered (Admin only).GET /: Get all orders (Admin only).
-
File Uploads (
/api/upload)POST /: Upload a file (image).
-
PayPal Config (
/api/config/paypal)GET /: Get PayPal client ID.
Contributions are welcome! Please feel free to submit a Pull Request or open an issue if you encounter any problems or have suggestions.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is not explicitly licensed in the provided files. Please refer to the repository for any licensing information.
- Live Demo: (No live demo link provided in the analyzed files.)
- Author Profile: Bishal Rana
© 2023 ProShop
Repository: proShop
Author: Bishal Rana
Feel free to ⭐ Star, ⑂ Fork, ⎘ Watch, or # Issue this project!
Generated by ReadmeCodeGen