BookHive is a web application that allows users to browse and order books online. The platform enables users to create accounts, log in, add books to their cart, and place orders seamlessly.
- User Authentication: Secure sign-up and login functionality with password encryption using bcrypt.
- Browse Books: Users can explore a variety of books across multiple genres.
- Add to Cart: Add books to the cart and review them before placing an order.
- Order Placement: Submit orders with detailed address and payment information.
- Order Confirmation: View order confirmation details after successful placement.
- Backend API: Robust backend built with Node.js and Express.
- Database: MongoDB is used to store user details, orders, and book information.
- Frontend: HTML, CSS, JavaScript
- Backend: Node.js, Express.js
- Database: MongoDB Atlas
- Security: Password encryption with bcrypt and JSON Web Token (JWT) for authentication.
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add the following:PORT=5000 MONGODB_URI=<your-mongodb-uri> JWT_SECRET=<your-jwt-secret>
-
Start the server:
npm start
-
Access the application at
http://localhost:5000
.
-
POST /signup: Register a new user.
{ "username": "JohnDoe", "mobile": "1234567890", "email": "[email protected]", "password": "password123" }
-
POST /login: Log in an existing user.
{ "email": "[email protected]", "password": "password123" }
-
POST /submit-order: Submit a new book order.
{ "name": "John Doe", "Ordermobile": "1234567890", "Orderemail": "[email protected]", "add": "123 Main Street", "pincode": 123456, "state": "California", "paytype": "Credit Card", "items": ["book1", "book2"], "cost": 500 }
-
POST /verify: Verify the user token.
{ "token": "<jwt-token>" }
- Inline event handlers may conflict with CSP if strict policies are applied.
- Ensure the MongoDB URI and JWT secret are configured correctly.
Contributions are welcome! Please fork the repository and create a pull request.
This project is licensed under the MIT License.