Skip to main content

Library API Documentation

A modern REST API built with Spring Boot for managing library operations. Handle books, authors, users, and rentals with a secure, scalable backend.

Quick start

Get your library management system up and running in minutes

1

Clone and configure

Clone the repository and set up your PostgreSQL database connection.
git clone https://github.com/daudujohn/libraryapi-springboot.git
cd libraryapi-springboot
Configure your database in src/main/resources/application.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/librarydb
spring.datasource.username=your_username
spring.datasource.password=your_password
2

Build and run

Use Maven to build and start the application.
./mvnw spring-boot:run
The API will start on http://localhost:8080
3

Register a user

Create your first user account via the registration endpoint.
curl -X POST http://localhost:8080/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "securepassword",
    "name": "John Doe"
  }'
{
  "id": 1,
  "email": "[email protected]",
  "name": "John Doe"
}
4

Make your first API call

Authenticate and fetch the list of books using HTTP Basic Authentication.
curl -X GET http://localhost:8080/books \
  -u [email protected]:securepassword
See the API Reference for complete endpoint documentation.

Explore by resource

Navigate to the documentation for each API resource

Authentication

User registration and login with BCrypt encryption

Books

Manage your library’s book inventory with full CRUD operations

Authors

Track and organize authors in your collection

Users

Manage library members and their accounts

Rentals

Handle book checkouts and returns with automatic stock tracking

Data Models

Understand the core entities and relationships

Key features

Built with modern technologies and best practices

Secure Authentication

BCrypt password encryption and HTTP Basic authentication with Spring Security

PostgreSQL Database

Reliable data persistence with JPA and Hibernate ORM

RESTful Design

Standard HTTP methods and status codes for intuitive API interactions

Automatic Stock Management

Real-time inventory updates when books are rented or returned

Ready to get started?

Follow our quickstart guide to set up your library management system and make your first API call in under 5 minutes.

View Quickstart Guide