# jonathnawill/desafio-pacto-vaga-back architecture

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

- Interactive diagram: https://gitdiagram.com/jonathnawill/desafio-pacto-vaga-back
- Repository: https://github.com/jonathnawill/desafio-pacto-vaga-back

## Overview

##### Project Type and Purpose
- This is a monolithic Spring Boot back-end application that serves as the API layer for an internal recruitment system.
- It exposes REST endpoints for user authentication (JWT), job vacancy management, candidate applications, skills management, and user management.
- Although there is a front-end (Angular) referenced in the README, the provided file tree only contains the back-end.

##### File Structure and Architectural Layers
- **Top-level artifacts:**
- pom.xml – Maven build and dependency management
- mvnw/mvnw.cmd – Maven wrapper scripts
- src/main/java/com/desafio/pacto – application code
- src/main/resources – environment-specific and default properties
- src/test – unit/integration tests
- **Layered organization under src/main/java:**
- config – Spring Security, CORS, filters, entry points
- controller – REST controllers mapping HTTP requests to service calls
- services & services/impl – business logic interfaces and implementations
- repositories – Spring Data JPA interfaces for DB access
- entities (+dto, enums, converters, listeners) – domain models and data-transfer objects
- util/parser – mapping between entities and DTOs
- **Key cross-cutting concerns:**
- Security (JWT token filter, entry point, WebConfig for CORS)
- Exception handling through Spring mechanisms (not shown but implied)
- Environment profiles (application-dev.properties, application-prod.properties)

##### Insights from README
- Functionality includes: JWT authentication, role-based authorization (Admin, User), CRUD on vacancies, user candidacies, candidate dashboard, evaluation features.
- Front-end is an Angular application served separately (http://localhost:4200) that consumes this API at /api/** endpoints.
- Database is external (production on Railway) but modeled with Spring Data JPA.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Angular App UI"
        UI["Angular App (http://localhost:4200)"]:::ui
    end

    subgraph "Spring Boot API (8080)"
        entry["PactoApplication"]:::entrypoint

        subgraph "Security Layer"
            authEntry["AuthEntryPointJwt"]:::security
            secFilter["SecurityFilter"]:::security
            secConfig["SecurityConfig"]:::security
            webConfig["WebConfig"]:::security
        end

        subgraph "Controller Layer"
            authCtrl["AuthController"]:::controller
            jobCtrl["JobVancacyController"]:::controller
            candCtrl["CandidacyController"]:::controller
            skillCtrl["SkillController"]:::controller
            userCtrl["UserController"]:::controller
        end

        subgraph "Service Layer"
            as["AuthenticationService"]:::service
            auImpl["AuthenticationServiceImpl"]:::service
            us["UserService"]:::service
            usImpl["UserServiceImpl"]:::service
            js["JobVacancyService"]:::service
            jsImpl["JobVancacyServiceImpl"]:::service
            cs["CandidacyService"]:::service
            csImpl["CandidacyServiceImpl"]:::service
            ss["SkillService"]:::service
            ssImpl["SkillServiceImpl"]:::service
            ts["TokenService"]:::service
            cud["CustomUserDetailsServiceImpl"]:::service
        end

        subgraph "Repository Layer"
            ur["UserRepository"]:::repo
            jr["JobVacancyRepository"]:::repo
            cr["CandidacyRepository"]:::repo
            sr["SkillRepository"]:::repo
        end

        subgraph "Domain Models & DTOs"
            ents["Entities & DTOs"]:::model
        end

        subgraph "Parser Utilities"
            up["UserParser"]:::parser
            jp["JobVacancyParser"]:::parser
            cp["CandidacyParser"]:::parser
            sp["SkillParser"]:::parser
        end

        DB["Database"]:::db

        entry --> SecurityInit["Initialize Security"]
        SecurityInit --> authEntry
        SecurityInit --> secFilter
        SecurityInit --> secConfig
        SecurityInit --> webConfig

        UI -->|"/auth/login"| authCtrl
        authCtrl --> as
        as --> ts
        ts --> authCtrl

        UI -->|secured calls| jobCtrl
        UI -->|secured calls| candCtrl
        UI -->|secured calls| skillCtrl
        UI -->|secured calls| userCtrl

        authEntry --> authCtrl
        secFilter --> authCtrl
        webConfig --> authCtrl

        jobCtrl --> js
        candCtrl --> cs
        skillCtrl --> ss
        userCtrl --> us

        js --> jr
        cs --> cr
        ss --> sr
        us --> ur

        jr --> DB
        cr --> DB
        sr --> DB
        ur --> DB

        ents --> jr
        ents --> ur
        ents --> sr
        ents --> cr

        up --> us
        jp --> js
        cp --> cs
        sp --> ss
    end

    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef entrypoint fill:#f0f8ff,stroke:#000
    classDef security fill:#ffe4b5,stroke:#d2691e
    classDef controller fill:#fafad2,stroke:#000
    classDef service fill:#98fb98,stroke:#008000
    classDef repo fill:#ffa07a,stroke:#ff4500
    classDef model fill:#e6e6fa,stroke:#9370db
    classDef parser fill:#d3d3d3,stroke:#696969
    classDef db fill:#dcdcdc,stroke:#808080

    click entry "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/PactoApplication.java"
    click authEntry "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/config/AuthEntryPointJwt.java"
    click secConfig "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/config/SecurityConfig.java"
    click secFilter "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/config/SecurityFilter.java"
    click webConfig "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/config/WebConfig.java"
    click authCtrl "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/controller/AuthController.java"
    click jobCtrl "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/controller/JobVancacyController.java"
    click candCtrl "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/controller/CandidacyController.java"
    click skillCtrl "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/controller/SkillController.java"
    click userCtrl "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/controller/UserController.java"
    click as "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/AuthenticationService.java"
    click auImpl "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/impl/AuthenticationServiceImpl.java"
    click us "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/UserService.java"
    click usImpl "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/impl/UserServiceImpl.java"
    click js "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/JobVacancyService.java"
    click jsImpl "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/impl/JobVancacyServiceImpl.java"
    click cs "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/CandidacyService.java"
    click csImpl "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/impl/CandidacyServiceImpl.java"
    click ss "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/SkillService.java"
    click ssImpl "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/impl/SkillServiceImpl.java"
    click ts "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/TokenService.java"
    click cud "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/services/CustomUserDetailsServiceImpl.java"
    click ur "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/repositories/UserRepository.java"
    click jr "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/repositories/JobVacancyRepository.java"
    click cr "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/repositories/CandidacyRepository.java"
    click sr "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/repositories/SkillRepository.java"
    click up "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/util/parser/UserParser.java"
    click jp "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/util/parser/JobVacancyParser.java"
    click cp "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/util/parser/CandidacyParser.java"
    click sp "https://github.com/jonathnawill/desafio-pacto-vaga-back/blob/main/src/main/java/com/desafio/pacto/util/parser/SkillParser.java"
```
