# santosh4568/librarymanagementsystem architecture

> Architecture diagram of the GitHub repository santosh4568/librarymanagementsystem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/santosh4568/librarymanagementsystem
- Repository: https://github.com/santosh4568/librarymanagementsystem

## Overview

##### Project Type and Purpose
- This is a full-stack web application called “Library Management System.”
- Frontend: React.js SPA with responsive UI and secure authentication.
- Backend: Spring Boot REST API with layered architecture.
- Database: MySQL for persistent storage of Users, Books, and BookIssued records.

##### File Structure
- Top-level:
- frontend/ → React code (components, API services, public assets).
- src/main/java/lms/spring/LibraryManagementSystem → Spring Boot application.
- src/main/resources/application.properties → DB and CORS settings.
- Backend layers:
- Controller (REST endpoints)
- Service (business logic)
- Repository (Spring Data JPA interfaces)
- Model (JPA entities: Book, User, BookIssued)
- Configuration (CORS setup)
- No microservices—single-module monolith.

##### README Insights
- Uses React + Bootstrap + Axios → calls REST endpoints.
- Spring Boot + Spring Data JPA → exposes CRUD and borrowing APIs.
- MySQL DB holds all data.
- Secure authentication is implemented (login/signup components and backend auth endpoints).
- Key features: user management, borrowing/return workflow, admin dashboard.

##### Additional Details
- Authentication flow: user login component → AuthContext → /api/auth/login → Controller → Service → DB → JWT token returned → stored in frontend context.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        SPAL["React SPA"]:::ui
        ReactApp["React App<br/>(localhost:3000)"]:::ui
        subgraph "UI Components"
            direction TB
            UI["React Components"]:::ui
        end
        subgraph "API Services"
            direction TB
            BS["BookService"]:::service
            BIS["BookIssuedService"]:::service
            US["UserService"]:::service
        end
        VC["Vite Config"]:::tool
    end

    SPAL --> ReactApp
    ReactApp --> UI
    ReactApp --> VC
    UI --> BS
    UI --> BIS
    UI --> US

    BS -->|"HTTP requests"| CORS
    BIS -->|"HTTP requests"| CORS
    US -->|"HTTP requests"| CORS

    %% CORS Boundary
    CORS["CORS Configuration"]:::config

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        App["Spring Boot Application"]:::backend
        subgraph "Controllers"
            direction TB
            BC["BookController"]:::controller
            BIC["BookIssuedController"]:::controller
            UC["UserController"]:::controller
        end
        subgraph "Services"
            direction TB
            BSS["BookService"]:::service
            BISS["BookIssuedService"]:::service
            USS["UserService"]:::service
        end
        subgraph "Repositories"
            direction TB
            BR["BookRepo"]:::repo
            BIR["BookIssuedRepo"]:::repo
            UR["UserRepo"]:::repo
        end
        subgraph "Models"
            direction TB
            MBook["Book"]:::model
            MBI["BookIssued"]:::model
            MU["User"]:::model
        end
        ConfigProps["application.properties"]:::config
        Tests["ApplicationTests"]:::test
    end

    CORS --> App
    App --> BC
    App --> BIC
    App --> UC

    BC --> BSS
    BIC --> BISS
    UC --> USS

    BSS --> BR
    BISS --> BIR
    USS --> UR

    BR <--> DB
    BIR <--> DB
    UR <--> DB

    %% Database
    DB["MySQL Database<br/>USERS, BOOKS, BOOK_ISSUED"]:::db

    %% Click Events
    click SPAL "https://github.com/santosh4568/librarymanagementsystem/tree/main/frontend/"
    click ReactApp "https://github.com/santosh4568/librarymanagementsystem/blob/main/frontend/src/main.jsx"
    click UI "https://github.com/santosh4568/librarymanagementsystem/tree/main/frontend/src/Components/"
    click BS "https://github.com/santosh4568/librarymanagementsystem/blob/main/frontend/src/API/BookService.jsx"
    click BIS "https://github.com/santosh4568/librarymanagementsystem/blob/main/frontend/src/API/BookIssuedService.jsx"
    click US "https://github.com/santosh4568/librarymanagementsystem/blob/main/frontend/src/API/UserService.jsx"
    click VC "https://github.com/santosh4568/librarymanagementsystem/blob/main/frontend/vite.config.js"
    click CORS "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Configuration/CorsConfiguration.java"
    click App "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Application.java"
    click BC "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Controller/BookController.java"
    click BIC "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Controller/BookIssuedController.java"
    click UC "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Controller/UserController.java"
    click BSS "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Service/BookService.java"
    click BISS "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Service/BookIssuedService.java"
    click USS "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Service/UserService.java"
    click BR "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Repository/BookRepo.java"
    click BIR "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Repository/BookIssuedRepo.java"
    click UR "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Repository/UserRepo.java"
    click MBook "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Model/Book.java"
    click MBI "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Model/BookIssued.java"
    click MU "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/java/lms/spring/LibraryManagementSystem/Model/User.java"
    click ConfigProps "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/main/resources/application.properties"
    click Tests "https://github.com/santosh4568/librarymanagementsystem/blob/main/src/test/java/lms/spring/LibraryManagementSystem/ApplicationTests.java"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#036,stroke-width:1px
    classDef service fill:#E2F7DF,stroke:#2E7D32,stroke-width:1px
    classDef backend fill:#C8E6C9,stroke:#1B5E20,stroke-width:1px
    classDef controller fill:#E8F5E9,stroke:#388E3C,stroke-width:1px
    classDef repo fill:#F1F8E9,stroke:#558B2F,stroke-width:1px
    classDef model fill:#FFF3E0,stroke:#EF6C00,stroke-width:1px
    classDef db fill:#FFE0B2,stroke:#E65100,stroke-width:1px,stroke-dasharray: 5 5
    classDef config fill:#F3E5F5,stroke:#6A1B9A,stroke-width:1px
    classDef test fill:#FCE4EC,stroke:#880E4F,stroke-width:1px
    classDef tool fill:#E3F2FD,stroke:#0277BD,stroke-width:1px
```
