Skip to content

About

A full-stack Library Management System built with React.js, Spring Boot Microservices, REST APIs, JPA/Hibernate, and PostgreSQL.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Library Management System

A simple full-stack Library Management System built using React.js, Spring Boot Microservices, REST APIs, JPA/Hibernate, and PostgreSQL.

The application is designed using a microservices architecture with two independent backend services:

  • Book Microservice β€” manages books
  • Member Microservice β€” manages library members

The React frontend communicates with both microservices using REST APIs and Axios.


πŸš€ Project Overview

The Library Management System provides a simple interface to manage books and library members.

Main Features

  • πŸ“š Book Management
  • πŸ‘€ Member Management
  • βž• Add books and members
  • πŸ“‹ View books and members
  • ✏️ Update books and members
  • πŸ—‘οΈ Delete books and members
  • πŸ” Get records by ID
  • πŸ”„ REST API communication
  • πŸ—„οΈ PostgreSQL database
  • 🧩 Microservices architecture
  • βš›οΈ React.js frontend

πŸ—οΈ Architecture

                         React.js Frontend
                              β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚                   β”‚
                    β–Ό                   β–Ό
             Book REST API        Member REST API
               Port 8081             Port 8082
                    β”‚                   β”‚
                    β–Ό                   β–Ό
            Book Microservice   Member Microservice
                    β”‚                   β”‚
              Controller            Controller
                    β”‚                   β”‚
                 Service              Service
                    β”‚                   β”‚
               Repository           Repository
                    β”‚                   β”‚
                    β–Ό                   β–Ό
             PostgreSQL           PostgreSQL
             book database       member database

πŸ› οΈ Technology Stack

Frontend

  • React.js
  • Vite
  • JavaScript
  • React Router DOM
  • Axios
  • HTML5
  • CSS3

Backend

  • Java 21
  • Spring Boot
  • Spring Web
  • Spring Data JPA
  • Hibernate
  • Maven
  • REST APIs

Database

  • PostgreSQL 17

Development Tools

  • Visual Studio Code
  • Postman
  • Git
  • GitHub

πŸ“ Project Structure

library-management-system/
β”‚
β”œβ”€β”€ frontend/
β”‚   └── library-frontend/
β”‚       β”œβ”€β”€ public/
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ pages/
β”‚       β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ Books.jsx
β”‚       β”‚   β”‚   └── Members.jsx
β”‚       β”‚   β”œβ”€β”€ services/
β”‚       β”‚   β”‚   β”œβ”€β”€ bookService.js
β”‚       β”‚   β”‚   └── memberService.js
β”‚       β”‚   β”œβ”€β”€ App.jsx
β”‚       β”‚   β”œβ”€β”€ main.jsx
β”‚       β”‚   └── index.css
β”‚       β”œβ”€β”€ package.json
β”‚       └── vite.config.js
β”‚
β”œβ”€β”€ book-service/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”œβ”€β”€ java/com/library/book/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ controller/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ repository/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ entity/
β”‚   β”‚   β”‚   β”‚   └── exception/
β”‚   β”‚   β”‚   └── resources/
β”‚   β”‚   β”‚       └── application.properties
β”‚   β”‚   └── test/
β”‚   └── pom.xml
β”‚
β”œβ”€β”€ member-service/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”œβ”€β”€ java/com/library/member/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ controller/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ repository/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ entity/
β”‚   β”‚   β”‚   β”‚   └── exception/
β”‚   β”‚   β”‚   └── resources/
β”‚   β”‚   β”‚       └── application.properties
β”‚   β”‚   └── test/
β”‚   └── pom.xml
β”‚
β”œβ”€β”€ README.md
└── .gitignore

πŸ“š Book Microservice

The Book Microservice is responsible for managing library books.

Book Fields

id
title
author
isbn
available

Book API

Method Endpoint Description
POST /api/books Create a book
GET /api/books Get all books
GET /api/books/{id} Get book by ID
PUT /api/books/{id} Update a book
DELETE /api/books/{id} Delete a book

Book Service

Port: 8081
Base URL: http://localhost:8081/api/books
Database: library_book_db

πŸ‘€ Member Microservice

The Member Microservice is responsible for managing library members.

Member Fields

id
name
email
phone

Member API

Method Endpoint Description
POST /api/members Create a member
GET /api/members Get all members
GET /api/members/{id} Get member by ID
PUT /api/members/{id} Update a member
DELETE /api/members/{id} Delete a member

Member Service

Port: 8082
Base URL: http://localhost:8082/api/members
Database: library_member_db

πŸ”„ Request Flow

Book Request

