Skip to content

Akshitvats026/Library_Management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

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

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors