# lapluu1196/ims-project architecture

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

- Interactive diagram: https://gitdiagram.com/lapluu1196/ims-project
- Repository: https://github.com/lapluu1196/ims-project

## Overview

##### Main Components
- Backend Application Server – Represent the Spring Boot application as the core of the architecture.
- REST API Layer – Indicate the API endpoints which are served by various controllers (e.g., global controllers, auth controllers, candidate controllers, interview schedule controllers, job controllers, offer controllers, user controllers).
- Service Layer – Show the business logic handled by services and their implementations (e.g., CandidateService, JobService, UserService, InterviewScheduleService, etc.).
- Data Access Layer – Represent the repository classes interfacing with entities (e.g., CandidateRepository, InterviewScheduleRepository, and others).
- Domain Model – Outline key entities such as Candidate, InterviewSchedule, Job, Offer, User, etc.
- Security/Authentication Module – Highlight JWT configuration and related classes (JwtConfig, JwtAuthenticationFilter, RefreshTokenService) that manage authentication and authorization.
- Configuration & Exception Handling – Include components for application-wide configurations (SecurityConfig, OpenApiConfig, RedisConfig, CustomErrorPageConfig) and exception handling (GlobalExceptionHandler, custom exception classes).
- API Documentation – Indicate the integration of Swagger for API documentation.
- Containerization & Deployment – Show the containerization aspect via the Dockerfile and docker-compose, as well as the deployment target (Azure VPS).

##### Relationships and Interactions
- The Security Module should be depicted as a cross-cutting concern intercepting incoming requests and handling JWT-based authentication.
- Interactions between configuration components and the core modules; for instance, Swagger/OpenAPI configurations that automatically generate API docs and error-handling configurations that redirect to appropriate error pages.

##### Architectural Patterns and Design Principles
- Separation of concerns: distinct modules for authentication, error handling, and business logic.
- How DTOs (Data Transfer Objects) are used to transfer data, which promotes loose coupling between controllers and the domain model.

##### Technologies and Their Roles
- Spring Boot – The foundation framework for building the REST API.
- JWT – Securing API endpoints for authentication.
- Swagger – Providing interactive API documentation.
- Docker & docker-compose – Containerizing the application to simplify deployment on an Azure VPS.
- Maven – For building and managing dependencies.