React.js
   ↓
Axios
   ↓
Book REST API
   ↓
BookController
   ↓
BookService
   ↓
BookRepository
   ↓
PostgreSQL

Member Request

React.js
   ↓
Axios
   ↓
Member REST API
   ↓
MemberController
   ↓
MemberService
   ↓
MemberRepository
   ↓
PostgreSQL

πŸ—„οΈ Database Configuration

Two PostgreSQL databases are used.

Book Database

Database Name: library_book_db
Port: 5432

Member Database

Database Name: library_member_db
Port: 5432

The database tables are automatically created/updated by JPA/Hibernate during application startup.


πŸ’» Prerequisites

Make sure the following are installed:

Java 21
Node.js
npm
Maven
PostgreSQL 17
Git

You can verify the installations:

java -version
node -v
npm -v
mvn -version
psql --version
git --version

βš™οΈ Setup Instructions

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/library-management-system.git

Move into the project:

cd library-management-system

2. Create PostgreSQL Databases

Open PostgreSQL:

psql -U postgres

Create the Book database:

CREATE DATABASE library_book_db;

Create the Member database:

CREATE DATABASE library_member_db;

Exit PostgreSQL:

\q

3. Configure Book Service

Open:

book-service/src/main/resources/application.properties

Configure your PostgreSQL connection.

Example:

spring.application.name=book-service

server.port=8081

spring.datasource.url=jdbc:postgresql://localhost:5432/library_book_db
spring.datasource.username=postgres
spring.datasource.password=${DB_PASSWORD}

spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true

4. Configure Member Service

Open:

member-service/src/main/resources/application.properties

Example:

spring.application.name=member-service

server.port=8082

spring.datasource.url=jdbc:postgresql://localhost:5432/library_member_db
spring.datasource.username=postgres
spring.datasource.password=${DB_PASSWORD}

spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true

Never commit your real PostgreSQL password to GitHub.


▢️ Running the Application

The project contains three applications.

Terminal 1 β€” Book Microservice

cd book-service
mvn spring-boot:run

Runs on:

http://localhost:8081

Terminal 2 β€” Member Microservice

cd member-service
mvn spring-boot:run

Runs on:

http://localhost:8082

Terminal 3 β€” React Frontend

cd frontend/library-frontend
npm install
npm run dev

The frontend normally runs on:

http://localhost:5173

πŸ§ͺ API Testing

The REST APIs were tested using Postman.

Book APIs

POST   http://localhost:8081/api/books
GET    http://localhost:8081/api/books
GET    http://localhost:8081/api/books/{id}
PUT    http://localhost:8081/api/books/{id}
DELETE http://localhost:8081/api/books/{id}

Member APIs

POST   http://localhost:8082/api/members
GET    http://localhost:8082/api/members
GET    http://localhost:8082/api/members/{id}
PUT    http://localhost:8082/api/members/{id}
DELETE http://localhost:8082/api/members/{id}

πŸ–₯️ Frontend Pages

Home

Provides navigation to:

  • Books
  • Members

Books

Provides:

  • View books
  • Add books
  • Edit books
  • Delete books

Members

Provides:

  • View members
  • Add members
  • Edit members
  • Delete members

πŸ” Security Note

This project is currently designed as a simple learning and portfolio project.

Authentication and authorization are not included.

Future enhancements can include:

  • Spring Security
  • JWT Authentication
  • Role-based authorization

πŸš€ Future Enhancements

Possible future improvements:

  • Spring Cloud API Gateway
  • Service Discovery with Eureka
  • Docker
  • Docker Compose
  • Kafka
  • Redis
  • JWT Authentication
  • Role-based access control
  • Book borrowing and returning
  • Due-date management
  • Search and filtering
  • Pagination
  • Unit testing with JUnit and Mockito
  • Integration testing
  • CI/CD with GitHub Actions
  • AWS deployment

🎯 Learning Objectives

This project demonstrates practical understanding of:

  • Java 21
  • Spring Boot
  • REST API development
  • Spring Data JPA
  • Hibernate
  • PostgreSQL
  • Microservices architecture
  • React.js
  • Axios
  • React Router
  • CRUD operations
  • Frontend-backend integration
  • Maven
  • Git and GitHub
  • API testing with Postman

πŸ‘¨β€πŸ’» Author

Manikandan S

Java Full Stack Developer | Spring Boot | Microservices | React.js


πŸ“„ License

This project is created for learning, portfolio, and demonstration purposes.

About

A full-stack Library Management System built with React.js, Spring Boot Microservices, REST APIs, JPA/Hibernate, and PostgreSQL.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages