# shubhamdeasi719/hr-management-portal architecture

> Architecture diagram of the GitHub repository shubhamdeasi719/hr-management-portal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shubhamdeasi719/hr-management-portal
- Repository: https://github.com/shubhamdeasi719/hr-management-portal

## Overview

##### Project type and purpose
- This is a full-stack web application (“HR Management Portal”) built on Spring Boot with a Thymeleaf front end. It provides secured CRUD operations on employee records, OTP-based password reset, role-based access, file uploads, and runtime monitoring.

##### File structure
- Top level: Maven configuration (pom.xml, mvnw), README.
- src/main/java/com/hr:
- HrManagementPortalApplication.java (entry point)
- controller/ – Spring MVC controllers (REST or HTML endpoints)
- service/ – Business logic interfaces & implementations
- repository/ – Spring Data JPA interfaces for MySQL
- entity/ – JPA entity classes (Employee, Compose, CreatePost)
- security/ – Spring Security configuration
- aop/ – Aspects for logging/performance (Spring AOP)
- exception/ – Custom exceptions + global handler
- ServletInitializer (for servlet container)
- src/main/resources:
- application.properties (DB, mail settings)
- static/(css, js, images, file-uploads)
- templates/ – Thymeleaf HTML views
- src/test: JUnit + Mockito tests for controllers and services

##### README
- Confirms: Spring MVC + Thymeleaf front end, Spring Security (RBAC + OTP), Spring Data JPA + MySQL, Spring Actuator + AOP monitoring, file-upload for profile pics, JUnit tests.

