Skip to content

TalhahTahir/library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Management System

This project is a comprehensive library management system that allows users to browse books, search for titles, and administrators to manage the book inventory through CRUD operations. Below you will find detailed documentation on how to set up, use, and contribute to this project.

Table of Contents

  1. Introduction
  2. Prerequisites
  3. Set up the database
  4. Database Schema
  5. Usage
  6. Contributing
  7. Copyright

Introduction

The Library Management System is a Spring Boot application designed to facilitate the management of books in a library. It includes functionalities for user browsing, book searching, and administrative tasks such as adding, updating, and deleting books.

Prerequisites

Dependencies

The project relies on the following major dependencies:

  • Spring Boot Starter Data JPA: For database access using Spring Data repositories
  • Spring Boot Starter Thymeleaf: Template engine for server-side HTML rendering
  • Spring Boot Starter Validation: For form validation
  • Spring Boot Starter Web: For building web applications with Spring MVC
  • Spring Boot Starter Security: For authentication and authorization
  • MySQL Connector: Database driver for MySQL
  • Lombok: For reducing boilerplate code
  • Springdoc OpenAPI: For API documentation (Swagger UI available at /swagger-ui.html)

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/library-management-system.git
  1. Navigate to the project directory:
cd library-management-system

Set up the database:

  • Create a MySQL database named library_db
  • Update the database connection details in application.properties file:
spring.datasource.url=jdbc:mysql://localhost:3306/library_db
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
  1. Build the project using Maven:
mvn clean install
  1. Run the application:
mvn spring-boot:run

or

java -jar target/library-0.0.1-SNAPSHOT.jar

Database Schema

The database schema includes the following main table:

books

Column Type Description
id BIGINT Primary key, auto-incremented
title VARCHAR(255) Book title (not null)
author VARCHAR(255) Book author (not null)
year VARCHAR(255) Publication year
catagory VARCHAR(255) Book category (not null)
file VARCHAR(255) URL to the book file (not null)
image VARCHAR(9000) URL to the book cover image
description VARCHAR(500) Book description

Hibernate automatically creates the schema when the application starts with spring.jpa.hibernate.ddl-auto=update.

Usage

User Interface

  1. Home Page:

  2. Access the system at http://localhost:8080/

  3. Choose between User and Admin login

  4. User Panel (accessible at /home):

  5. Browse all available books

  6. Search for books by title

  7. View book details including cover image, author, category, and description

  8. Access book files via the provided links

Admin Interface

Admin Panel (accessible at /AdminPanel):

  1. Login with credentials:

  2. Username: Talha

  3. Password: 42155

Book Management:

  1. View all books in the library
  2. Add new books with details (title, author, year, category, image URL, file URL, description)
  3. Update existing book information
  4. Delete books from the library
  5. Search for specific books by title

Security:

  1. The admin panel is protected with authentication
  2. CSRF protection is enabled for form submissions

Technical Architecture

Spring MVC Architecture:

  1. Controllers handle HTTP requests and responses
  2. Services contain business logic
  3. Repositories manage data access
  4. Thymeleaf templates render the views

Exception Handling:

  1. Global exception handler for consistent error responses
  2. Custom exceptions for specific error scenarios
  3. Validation error handling for form submissions

Security:

  1. Spring Security for authentication and authorization
  2. In-memory user details for admin access
  3. Protected endpoints for administrative functions

Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a new Pull Request.

Coding Standards

  • Follow Java coding conventions
  • Write unit tests for new features
  • Update documentation as needed

Copyright

© 2025 Talha Tahir. All rights reserved.

Released under the MIT License. See the LICENSE file.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors