# gonzalosc95/talenthub architecture

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

- Interactive diagram: https://gitdiagram.com/gonzalosc95/talenthub
- Repository: https://github.com/gonzalosc95/talenthub

## Overview

##### Project type and purpose
- This is a full-stack web application (“TalentHub”) comprising:
- A client-side Angular frontend
- A RESTful backend implemented in Spring Boot (Java)
- A MySQL relational database
- Purpose: allow Companies to publish/manage job vacancies and Users to search/apply; admin role for higher-level CRUD.

##### File structure
- Top level:
- FrontEnd/TalentHub – Angular app
- BackEnd/TalentHub – Spring Boot service (controllers, services, repositories, entities, DTOs, mappers)
- Despliegue – compiled WAR for Tomcat
- Patterns:
- Layered MVC in backend (RestController → Service → Repository → Database)
- Angular component-module-service structure in frontend

##### README for insights
- REST endpoints use GET/POST/PUT/DELETE, returning HTTP 2xx/4xx codes
- Authentication can be plain HTTP headers or Spring Security + JWT
- Deployment via WAR on Tomcat behind Apache, secured with HTTPS/UFW; FTP service for file uploads

##### Main components and relationships
a. Components:
1. Client Browser (Angular SPA)
2. DNS / Load Balancer
3. Web Server (Apache HTTPD or Nginx, TLS termination)
4. Application Server (Tomcat embedded in Spring Boot)
5. Spring Boot REST API
– Controllers (REST layer)
– Services (business logic)
– Repositories (JPA data access)
6. MySQL 8 Database
7. Optional: FTP Server for file uploads
8. (Optional) External services: email SMTP, authentication provider (JWT issuer)
b. Interactions:
- Browser → DNS → Web Server (HTTPS) → Tomcat/Spring Boot
- Spring Controllers handle HTTP GET/POST/PUT/DELETE
- Controllers ↔ Services ↔ Repositories ↔ MySQL
- Responses: HTTP 200/201/400/401/404/500
- FTP for static file deployment or CV uploads
- (If enabled) JWT token issuance on login, sent in Authorization header

##### Architectural patterns and technologies
- Frontend: Angular modules, components, services, RxJS HTTPClient
- Backend: Spring Boot with Spring MVC, Spring Data JPA, DTO-Entity mappers (MapStruct or custom), Maven build
- Layered architecture ensures separation of concerns
- Database schema: tables for Empresa, Usuario, Vacante, Solicitud, Categoria, etc.
- Security: HTTPS, (optional) Spring Security + JWT or basic auth
- Deployment: WAR packaged by Maven, deployed on Tomcat, managed by Apache, firewall via UFW

##### Elements
- Database schema as inset showing key tables and relations
- Authentication as separate flow showing token issuance and usage
- Deployment nodes: Browser → DNS → Load Balancer → Web Server → Application Server → Database Server

##### Summary
- Break the system into: UI layer, API gateway/web server, business layer, data layer
- End-to-end flow from user action in Angular to persistence in MySQL
- Security, deployment, and external integrations
- Be as granular as useful (e.g., mapfew key controllers/services), but avoid clutter.

## Diagram (Mermaid)

```mermaid
graph TB
    %% UI Layer
    subgraph "UI Layer"
        Browser["Client Browser (Angular SPA)"]:::ui
        AngularComponents["Angular Components"]:::ui
        AngularPages["Angular Pages"]:::ui
        AngularServices["Angular HTTP Services"]:::ui
        AngularInterfaces["Angular Interfaces (DTOs)"]:::ui
        Routing["Routing & Configuration"]:::ui
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        DNS["DNS / Load Balancer"]:::infra
        WebServer["Web Server (Apache/Nginx)"]:::infra
        FTP["FTP Server (File Uploads)"]:::external
        SMTP["Email SMTP Service"]:::external
        JWTProvider["Auth Provider (JWT Issuer)"]:::external
        DatabaseServer["MySQL 8 Database"]:::db
    end

    %% Application Server Layer
    subgraph "Application Server"
        Tomcat["Tomcat (Spring Boot)"]:::app
        TalentHubApp["Spring Boot Application"]:::app
        ServletInit["Servlet Initializer"]:::app
        Controllers["REST Controllers"]:::app
        Services["Business Services"]:::app
        Repositories["JPA Repositories"]:::app
        Entities["Entities (Domain Models)"]:::app
        DTOs["DTOs (Payloads)"]:::app
        Mappers["DTO-Entity Mappers"]:::app
        Config["Spring Boot Properties"]:::app
    end

    %% Deployment Artifact
    WAR["Packaged WAR for Tomcat"]:::infra

    %% UI to Infra Flow
    Browser -->|"DNS Lookup"| DNS
    DNS -->|"HTTPS"| WebServer
    WebServer -->|"HTTPS"| Tomcat
    WebServer -->|"FTP"| FTP

    %% Angular interactions
    Browser -->|"HTTP/HTTPS"| WebServer
    AngularComponents --> Browser
    AngularPages --> Browser
    AngularServices --> Browser
    AngularInterfaces --> Browser
    Routing --> Browser

    %% App Server internals
    Tomcat --> TalentHubApp
    TalentHubApp --> ServletInit
    TalentHubApp --> Controllers
    Controllers --> Services
    Services --> Repositories
    Repositories -->|JDBC| DatabaseServer

    Controllers -->|uses| DTOs
    DTOs -->|mapped via| Mappers
    Mappers --> Entities
    Config --> TalentHubApp

    %% External integrations
    Controllers -->|"SMTP"| SMTP
    Controllers -->|"Auth Request"| JWTProvider

    %% Deployment artifact flow
    WAR --> Tomcat

    %% Click Events
    click Browser "https://github.com/gonzalosc95/talenthub/tree/main/FrontEnd/TalentHub"
    click AngularComponents "https://github.com/gonzalosc95/talenthub/tree/main/FrontEnd/TalentHub/src/app/components"
    click AngularPages "https://github.com/gonzalosc95/talenthub/tree/main/FrontEnd/TalentHub/src/app/pages"
    click AngularServices "https://github.com/gonzalosc95/talenthub/tree/main/FrontEnd/TalentHub/src/app/service"
    click AngularInterfaces "https://github.com/gonzalosc95/talenthub/tree/main/FrontEnd/TalentHub/src/app/interfaces"
    click Routing "https://github.com/gonzalosc95/talenthub/blob/main/FrontEnd/TalentHub/src/app/app.routes.ts"
    click Routing "https://github.com/gonzalosc95/talenthub/blob/main/FrontEnd/TalentHub/src/app/app.config.ts"
    click TalentHubApp "https://github.com/gonzalosc95/talenthub/blob/main/BackEnd/TalentHub/src/main/java/unir/reto/talenthub/TalentHubApplication.java"
    click ServletInit "https://github.com/gonzalosc95/talenthub/blob/main/BackEnd/TalentHub/src/main/java/unir/reto/talenthub/ServletInitializer.java"
    click Controllers "https://github.com/gonzalosc95/talenthub/tree/main/BackEnd/TalentHub/src/main/java/unir/reto/talenthub/restcontroller"
    click Services "https://github.com/gonzalosc95/talenthub/tree/main/BackEnd/TalentHub/src/main/java/unir/reto/talenthub/service"
    click Repositories "https://github.com/gonzalosc95/talenthub/tree/main/BackEnd/TalentHub/src/main/java/unir/reto/talenthub/repository"
    click Entities "https://github.com/gonzalosc95/talenthub/tree/main/BackEnd/TalentHub/src/main/java/unir/reto/talenthub/entity"
    click DTOs "https://github.com/gonzalosc95/talenthub/tree/main/BackEnd/TalentHub/src/main/java/unir/reto/talenthub/dto"
    click Mappers "https://github.com/gonzalosc95/talenthub/tree/main/BackEnd/TalentHub/src/main/java/unir/reto/talenthub/configuration"
    click Config "https://github.com/gonzalosc95/talenthub/blob/main/BackEnd/TalentHub/src/main/resources/application.properties"
    click DatabaseServer "https://github.com/gonzalosc95/talenthub/blob/main/Resources/Documentacion/vacantes_BBDD_2025_reto.sql"
    click WAR "https://github.com/gonzalosc95/talenthub/blob/main/Despliegue/TalentHub.war"

    %% Styles
    classDef ui fill:#D6EAF8,stroke:#3498DB,color:#154360
    classDef infra fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef app fill:#FAD7A0,stroke:#E67E22,color:#6E2C00
    classDef db fill:#D7BDE2,stroke:#8E44AD,color:#4A235A
    classDef external fill:#D5DBDB,stroke:#7F8C8D,color:#1C2833
```
