Skip to content

About

A backend-only Library Management System built using Node.js, Express.js, and MongoDB. The system provides RESTful APIs for managing books, users, authentication, issue/return operations, and library records.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Library Management System β€” Backend API

A backend-only Library Management System built using Node.js, Express.js, and MongoDB. The system provides RESTful APIs for managing books, users, authentication, issue/return operations, and library records.


πŸš€ Project Overview

This project is a backend API service for a Library Management System. It allows administrators and users to:

  • Manage books
  • Manage users
  • Issue and return books
  • Authenticate users securely
  • Perform CRUD operations

The backend is designed using REST API architecture with MongoDB database integration.


🌟 Features

πŸ” Authentication & Security

  • User Signup & Login
  • JWT Authentication
  • Password Hashing using bcrypt
  • Protected Routes

πŸ“š Book Management

  • Add Books
  • Update Book Details
  • Delete Books
  • Get All Books
  • Search Books

πŸ‘€ User Management

  • Register Users
  • Login Users
  • Manage User Records

πŸ”„ Issue & Return System

  • Issue Books
  • Return Books
  • Track Borrowed Books

πŸ› οΈ Tech Stack

Backend

  • Node.js
  • Express.js

Database

  • MongoDB
  • Mongoose

Authentication

  • JWT
  • bcryptjs

Other Packages

  • dotenv
  • cors
  • morgan
  • nodemon

πŸ“‚ Folder Structure

backend/
β”‚
β”œβ”€β”€ config/
β”‚   └── db.js
β”‚
β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ authController.js
β”‚   β”œβ”€β”€ bookController.js
β”‚   └── userController.js
β”‚
β”œβ”€β”€ middleware/
β”‚   β”œβ”€β”€ authMiddleware.js
β”‚   └── errorMiddleware.js
β”‚
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ User.js
β”‚   β”œβ”€β”€ Book.js
β”‚   └── Issue.js
β”‚
β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ authRoutes.js
β”‚   β”œβ”€β”€ bookRoutes.js
β”‚   └── userRoutes.js
β”‚
β”œβ”€β”€ services/
β”‚
β”œβ”€β”€ .env
β”œβ”€β”€ server.js
β”œβ”€β”€ package.json
└── README.md

🌐 API Endpoints

πŸ” Authentication APIs

Signup

POST /api/auth/signup

Request Body

{
  "name": "Akshit",
  "email": "akshit@gmail.com",
  "password": "123456"
}

Login

POST /api/auth/login

Request Body

{
  "email": "akshit@gmail.com",
  "password": "123456"
}

πŸ“š Book APIs

Add Book

POST /api/books

Request Body

{
  "title": "Atomic Habits",
  "author": "James Clear",
  "category": "Self Help",
  "quantity": 5
}

Get All Books

GET /api/books

Get Single Book

GET /api/books/:id

Update Book

PUT /api/books/:id

Delete Book

DELETE /api/books/:id

Search Books

GET /api/books/search?title=Atomic

πŸ”„ Issue & Return APIs

Issue Book

POST /api/issues

Request Body

{
  "userId": "USER_ID",
  "bookId": "BOOK_ID"
}

Return Book

PUT /api/issues/return/:id

πŸ” Environment Variables

Create .env file inside backend folder:

PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key

πŸš€ Installation & Setup

Clone Repository

git clone YOUR_GITHUB_REPO_URL

Install Dependencies

npm install

▢️ Run Backend Server

Development Mode

npm run dev

Production Mode

npm start

πŸ”’ Security Features

  • JWT Authentication
  • Password Hashing
  • Protected Routes
  • Environment Variables
  • Secure API Handling

πŸ“Š Database Collections

Users Collection

Stores:

  • name
  • email
  • password

Books Collection

Stores:

  • title
  • author
  • category
  • quantity

Issues Collection

Stores:

  • userId
  • bookId
  • issueDate
  • returnDate

πŸ’‘ Key Functionalities

  • CRUD Operations
  • REST API Architecture
  • Authentication System
  • MongoDB Integration
  • Error Handling Middleware
  • Search & Filtering

πŸš€ Future Improvements

  • Fine Calculation System
  • Admin Dashboard
  • Email Notifications
  • Book Reservation System
  • Role-Based Access

πŸ“Έ Screenshots

Add:

  • Postman API Testing
  • MongoDB Collections
  • Authentication APIs
  • CRUD Operations
  • Deployment Screenshots

πŸ‘¨β€πŸ’» Author

Akshit Vats

Library Management System Backend πŸ˜„πŸ”₯

About

A backend-only Library Management System built using Node.js, Express.js, and MongoDB. The system provides RESTful APIs for managing books, users, authentication, issue/return operations, and library records.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages