Skip to content

7TIN/Library-Management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Management

A simple Library Management System built with Spring Boot.
This RESTful API allows you to manage books: add, view, update availability, and delete records.

Features

  • Add new books
  • Retrieve all books
  • Get book details by ID
  • Update book availability
  • Delete books
  • RESTful endpoints using Spring Boot
  • Postman collection for API testing

Getting Started

Prerequisites

  • Java 17 or above
  • Maven 3.8+
  • (Optional) Postman for API testing

Setup

  1. Clone the repository

    git clone https://github.com/7TIN/Library-Management.git
    cd Library-Management
  2. Build the project

    ./mvnw clean install
  3. Run the application

    ./mvnw spring-boot:run

    The API will start at: http://localhost:8080

API Endpoints

Method Endpoint Description
POST /api/books Add a new book
GET /api/books Get all books
GET /api/books/{id} Get book by ID
PATCH /api/books/avail/{id} Update book availability
DELETE /api/books/{id} Delete book by ID

Example JSON for Adding a Book

{
  "title": "Clean Code",
  "author": "Robert C. Martin",
  "isbn": "9780132350884"
}

Example: Update Availability

PATCH /api/books/avail/{id}

Testing with Postman

Run in Postman

  1. Use the sample requests to test all endpoints.

Project Structure

src/
 └── main/
     ├── java/
     │   └── com/prasad/library/
     │       ├── Beans/
     │       ├── Controller/
     │       ├── Repository/
     │       ├── Service/
     │       └── dto/
     └── resources/
         └── application.properties

Best Practices

  • Uses DTOs for request/response mapping
  • Follows RESTful resource naming conventions
  • Proper HTTP status codes and error handling
  • Separation of concerns: Controller, Service, Repository layers

License

This project is open source and available under the MIT License.