BookMart is a comprehensive full-stack e-commerce platform dedicated to buying and selling books. Built with the MERN stack, it offers a distinct and secure experience for both Buyers and Sellers.
- Features
- Tech Stack
- Folder Structure
- Getting Started
- Environment Variables
- API Reference
- Contributing
- License
- Browse & Search: Explore a vast collection of books with advanced filtering (Category, Price, Author).
- Secure Authentication: User-friendly Signup and Login.
- Shopping Cart: Add multiple items to the cart and proceed to checkout.
- Wishlist: Save favorite books for later.
- Order Management: View past orders and order status.
- Dashboard: A dedicated dashboard to view analytics and manage inventory.
- Book Management: Add, update, and remove book listings effortlessly.
- Image Upload: Seamless image uploads for book covers using Cloudinary.
- Sales Tracking: Monitor sales and earnings.
| Area | Technology |
|---|---|
| Frontend | React (Vite), Tailwind CSS, React Router DOM, Axios, React Hot Toast |
| Backend | Node.js, Express.js, JWT Authentication, Multer |
| Database | MongoDB, Mongoose |
| Storage | Cloudinary (Image Storage) |
| Tools | ESLint, Postman (Testing), Git |
BookMart/
├── Backend/ # Backend Server & Logic
│ ├── config/ # Database Connection & Config
│ ├── controllers/ # Request Handlers (Auth, Books, Orders)
│ ├── middleware/ # Custom Middleware (Auth, Uploads)
│ ├── models/ # Mongoose Schemas (User, Book, Order)
│ ├── routes/ # API Route Definitions
│ ├── utils/ # Helper Functions (Cloudinary, ErrorHandler)
│ └── server.js # Server Entry Point
│
├── Frontend/ # Frontend Client Application
│ ├── src/
│ │ ├── assets/ # Images, Fonts, Generic Styles
│ │ ├── components/ # Reusable UI Components (Navbar, Cards)
│ │ ├── context/ # Global State (Auth, Cart Context)
│ │ ├── pages/ # Application Pages
│ │ │ ├── auth/ # Login & Signup Pages
│ │ │ ├── buyer/ # Exploration, Cart, Checkout
│ │ │ └── seller/ # Dashboard, Inventory Management
│ │ ├── services/ # API Service Calls & Interceptors
│ │ ├── App.jsx # Main App Component & Routing
│ │ └── main.jsx # Application Entry Point
│ ├── index.html # HTML Template
│ └── tailwind.config.js # Tailwind CSS Configuration
│
└── README.md # Project DocumentationFollow these steps to set up the project locally.
-
Clone the repository
git clone https://github.com/AshisChetia/BookMart.git cd BookMart -
Backend Setup
cd Backend npm install # Start the server npm run dev
-
Frontend Setup
cd ../Frontend npm install # Start the client npm run dev
Create a .env file in the Backend and Frontend directories with the following variables:
| Variable | Description | Example |
|---|---|---|
PORT |
Server Port | 3000 |
MONGO_URI |
MongoDB Connection String | mongodb+srv://... |
JWT_SECRET |
Secret key for JWT | your_super_secret_key |
CLOUDINARY_CLOUD_NAME |
Cloudinary Cloud Name | your_cloud_name |
CLOUDINARY_API_KEY |
Cloudinary API Key | your_api_key |
CLOUDINARY_API_SECRET |
Cloudinary API Secret | your_api_secret |
FRONTEND_URL |
Frontend URL for CORS | http://localhost:5173 |
| Variable | Description | Default |
|---|---|---|
VITE_API_URL |
Check Backend API Base URL | http://localhost:3000/api |
Here are a few key endpoints:
- Auth:
POST /api/auth/register- Register a new userPOST /api/auth/login- Login user
- Books:
GET /api/books- Get all booksPOST /api/books- Add a new book (Seller only)GET /api/books/:id- Get book details
Contributions are always welcome!
- Fork the project
- Create your feature branch (
git checkout -b feature/NewFeature) - Commit your changes (
git commit -m 'Add some NewFeature') - Push to the branch (
git push origin feature/NewFeature) - Open a Pull Request
This project is licensed under the ISC License.