Library management API

Build an API for a library to manage its catalogue, rentals and returns.

3 hours
medium
1 submissions

Project Overview

Build an API for a library to manage its catalogue, rentals and returns.

This Library Management API is designed to help a library manage its resources, including books, authors, and borrowing activities. You can implement the API using any preferred technology, enabling library administrators to efficiently add, update, and delete records, track borrowed books, and manage author information.

Your submissions

No submissions yet, start by making your first submission

Detailed Project Description

Library Management API

This Library Management API is designed to help a library manage its resources, including books, authors, and borrowing activities. You can implement the API using any preferred technology, enabling library administrators to efficiently add, update, and delete records, track borrowed books, and manage author information.

Project Features

  • Author Management: Add, retrieve, and list authors, including details such as name, biography, and nationality.
  • Book Management: Catalog books by adding new entries, updating details, deleting entries, and listing all books in the library.
  • Borrow and Return Books: Track borrowed books by updating the availability of each book as it is borrowed or returned.
  • Book Search and Retrieval: Search for books by title, view a specific book's details, and list books by a specific author.

API Endpoints

  1. Author Endpoints:

    • POST /authors: Add a new author to the library's catalog.
    • GET /authors/:authorId: Retrieve details of a specific author.
    • GET /authors/:authorId/books: List all books associated with a specific author.
  2. Book Endpoints:

    • POST /books: Add a new book to the catalog.
    • GET /books: Retrieve a list of all books in the library.
    • GET /books/:bookId: View details of a specific book.
    • PUT /books/:bookId: Update a book’s information.
    • DELETE /books/:bookId: Remove a book from the catalog.
    • GET /books/search?title=<title>: Search for books by title.
  3. Borrowing and Returning:

    • POST /borrow: Record a borrowed book and update its availability.
    • POST /return: Mark a book as returned, restoring its availability in the catalog.

Getting Started

  1. Set Up the Project: Clone the repository, install dependencies, and start the server.
  2. Test API Endpoints: Use Postman or curl to test each endpoint, manage the library’s catalog, and track borrowing activities.

This project is a practical exercise in building a resource management API, with a focus on CRUD operations, data validation, and efficient catalog management.

Project Completion Criteria

  • Authors can be created with valid details, including name, biography, and nationality.
  • Author information can be accurately retrieved using the author's unique ID.
  • Books can be created for a specified author, with details such as title, author ID, category, and total copies.
  • Book information, including available copies, can be accurately retrieved using the book's unique ID.
  • Books can be borrowed by users, reducing the available copies as expected.
  • Borrowing requests are denied when no copies are available, with an appropriate error message.
  • Books can be returned by users, increasing the available copies as expected.
  • Return requests for books that haven’t been borrowed are handled with an appropriate error message.
  • Books can be borrowed again by the same user after being returned.
  • The system prevents borrowing beyond available copies, handling such cases correctly.
  • The system prevents invalid return attempts for books that weren’t previously borrowed.