Skip to content

Latest commit

 

History

History
109 lines (77 loc) · 2.79 KB

File metadata and controls

109 lines (77 loc) · 2.79 KB

library-java

Java Spring Boot Maven License

A Spring Boot REST API backend for a library management system. Handles book catalogue, borrow/return operations, user management, and a comment system — all served over a clean JSON API.

Frontend: Pairs with BookshelfGenius — a React + TypeScript web client.


API Endpoints

Books — /api/books

Method Endpoint Description
GET /api/books List all books
GET /api/books/borrowed List currently borrowed books
POST /api/books Borrow a book { bookId, username }
PUT /api/books/{id}/return Return a borrowed book
GET /api/books/{id}/comments Get comments for a book
POST /api/books/{id}/comments Add a comment { comment, username }

Users — /api/users

Method Endpoint Description
GET /api/users List all users
POST /api/users Register a new user

Domain Model

Book
├── id, title, author, pageCount
├── image, genre
├── available (boolean)
└── borrowedBy (username)

User
└── username, ...

Comment
└── text, username

Tech Stack

Layer Technology
Framework Spring Boot 3.3.0
Language Java 17
Build Maven
API style REST / JSON
Storage In-memory (no database required)

Quick Start

# 1. Clone
git clone https://github.com/salamon30/library-java.git
cd library-java/library-java-main

# 2. Build and run
./mvnw spring-boot:run
# → http://localhost:8080

Requires Java 17+ and Maven (or use the included mvnw wrapper).


Example Requests

# List all books
curl http://localhost:8080/api/books

# Borrow a book
curl -X POST http://localhost:8080/api/books \
  -H "Content-Type: application/json" \
  -d '{"bookId": "1", "username": "alice"}'

# Return a book
curl -X PUT http://localhost:8080/api/books/1/return

# Add a comment
curl -X POST http://localhost:8080/api/books/1/comments \
  -H "Content-Type: application/json" \
  -d '{"comment": "Great read!", "username": "alice"}'

Author

Recep Uzun — AI Master's Student @ Deggendorf Institute of Technology

LinkedIn GitHub