Bookstore MERN Stack Documentation
Overview
This project is a full-stack bookstore application developed using the MERN stack (MongoDB, Express.js, React, and Node.js), with additional features such as online payment, cash on delivery, and an admin panel for book and order management. The frontend is built with Next.js.
Features
- User Features:
- Browse books, add them to the cart, and place orders.
- Payment options: Online payment and cash on delivery.
- Track order status (Delivered/Completed).
- Admin Features:
- Add, update, or delete books.
- View orders, track payment amounts, and change order statuses.
- Mark orders as “Delivered” or “Completed” in the admin panel.
Screenshots
Admin Interface
These screenshots demonstrate the user-facing features of the application, such as browsing books, adding to the cart, and tracking order statuses.
User Interface
The admin panel allows the admin to manage books and orders, including updating, adding, and deleting books, as well as tracking orders and marking them as delivered or completed.
Technology Stack
- Frontend: Next.js, React
- Backend: Node.js, Express.js
- Database: MongoDB
- State Management: Redux (if applicable)
- Payment Integration: (Specify the service you’re using, e.g., Stripe, PayPal)
Setup and Installation
Prerequisites
Functionality
Admin Functionality
- Book Browsing: Users can search for books by category, author, or title.
- Cart Management: Users can add or remove books from their cart.
- Checkout: Users can choose between online payment and cash on delivery.
- Order Status Tracking: Users can view the status of their placed orders.
Admin Panel
- Book Management:
- Add New Book: Admins can add new books with details like title, author, price, stock, and description.
- Update Book Information: Admins can edit book details.
- Delete Book: Admins can delete books.
- Order Management:
- View Orders: Admins can view all orders, including user information and payment status.
- Update Order Status:
- Mark as “Delivered”.
- Mark as “Completed”.
- Payment Tracking: Calculate total payments received from online payments and cash on delivery.
API Routes
User Routes
-
GET /api/books: Fetch all books -
POST /api/cart: Add a book to the cart -
POST /api/orders: Place an order
Admin Routes
-
POST /api/admin/book: Add a new book -
PUT /api/admin/book/:id: Update a book by ID -
DELETE /api/admin/book/:id: Delete a book by ID -
GET /api/admin/orders: Fetch all orders -
PUT /api/admin/order/:id/deliver: Mark an order as “Delivered” -
PUT /api/admin/order/:id/complete: Mark an order as “Completed”
Order Workflow
- User places an order.
- Admin views the order in the admin panel.
- Admin marks the order as “Delivered”.
- Admin marks the order as “Completed” once the delivery is done.
Payment Processing
Explain your payment gateway setup and workflow for processing online payments.