This is an e-commerce platform developed using the MERN stack (MongoDB, Express.js, React, Node.js). The application provides a fully functional online shopping experience, including features like user authentication, product listing, cart management, order placement, and more.
- User Authentication: Users can register, login, and logout. JWT (JSON Web Tokens) are used for authentication.
- Product Management: Admins can add, update, and delete products.
- Product Catalog: Users can browse products, filter by categories, and view product details.
- Shopping Cart: Users can add products to their cart, update quantities, and remove items.
- Order Management: Users can place orders, and admins can view and manage orders.
- Payment Integration: Integrates with Stripe or PayPal for payment processing (optional).
- Responsive UI: Fully responsive front-end built with React, ensuring a smooth experience on both desktop and mobile devices.
-
Frontend:
- React.js
- Redux (for state management)
- React Router (for routing)
- Axios (for making HTTP requests)
- Material UI / Bootstrap (for UI components and styling)
-
Backend:
- Node.js
- Express.js
- MongoDB (with Mongoose for ODM)
- JWT for authentication
- Bcrypt for password hashing
-
Payment Integration: Stripe / PayPal (optional)
git clone https://github.com/your-username/e-commerce-mern.git
cd e-commerce-mernNavigate to the backend folder and install the necessary dependencies:
cd backend
npm installNavigate to the frontend folder and install the necessary dependencies:
cd frontend
npm installCreate a .env file in both the frontend and backend folders and set the necessary environment variables.
PORT=5000
MONGO_URI=mongodb://localhost:27017/ecommerce
JWT_SECRET=your_jwt_secret_key
PAYPAL_CLIENT_ID=your_paypal_client_id
STRIPE_SECRET_KEY=your_stripe_secret_keyREACT_APP_API_URL=http://localhost:5000/apiNavigate to the backend folder and run:
cd backend
npm startThis will start the backend server on http://localhost:5000.
Navigate to the frontend folder and run:
cd frontend
npm startThis will start the frontend development server on http://localhost:3000.
- Sign Up / Login: Create a new account or log in with existing credentials.
- Browse Products: Browse through the available products, view details, and add them to the cart.
- Manage Cart: View your cart, update quantities, or remove items.
- Checkout: Proceed to checkout and enter your shipping information. You can pay via Stripe or PayPal (depending on your setup).
- Order History: Users can view their order history, and admins can manage orders from the admin panel.
- POST /api/auth/register - Register a new user
- POST /api/auth/login - Login and return JWT token
- GET /api/auth/user - Get the authenticated user's data
- GET /api/products - Get a list of all products
- GET /api/products/:id - Get a specific product by ID
- POST /api/products - Add a new product (admin only)
- PUT /api/products/:id - Update a product (admin only)
- DELETE /api/products/:id - Delete a product (admin only)
- GET /api/cart - Get the user's cart
- POST /api/cart - Add an item to the cart
- PUT /api/cart - Update the quantity of an item in the cart
- DELETE /api/cart/:id - Remove an item from the cart
- GET /api/orders - Get a list of all orders (admin only)
- POST /api/orders - Place a new order
- GET /api/orders/:id - Get a specific order by ID
Include a few screenshots here to showcase the user interface and features.
If you would like to contribute to this project, feel free to fork the repository and submit a pull request. Please ensure your code follows the existing style and includes relevant tests.
This project is licensed under the MIT License - see the LICENSE file for details.