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.
| 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 } |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/users |
List all users |
POST |
/api/users |
Register a new user |
Book
├── id, title, author, pageCount
├── image, genre
├── available (boolean)
└── borrowedBy (username)
User
└── username, ...
Comment
└── text, username
| Layer | Technology |
|---|---|
| Framework | Spring Boot 3.3.0 |
| Language | Java 17 |
| Build | Maven |
| API style | REST / JSON |
| Storage | In-memory (no database required) |
# 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:8080Requires Java 17+ and Maven (or use the included mvnw wrapper).
# 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"}'Recep Uzun — AI Master's Student @ Deggendorf Institute of Technology