# jimwu666/job-portal-project architecture

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

- Interactive diagram: https://gitdiagram.com/jimwu666/job-portal-project
- Repository: https://github.com/jimwu666/job-portal-project

## Overview

##### Project Type and Purpose
- This is a full-stack web application: a job portal where recruiters post/manage jobs and job seekers search, save, and apply.
- Backend: Java Spring Boot (MVC pattern), Spring Security, Spring Data JPA, Thymeleaf.
- Frontend: HTML/CSS/JS static assets (Bootstrap-like styling, Summernote rich text editor).

##### Main Components
a. Client Layer
- Web Browser (or Mobile WebView)
- Interacts via HTTP/HTTPS
b. Presentation Layer (Frontend)
- Static Resources: CSS, JS (main.js, vendor, Summernote plugins)
- Templates: Thymeleaf HTML pages under `src/main/resources/templates`
c. Application Layer (Backend)
- Spring Boot App (`JobportalApplication`)
- Spring MVC DispatcherServlet → Controllers
– HomeController, JobPostActivityController, JobSeekerApplyController, etc.
- Spring Security Filter Chain
– WebSecurityConfig, CustomAuthenticationSuccessHandler
- Service Layer
– Business logic: JobPostActivityService, UsersService, etc.
- Data Access Layer
– Spring Data JPA Repositories
– Entities → Database tables
d. Persistence Layer
- Relational Database (MySQL/Postgres)
- Tables created via provided SQL scripts
e. File Storage
- Local file system (or blob storage) for profile photos, resumes
- Utility classes: FileUploadUtil, FileDownloadUtil
f. External/Third-Party
- (Optional) Email service for notifications
- (Optional) Cloud storage if used in production

##### Relationships and Data Flow
- Client → HTTP Request → Spring Security → DispatcherServlet
- DispatcherServlet → Chooses Controller (based on URL mapping)
- Controller → calls Service → calls Repository → queries DB
- Service returns data to Controller → Controller returns Model + View
- Thymeleaf renders View + Model → HTML → Client
- File uploads: Controller → FileUploadUtil writes to storage → DB records file path
- File downloads: Controller → FileDownloadUtil reads file → streams to client

##### Architectural Patterns & Design Principles
- Layered architecture: Presentation → Controller → Service → Repository → Database
- MVC (Model-View-Controller)
- Spring Security for authentication/authorization
- Dependency Injection / Inversion of Control
- Separation of concerns (e.g., CustomUserDetailsService handles user lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Browser["Web Browser"]:::client
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        StaticResources["Static Resources\n(CSS, JS)"]:::frontend
        Templates["Thymeleaf Templates"]:::frontend
    end

    %% Application Layer
    subgraph "Application Layer"
        App["JobportalApplication"]:::backend

        subgraph "Security Layer"
            SecurityConfig["WebSecurityConfig"]:::backend
            AuthHandler["CustomAuthenticationSuccessHandler"]:::backend
        end

        subgraph "MVC Controllers"
            Controllers["Controllers\n(HomeController, JobPostActivityController,\nJobSeekerApplyController, JobSeekerProfileController,\nJobSeekerSaveController, RecruiterProfileController,\nUsersController)"]:::backend
        end

        subgraph "Service Layer"
            Services["Services\n(CustomUserDetailsService, JobPostActivityService,\nJobSeekerApplyService, JobSeekerProfileService,\nJobSeekerSaveService, RecruiterProfileService,\nUsersService, UsersTypeService)"]:::backend
        end

        subgraph "Repository Layer"
            Repositories["Repositories\n(JobPostActivityRepository,\nJobSeekerApplyRepository, JobSeekerProfileRepository,\nJobSeekerSaveRepository, RecruiterProfileRepository,\nUsersRepository, UsersTypeRepository)"]:::backend
        end

        subgraph "Entities"
            Entities["Entities (JPA Models)"]:::backend
        end
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        Database["Relational Database\n(MySQL/Postgres)"]:::persistence
    end

    %% File Storage
    subgraph "File Storage"
        FileUtil["FileUploadUtil / FileDownloadUtil"]:::util
        Photos["photos (candidate/recruiter)"]:::util
    end

    %% Flow Arrows
    Browser -->|"HTTP/HTTPS"| StaticResources
    Browser -->|"HTTP/HTTPS"| Templates
    Browser -->|"HTTP Request"| App
    App -->|"Spring Security"| SecurityConfig
    SecurityConfig -->|"success handling"| AuthHandler
    SecurityConfig -->|"dispatch to"| Controllers
    Controllers -->|"calls"| Services
    Services -->|"uses"| Repositories
    Repositories -->|"queries"| Database
    Controllers -->|"render with"| Templates
    Controllers -->|"upload/download"| FileUtil
    FileUtil -->|"stores/reads"| Photos

    %% Click Events
    click StaticResources "https://github.com/jimwu666/job-portal-project/tree/main/src/main/resources/static"
    click Templates "https://github.com/jimwu666/job-portal-project/tree/main/src/main/resources/templates"
    click App "https://github.com/jimwu666/job-portal-project/blob/main/src/main/java/com/luv2code/jobportal/JobportalApplication.java"
    click Controllers "https://github.com/jimwu666/job-portal-project/tree/main/src/main/java/com/luv2code/jobportal/controller"
    click SecurityConfig "https://github.com/jimwu666/job-portal-project/blob/main/src/main/java/com/luv2code/jobportal/config/WebSecurityConfig.java"
    click AuthHandler "https://github.com/jimwu666/job-portal-project/blob/main/src/main/java/com/luv2code/jobportal/config/CustomAuthenticationSuccessHandler.java"
    click Services "https://github.com/jimwu666/job-portal-project/tree/main/src/main/java/com/luv2code/jobportal/services"
    click Repositories "https://github.com/jimwu666/job-portal-project/tree/main/src/main/java/com/luv2code/jobportal/repository"
    click Entities "https://github.com/jimwu666/job-portal-project/tree/main/src/main/java/com/luv2code/jobportal/entity"
    click FileUtil "https://github.com/jimwu666/job-portal-project/tree/main/src/main/java/com/luv2code/jobportal/util"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000
    classDef frontend fill:#90EE90,stroke:#000
    classDef backend fill:#FFA500,stroke:#000
    classDef persistence fill:#D3D3D3,stroke:#000
    classDef util fill:#D3D3D3,stroke:#000
```