##### Final Touches
- To include external integrations such as Swagger (accessible via a defined URL) and the API’s interaction points, emphasizing scalability and security features.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External and Backend Application
    subgraph "External & Entry"
        Client("External API Client"):::client
    end
    subgraph "Backend Application"
        App("Spring Boot Application Server"):::backend
    end
    Client -->|"HTTP_Request"| App

    %% REST API Layer - Controllers
    subgraph "Presentation Layer (Controllers)"
        C_Global("Global Controller"):::controller
        C_Auth("Auth Controller"):::controller
        C_Candidate("Candidate Controller"):::controller
        C_Interview("InterviewSchedule Controller"):::controller
        C_Job("Job Controller"):::controller
        C_Offer("Offer Controller"):::controller
        C_User("User Controller"):::controller
    end
    App --> C_Global
    App --> C_Auth
    App --> C_Candidate
    App --> C_Interview
    App --> C_Job
    App --> C_Offer
    App --> C_User

    %% Business Layer - Services
    subgraph "Business Layer (Services)"
        S_Candidate("CandidateService"):::service
        S_Job("JobService"):::service
        S_User("UserService"):::service
        S_Interview("InterviewScheduleService"):::service
        S_Refresh("RefreshTokenService"):::service
    end
    C_Candidate -->|"calls"| S_Candidate
    C_Job -->|"calls"| S_Job
    C_User -->|"calls"| S_User
    C_Interview -->|"calls"| S_Interview
    C_Auth -->|"calls"| S_Refresh

    %% Data Access Layer - Repositories
    subgraph "Data Access Layer (Repositories)"
        R_Candidate("CandidateRepository"):::repository
        R_Interview("InterviewScheduleRepository"):::repository
        R_Job("JobRepository"):::repository
        R_Offer("OfferRepository"):::repository
    end
    S_Candidate -->|"queries"| R_Candidate
    S_Interview -->|"queries"| R_Interview
    S_Job -->|"queries"| R_Job
    S_User -->|"queries"| R_Offer

    %% Domain Model - Entities
    subgraph "Domain Model (Entities)"
        E_Candidate("Candidate"):::entity
        E_Interview("InterviewSchedule"):::entity
        E_Job("Job"):::entity
        E_Offer("Offer"):::entity
        E_User("User"):::entity
    end
    R_Candidate -->|"maps_to"| E_Candidate
    R_Interview -->|"maps_to"| E_Interview
    R_Job -->|"maps_to"| E_Job
    R_Offer -->|"maps_to"| E_Offer

    %% Security and Configuration Components
    subgraph "Security & Configurations"
        Sec_Config("JWT Configuration"):::security
        Sec_Filter("JWT Authentication Filter"):::security
        Conf("SecurityConfig,OpenApiConfig,RedisConfig,CustomErrorPageConfig"):::config
        ExHandler("GlobalExceptionHandler"):::exception
    end
    App ---|"secures"| Sec_Config
    App ---|"secures"| Sec_Filter
    App ---|"uses"| Conf
    App ---|"handles_errors"| ExHandler

    %% API Documentation (Swagger)
    APIDocs("API Documentation (Swagger)"):::apiDocs
    App ---|"generates_docs"| APIDocs

    %% DTOs
    DTOs("DTOs"):::dto
    App ---|"uses_DTOs"| DTOs

    %% Infrastructure and Deployment
    subgraph "Infrastructure"
        Dockerfile("Dockerfile"):::infra
        DockerCompose("docker-compose.yml"):::infra
        Maven("Maven Build Pipeline"):::infra
        Azure("Azure VPS Deployment"):::infra
    end
    App ---|"containerized_by"| Dockerfile
    App ---|"containerized_by"| DockerCompose
    App ---|"built_by"| Maven
    App ---|"deployed_on"| Azure

    %% Click Events
    click App "https://github.com/lapluu1196/ims-project/blob/master/src/main/java/com/dinhlap/ims/ImsApplication.java"
    click C_Global "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/controllers"
    click C_Auth "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/controllers"
    click C_Candidate "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/controllers"
    click C_Interview "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/controllers"
    click C_Job "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/controllers"
    click C_Offer "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/controllers"
    click C_User "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/controllers"
    click S_Candidate "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/services"
    click S_Job "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/services"
    click S_User "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/services"
    click S_Interview "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/services"
    click S_Refresh "https://github.com/lapluu1196/ims-project/blob/master/src/main/java/com/dinhlap/ims/services/RefreshTokenService.java"
    click R_Candidate "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/repositories"
    click R_Interview "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/repositories"
    click R_Job "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/repositories"
    click R_Offer "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/repositories"
    click E_Candidate "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/entities"
    click E_Interview "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/entities"
    click E_Job "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/entities"
    click E_Offer "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/entities"
    click E_User "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/entities"
    click Sec_Config "https://github.com/lapluu1196/ims-project/blob/master/src/main/java/com/dinhlap/ims/configs/JwtConfig.java"
    click Sec_Filter "https://github.com/lapluu1196/ims-project/blob/master/src/main/java/com/dinhlap/ims/securities/JwtAuthenticationFilter.java"
    click Conf "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/configs"
    click ExHandler "https://github.com/lapluu1196/ims-project/blob/master/src/main/java/com/dinhlap/ims/exceptions/GlobalExceptionHandler.java"
    click APIDocs "https://github.com/lapluu1196/ims-project/blob/master/src/main/java/com/dinhlap/ims/configs/OpenApiConfig.java"
    click DTOs "https://github.com/lapluu1196/ims-project/tree/master/src/main/java/com/dinhlap/ims/dtos"
    click Dockerfile "https://github.com/lapluu1196/ims-project/tree/master/Dockerfile"
    click DockerCompose "https://github.com/lapluu1196/ims-project/blob/master/docker-compose.yml"

    %% Styles
    classDef backend fill:#FFCCCB,stroke:#333,stroke-width:2px;
    classDef controller fill:#B0E0E6,stroke:#333,stroke-width:2px;
    classDef service fill:#98FB98,stroke:#333,stroke-width:2px;
    classDef repository fill:#FFE4B5,stroke:#333,stroke-width:2px;
    classDef entity fill:#FFDAB9,stroke:#333,stroke-width:2px;
    classDef security fill:#F5DEB3,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;
    classDef config fill:#E6E6FA,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;
    classDef exception fill:#FFB6C1,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;
    classDef client fill:#AFEEEE,stroke:#333,stroke-width:2px;
    classDef apiDocs fill:#FFFACD,stroke:#333,stroke-width:2px;
    classDef dto fill:#D8BFD8,stroke:#333,stroke-width:2px;
    classDef infra fill:#F0E68C,stroke:#333,stroke-width:2px;
```
