A Backend Node.js + MongoDB-based library management system supporting book rentals, user roles, and borrowing limits.
infotech/ ├── config/ ✅ DB setup ├── collections/ ✅ Schema definitions for MongoDB initialization ├── server/ ✅ Express server files │ ├── routes/ ✅ All API route definitions │ ├── controllers/ ✅ Route logic (business flow) │ ├── services/ ✅ DB/service logic layer │ ├── models/ ✅ Mongoose models (optional if using Mongoose later) │ ├── middlewares/ ✅ Auth, error handling etc. │ └── index.js ✅ Main server entry point ├── .env ✅ Environment configuration └── package.json
yaml Copy Edit
- Node.js installed
- MongoDB installed and running locally
- Clone the repository
git clone <repo-url> cd infotech
Install dependencies
bash Copy Edit npm install Setup MongoDB database
Run this command to initialize your MongoDB database with collections:
bash Copy Edit node config/db.js Create a .env file (example content):
ini Copy Edit MONGO_URI=mongodb://localhost:27017 PORT=5000 Start the development server
bash Copy Edit npm run dev 📡 API Overview Base URL: http://localhost:5000
Modules include:
📘 Book rental & return
👤 User registration with role selection
🔒 Borrow limit enforcement
✅ Admin approval for book requests
📌 Notes Book availability is managed via inventory (numberOfCopies)
Borrowing is restricted based on approved and unreturned books only
Admin APIs for approval and management are also available
🛠 Tech Stack Node.js
Express
MongoDB