π Backend RESTful API for The Book Haven β a full-stack book management system. Handles all CRUD operations with user-specific data using email from Firebase Auth.
π Backend API for The Book Haven β Node.js + Express + MongoDB | User-specific CRUD operations
π₯ Live API Base URL: https://bookhaven-server.vercel.app/api
π Client Live Demo: https://bookhaven-client.web.app
- Full CRUD operations for books (Create, Read, Update, Delete)
- User-specific books filtering using
userEmail(perfect for Firebase Auth) - Quantity management (increment/decrement when borrowing)
- CORS enabled β works seamlessly with Firebase/Vercel/Netlify frontends
- Lightweight, fast, and production-ready
- Deployed on Vercel Serverless Functions
| Technology | Purpose |
|---|---|
| Node.js (18+) | Runtime |
| Express.js | Web framework |
| MongoDB Atlas | NoSQL Database |
| Mongoose | MongoDB object modeling |
| CORS | Allow frontend domains |
| dotenv | Environment variables |
```json
"dependencies": {
"express": "^4.18.2",
"mongoose": "^8.0.0",
"cors": "^2.8.5",
"dotenv": "^16.3.1"
}
git clone https://github.com/TheLunatic1/bookhaven-server.git
cd bookhaven-server
npm install
cp .env.example .env
npm run dev
PORT=5000
MONGODB_URI=your_mongodb_atlas_connection_string
| Method | Endpoint | Description | Auth Required? |
|---|---|---|---|
| GET | /api/books | Get all books | No |
| GET | /api/books/my?email=user@example.com | Get user's own books | No (email-based) |
| POST | /api/books | Add a new book | No (client handles auth) |
| PUT | /api/books/:id | Update book (title, quantity, etc.) | No (email check inside) |
| DELETE | /api/books/:id | Delete a book | No (email check inside) |
- π Live API: https://bookhaven-server.vercel.app/api/books
- π₯οΈ Client Repository: https://github.com/TheLunatic1/bookhaven-client
- βοΈ Server Repository: https://github.com/TheLunatic1/bookhaven-server
- π Live Site: https://bookhaven-client.web.app