##### Detail
- Component, including AOP advice, Actuator.
- Exception flow to GlobalExceptionHandler.
- Profile-picture upload path (client → Controller → filesystem or DB).
- Detail security roles flow (User → LoginController → SecurityConfig → Role checks).
- Don’t over-aggregate: show key classes or packages as grouped components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser/UI Layer
    subgraph "Browser / UI"
        Browser["Web Browser\n(HTML/CSS/JS)"]:::ui
        Static["Static Resources\n(css, js, images, uploads)"]:::static
        Templates["Thymeleaf Templates"]:::ui
    end

    %% Backend Services
    subgraph "Backend Services"
        %% Entry Point
        Entry["HrManagementPortalApplication"]:::entry
        Init["ServletInitializer"]:::entry

        %% Security Layer
        SecurityFilter["Spring Security Filter Chain"]:::security
        SecurityConfig["SecurityConfigurations"]:::security

        %% Controller Layer
        HrController["HrController\n(Employee & Dashboard)"]:::controller
        ForgotController["ForgotPasswordController"]:::controller

        %% Service Layer
        EmpService["EmployeeService\n(interface)"]:::service
        EmpServiceImpl["EmployeeServiceImpl"]:::service
        ComposeService["ComposeService\n(interface)"]:::service
        ComposeServiceImpl["ComposeServiceImpl"]:::service
        PostService["CreatePostService\n(interface)"]:::service
        PostServiceImpl["CreatePostServiceImpl"]:::service
        EmpDetailService["EmployeeDetailService"]:::service

        %% Data Access Layer
        EmpRepo["EmployeeRepository"]:::datalayer
        ComposeRepo["ComposeRepository"]:::datalayer
        PostRepo["CreatePostRepository"]:::datalayer

        %% Persistence Layer
        MySQL[(MySQL Database)]:::db

        %% AOP & Monitoring
        Aop["HrAop\n(Performance/Logging)"]:::aop
        Actuator["Spring Actuator Endpoints"]:::monitor

        %% Exception Handling
        NotFoundEx["EmployeeNotFoundException"]:::exception
        GlobalEx["GlobalExceptionHandler"]:::exception
    end

    %% External Services
    subgraph "External Services"
        SMTP["SMTP Email Server"]:::external
        FileStorage["File Storage"]:::external
    end

    %% Tests
    subgraph "Test Suites"
        AppTest["HrManagementPortalApplicationTests"]:::test
        ForgotTest["ForgotPasswordControllerTest"]:::test
        HrTest["HrControllerTest"]:::test
        EmpTest["EmployeeServiceTest"]:::test
        ComposeTest["ComposeServiceTest"]:::test
        PostTest["CreatePostServiceTest"]:::test
    end

    %% Connections
    Browser -->|"requests"| SecurityFilter
    Browser --> Static
    Browser --> Templates
    Static -->|"served by"| SecurityFilter

    SecurityFilter --> SecurityConfig
    SecurityFilter --> HrController
    SecurityFilter --> ForgotController

    HrController -->|"invoke"| EmpServiceImpl
    HrController -->|"invoke"| ComposeServiceImpl
    HrController -->|"invoke"| PostServiceImpl
    ForgotController -->|"invoke"| EmpServiceImpl
    ForgotController -->|"sends OTP via"| SMTP

    EmpServiceImpl -->|"implements"| EmpService
    ComposeServiceImpl -->|"implements"| ComposeService
    PostServiceImpl -->|"implements"| PostService

    EmpServiceImpl --> EmpRepo
    ComposeServiceImpl --> ComposeRepo
    PostServiceImpl --> PostRepo

    EmpRepo --> MySQL
    ComposeRepo --> MySQL
    PostRepo --> MySQL

    Entry --> Init
    Entry --> SecurityFilter

    EmpDetailService -->|"used by"| SecurityFilter

    Aop --> EmpServiceImpl
    Aop --> ComposeServiceImpl
    Aop --> PostServiceImpl

    Actuator -->|"exposes"| SecurityFilter
    Actuator -->|"exposes"| MySQL

    HrController --> GlobalEx
    ForgotController --> GlobalEx

    HrController -->|"uploads to"| FileStorage

    %% Test Connections
    AppTest --> Entry
    ForgotTest --> ForgotController
    HrTest --> HrController
    EmpTest --> EmpServiceImpl
    ComposeTest --> ComposeServiceImpl
    PostTest --> PostServiceImpl

    %% Click Events
    click Entry "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/HrManagementPortalApplication.java"
    click Init "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/ServletInitializer.java"
    click HrController "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/controller/HrController.java"
    click ForgotController "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/controller/ForgotPasswordController.java"
    click EmpService "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/service/EmployeeService.java"
    click EmpServiceImpl "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/service/EmployeeServiceImpl.java"
    click ComposeService "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/service/ComposeService.java"
    click ComposeServiceImpl "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/service/ComposeServiceImpl.java"
    click PostService "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/service/CreatePostService.java"
    click PostServiceImpl "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/service/CreatePostServiceImpl.java"
    click EmpDetailService "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/service/EmployeeDetailService.java"
    click EmpRepo "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/repository/EmployeeRepository.java"
    click ComposeRepo "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/repository/ComposeRepository.java"
    click PostRepo "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/repository/CreatePostRepository.java"
    click Aop "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/aop/HrAop.java"
    click SecurityConfig "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/security/SecurityConfigurations.java"
    click NotFoundEx "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/exception/EmployeeNotFoundException.java"
    click GlobalEx "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/java/com/hr/exception/GlobalExceptionHandler.java"
    click AppTest "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/test/java/com/hr/HrManagementPortalApplicationTests.java"
    click ForgotTest "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/test/java/com/hr/controller/ForgotPasswordControllerTest.java"
    click HrTest "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/test/java/com/hr/controller/HrControllerTest.java"
    click EmpTest "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/test/java/com/hr/service/EmployeeServiceTest.java"
    click ComposeTest "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/test/java/com/hr/service/ComposeServiceTest.java"
    click PostTest "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/test/java/com/hr/service/CreatePostServiceTest.java"
    click Static "https://github.com/shubhamdeasi719/hr-management-portal/tree/main/src/main/resources/static"
    click Templates "https://github.com/shubhamdeasi719/hr-management-portal/tree/main/src/main/resources/templates"
    click applicationProperties "https://github.com/shubhamdeasi719/hr-management-portal/blob/main/src/main/resources/application.properties"

    %% Styles
    classDef ui fill:#EEF,stroke:#333,stroke-width:1px
    classDef static fill:#DDD,stroke:#333,stroke-width:1px
    classDef entry fill:#BBF,stroke:#333
    classDef security fill:#FDD,stroke:#900
    classDef controller fill:#BDE,stroke:#005
    classDef service fill:#DFD,stroke:#090
    classDef datalayer fill:#DDF,stroke:#009
    classDef db fill:#ADA,stroke:#070,stroke-width:2px
    classDef aop fill:#FD8,stroke:#D70
    classDef monitor fill:#DDF,stroke:#079
    classDef exception fill:#FBE,stroke:#F00
    classDef external fill:#FAD,stroke:#E00
    classDef test fill:#EEE,stroke:#666
```
