A MERN stack eCommerce application for browsing products, managing a shopping cart, and processing orders. Admins can manage products and view orders.
- MongoDB: NoSQL database for data storage.
- Express.js: Server-side framework.
- React.js: Frontend library.
- Node.js: JavaScript runtime.
- Mongoose: ODM for MongoDB.
- JWT: Authentication.
- Stripe: Payment processing.
- User authentication (Register, Login, Logout)
- Product browsing and search
- Shopping cart management
- Order placement and tracking
- Admin dashboard for product management
- Stripe payment integration
- Node.js (v14+)
- MongoDB (local or cloud)
- Clone the repository:
git clone https://github.com/Shubham121s/ecommerce-project.git
- Navigate to the backend directory:
cd ecommerce-project/backend
- Install dependencies:
npm install
- Create a
.env
file and add:MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret STRIPE_SECRET_KEY=your_stripe_secret_key
- Start the server:
npm start
- Navigate to the frontend directory:
cd ecommerce-project/frontend
- Install dependencies:
npm install
- Create a
.env
file and add:REACT_APP_API_URL=http://localhost:5000
- Start the frontend server:
npm start
- Open
http://localhost:3000
in your browser. - Register or log in.
- Browse products, add to cart, and check out.
- POST /api/users/register - Register user
- POST /api/users/login - Log in user
- GET /api/products - Get all products
- GET /api/products/:id - Get product by ID
- POST /api/orders - Place order
- GET /api/orders/:id - Get order details
- GET /api/admin/products - Get all products (admin)
- POST /api/admin/products - Add product (admin)
- PUT /api/admin/products/:id - Update product (admin)
- DELETE /api/admin/products/:id - Delete product (admin)
- Fork the repo.
- Create a branch (
git checkout -b feature-branch
). - Commit changes (
git commit -am 'Add feature'
). - Push branch (
git push origin feature-branch
). - Open a Pull Request.