Welcome to Tata 1mg Clone, a full-stack e-commerce application designed to replicate the functionality of the Tata 1mg platform. This project utilizes React for the frontend, Node.js and Express.js for the backend, and MongoDB for data storage. Experience seamless user authentication and cart management in this robust application.
- User Authentication: Create accounts, log in, and log out with ease.
- Secure Cart Access: Only logged-in users can access and modify their cart.
- Cart Management: Add items to your cart seamlessly once logged in.
- Frontend: React
- Backend: Node.js, Express.js
- Database: MongoDB
-
Clone the repository:
git clone https://github.com/imoamo/1mg_clone.git
-
Navigate to the project directory:
cd 1mg_clone
-
Install the dependencies:
npm install
-
Run the application in development mode:
npm run dev
- Ensure MongoDB is running and accessible.
- Start the application using the provided development server commands.
- Open your browser and navigate to
http://localhost:5173
to explore the application.
- URL:
/api/user/signup
- Method: POST
- Description: Register a new user account.
- Request Body:
{ "name": "string", "email": "string", "password": "string" }
- Response:
{ "message": "User created successfully", "user": user }
- URL:
/api/user/login
- Method: POST
- Description: Authenticate a user and return a JWT token.
- Request Body:
{ "email": "string", "password": "string" }
- Response:
{ "token": "JWT token" }
- URL:
/api/auth/logout
- Method: POST
- Description: End the user session.
- Response:
{ "message": "User logged out successfully" }
- URL:
/api/product/create
- Method: POST
- Description: Add a product to the cart.
- Request Body:
{ "productId": "string", "quantity": "number" }
- Response:
{ "message": "Product added to cart", "cart": cart }
- URL:
/api/product
- Method: GET
- Description: Retrieve the user's cart.
- Response:
{ "cart": cart }
We welcome contributions! Feel free to submit a pull request or open an issue for any changes or improvements.
Feel free to update the image paths and any other details as needed. If there’s anything else you need, just let me know!