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