# mans14team/library_management architecture

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

- Interactive diagram: https://gitdiagram.com/mans14team/library_management
- Repository: https://github.com/mans14team/library_management

## Overview

##### Project type and purpose
- LibMate is a monolithic, full-stack Java/Spring Boot web service for library management: book/catalog metadata, physical book copies, rental/return/reservation, study-room reservations, membership payments, reviews, bulletin board, real-time notifications, full-text search, and centralized logging.

##### File structure
- Top‐level: Dockerfile, docker-compose.yml, .ebextensions (Elastic Beanstalk), nginx/, .github/workflows (CI/CD), gradle wrappers.
- src/main/java/com/example/library_management: domain modules (auth, book, bookCopy, bookRental, bookReservation, board, room, reviews, membership, notifications, data ingestion, common utilities), global configs (Spring, JPA, Redis, RabbitMQ, Elasticsearch, security, OAuth2), scheduling, exception handling.
- src/main/resources: application.yml for dev/prod profiles.
- docker/: stack for elasticsearch, filebeat, logstash (ELK).
- backup/: CSV data for room reservations.
- Tests follow the same package structure.

##### README for additional insights
- Key features: concurrency control (optimistic lock + Redis distributed lock), real-time notifications (RabbitMQ), caching (Redis), full-text search (Elasticsearch), centralized logging (ELK), CI/CD (GitHub Actions → AWS Elastic Beanstalk), Dockerization, AWS services (RDS, ElastiCache, ECR).
- Infrastructure sketch shows Client → NGINX → Dockerized Spring Boot on EB → MySQL, Redis, Elasticsearch, RabbitMQ; Filebeat/Logstash → Elasticsearch for logs; GitHub Actions pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Layer"
        Web["Web App"]:::external
        Mobile["Mobile App"]:::external
    end

    subgraph "Edge & Load Balancer"
        NGINX["NGINX"]:::compute
        click NGINX "https://github.com/mans14team/library_management/tree/develop/nginx/Dockerfile"
        click NGINX "https://github.com/mans14team/library_management/blob/develop/nginx/nginx.conf"
    end

    subgraph "Application Layer"
        SB["Spring Boot App"]:::compute
        click SB "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/LibraryManagementApplication.java"

        subgraph "Domain Modules"
            Auth["Auth & OAuth2"]:::compute
            click Auth "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/auth/"
            click Auth "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/global/oauth/"
            click Auth "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/global/security/"
            Jwt["Jwt Util"]:::compute
            click Jwt "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/global/jwt/JwtUtil.java"

            BookServ["Book & Catalog Service"]:::compute
            click BookServ "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/book/"
            click BookServ "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/bookCopy/"
            click BookServ "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/bookReservation/"
            click BookServ "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/bookRental/"

            RoomMod["Study Room & Reservations"]:::compute
            click RoomMod "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/room/"
            click RoomMod "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/roomReserve/"
            SchedRoom["RoomReserve Scheduler"]:::compute
            click SchedRoom "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/domain/roomReserve/scheduler/RoomReserveCleanupScheduler.java"
            Backup["Backup CSV"]:::external
            click Backup "https://github.com/mans14team/library_management/blob/develop/backup/room_reserve_backup.csv"

            Board["Bulletin Board & Comments"]:::compute
            click Board "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/board/"
            click Board "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/boardComment/"

            Review["Reviews Module"]:::compute
            click Review "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/review/"

            Membership["Membership & Payment"]:::compute
            click Membership "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/membership/"

            DataIngest["Data Ingestion & Adapters"]:::compute
            click DataIngest "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/data/bookData/"
            click DataIngest "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/data/catagoryData/"
            click DataIngest "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/data/injectionBookData/"

            Notification["Notification & Messaging"]:::messaging
            click Notification "https://github.com/mans14team/library_management/tree/develop/src/main/java/com/example/library_management/domain/common/notification/"
            SchedNotif["Notification Scheduler"]:::compute
            click SchedNotif "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/domain/common/scheduler/NotificationScheduler.java"
            RabbitConfig["RabbitMQ Config"]:::messaging
            click RabbitConfig "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/global/config/RabbitMQConfig.java"
        end

        subgraph "Global Configurations"
            ESConfig["Elasticsearch Config"]:::datastore
            click ESConfig "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/global/config/ElasticsearchConfig.java"
            RedisConf["Redis Configs"]:::datastore
            click RedisConf "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/global/config/RedisConfig.java"
            click RedisConf "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/global/config/RedissonConfig.java"
            click RedisConf "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/global/config/RedisCacheConfig.java"
            PaymentConf["Payment Config"]:::external
            click PaymentConf "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/global/config/PaymentConfig.java"
            SecurityConf["Security Config"]:::compute
            click SecurityConf "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/global/config/SecurityConfig.java"
            WebMVC["Web MVC Config"]:::compute
            click WebMVC "https://github.com/mans14team/library_management/blob/develop/src/main/java/com/example/library_management/global/config/WebMvcConfig.java"
        end
    end

    subgraph "Data Layer"
        MySQL["MySQL RDS"]:::datastore
        Redis["Redis ElastiCache"]:::datastore
        ES["Elasticsearch Cluster"]:::datastore
    end

    subgraph "Messaging & Scheduling"
        Rabbit["RabbitMQ Broker"]:::messaging
        SchedulerApp["App Scheduler"]:::compute
    end

    subgraph "Logging Pipeline"
        Filebeat["Filebeat"]:::logging
        Logstash["Logstash"]:::logging
        ElasticsearchLogs["Elasticsearch (Logs)"]:::logging
        Kibana["Kibana"]:::logging
        click Filebeat "https://github.com/mans14team/library_management/blob/develop/docker/filebeat/filebeat.yml"
        click Logstash "https://github.com/mans14team/library_management/blob/develop/docker/logstash/config/logstash.yml"
        click Logstash "https://github.com/mans14team/library_management/blob/develop/docker/logstash/pipeline/logstash.conf"
        click ElasticsearchLogs "https://github.com/mans14team/library_management/blob/develop/docker/elasticsearch/books-settings.json"
    end

    subgraph "External Services"
        OAuth["OAuth2 Providers"]:::external
        PaymentAPI["Toss Payment API"]:::external
    end

    subgraph "CI/CD Pipeline"
        GH["GitHub Actions"]:::external
        ECR["ECR"]:::datastore
        EB["Elastic Beanstalk"]:::compute
        click GH "https://github.com/mans14team/library_management/blob/develop/.github/workflows/deploy.yml"
        click EB "https://github.com/mans14team/library_management/blob/develop/.elasticbeanstalk/config.yml"
    end

    Web -->|HTTP| NGINX
    Mobile -->|HTTP| NGINX
    NGINX -->|HTTP| SB

    SB -->|JDBC| MySQL
    SB -->|Redis| Redis
    SB -->|REST Client| ES
    SB -->|AMQP| Rabbit
    SB -->|OAuth2| OAuth
    SB -->|PaymentCall| PaymentAPI

    SchedRoom -->|writesCSV| Backup
    SchedNotif -->|publish| Rabbit

    SB -->|logs| Filebeat
    Filebeat -->|forward| Logstash
    Logstash -->|index| ElasticsearchLogs
    ElasticsearchLogs -->|visualize| Kibana

    Rabbit -->|queue| Notification
    Rabbit -->|queue| SchedulerApp

    GH -->|build| ECR
    ECR -->|deploy| EB
    EB -->|run| SB

    classDef compute fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef datastore fill:#D6F5D6,stroke:#333,stroke-width:1px
    classDef messaging fill:#FFE5B4,stroke:#333,stroke-width:1px
    classDef logging fill:#E6E6FA,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
