# evincere/mpd_concursos architecture

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

- Interactive diagram: https://gitdiagram.com/evincere/mpd_concursos
- Repository: https://github.com/evincere/mpd_concursos

## Overview

##### Main Components
– User Interface (e.g., Portal de Postulante, Panel Administrativo, Examenes, etc.)
– Core Services (authentication, concursos management, document handling, and notifications)
– Electron integration (for desktop build)
- Backend System: Represent the “concurso-backend” project running on Spring Boot. Within this, show:
– REST Controllers (e.g., AuthController, ContestController, DocumentController, NotificationController, etc.)
– Application/Service Layer (use cases, business logic for auth, inscription, exam, education, etc.)
– Domain Layer (entities, value objects, exceptions; e.g., User, Contest, Notification, Jwt, etc.)
– Infrastructure/Repository Layer (data persistence with MySQL, in-memory adapters, file/document storage, etc.)
– Security Components (JWT filters, security config, authentication provider)
- External & Supporting Components: Include the document storage (which may physically reside in a file system as indicated by the “document-storage-dev” folder), Docker (Dockerfile for backend and docker-compose.yml), and build tools (Maven and npm).

##### Relationships and Interactions
– Controllers ⇨ Application Services (use cases)
– Application Services ⇨ Domain/Model (business logic)
– Domain ⇨ Infrastructure (repositories for persistence in MySQL and document storage)
- That authentication is handled using JWT: both the frontend sends JWT tokens to secure endpoints, and backend security components (e.g., JwtTokenFilter) validate incoming tokens.
- Backend to the MySQL database (and possibly highlight the use of schema.sql and data.sql for initializing data).
- Integration of external concerns such as file/document storage (using the FileSystemDocumentStorageService) and external notifications.

##### Architectural Patterns and Design Principles
- Layered/MVC Architecture: The backend is organized into clear layers (REST Controllers, Application Services/Use Cases, Domain Models, Infrastructure adapters).
- Separation of Concerns: The division into modules (auth, contest, examination, document, education, inscription, etc.) shows a good modular design.
- Security by Design: Encompassing security configurations (using JWT, role-based checks, and cross-layer validations).
- Client–Server Communication: The Angular frontend communicates with the Spring Boot backend via RESTful endpoints.
- Optional Electron Wrapper: Highlight the Electron module in the frontend, which bundles the web app into a desktop application.

##### Relevant Technologies
- Backend: Spring Boot, Java 17, Maven, JWT, MySQL.
- Frontend: Angular, Material Design, SCSS, TypeScript, Electron.
- Deployment/DevOps: Docker (Dockerfile, docker-compose.yml), Maven Wrapper.
- Development Tools: Eclipse (as visible by .metadata files), VSCode configurations.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Frontend Subgraph
    subgraph "Frontend (Angular + Electron)"
        F1["Angular App"]:::frontend
        F2["User Interface (Portal, Admin, Exams)"]:::frontend
        F3["Core Services (Auth, Contest, Document, Notification)"]:::frontend
        F4["Electron Integration"]:::frontend
    end

    %% Backend Subgraph
    subgraph "Backend (Spring Boot)"
        B0["Spring Boot Application"]:::backend
        subgraph "Controllers"
            BC1["AuthController"]:::controller
            BC2["ContestController"]:::controller
            BC3["DocumentController"]:::controller
            BC4["NotificationController"]:::controller
        end
        B2["Application/Service Layer"]:::backend
        B3["Domain Layer"]:::backend
        B4["Infrastructure/Repository Layer"]:::backend
        subgraph "Security Components"
            S1["JwtTokenFilter"]:::security
            S2["SecurityConfig"]:::security
        end
    end

    %% Database and Document Storage
    DB["MySQL Database"]:::database
    DS["Document Storage"]:::doc

    %% Deployment & Build Subgraph
    subgraph "Deployment & Build"
        D1["Docker & Deployment"]:::deploy
        D2["Maven Build Files"]:::deploy
        D3["npm Build Files"]:::deploy
        DScr["MySQL Scripts"]:::deploy
    end

    %% Connections for Frontend
    F1 -->|"includes"| F2
    F1 -->|"includes"| F3
    F1 -->|"packagedBy"| F4
    F1 -->|"HTTP"| B0

    %% Backend internal flow
    B0 -->|"calls"| BC1
    B0 -->|"calls"| BC2
    B0 -->|"calls"| BC3
    B0 -->|"calls"| BC4
    BC1 -->|"calls"| B2
    BC2 -->|"calls"| B2
    BC3 -->|"calls"| B2
    BC4 -->|"calls"| B2
    B2 -->|"processes"| B3
    B3 -->|"invokes"| B4
    B4 -->|"persistsTo"| DB
    B4 -->|"storesDocs"| DS

    %% Security flow
    S1 ---|"validates"| BC1
    S1 ---|"validates"| BC2
    S1 ---|"validates"| BC3
    S1 ---|"validates"| BC4
    S2 ---|"configures"| B0

    %% Deployment & Build connections
    B0 -->|"Dockerize"| D1
    B0 -->|"builtWith"| D2
    F1 -->|"builtWith"| D3

    %% Click Events
    click F1 "https://github.com/evincere/mpd_concursos/tree/main/mpd-concursos-app-frontend"
    click F4 "https://github.com/evincere/mpd_concursos/tree/main/mpd-concursos-app-frontend/electron"
    click B0 "https://github.com/evincere/mpd_concursos/tree/main/concurso-backend"
    click BC1 "https://github.com/evincere/mpd_concursos/blob/main/concurso-backend/src/main/java/ar/gov/mpd/concursobackend/auth/infrastructure/controller/AuthController.java"
    click BC2 "https://github.com/evincere/mpd_concursos/blob/main/concurso-backend/src/main/java/ar/gov/mpd/concursobackend/contest/infrastructure/controller/ContestController.java"
    click BC3 "https://github.com/evincere/mpd_concursos/blob/main/concurso-backend/src/main/java/ar/gov/mpd/concursobackend/document/infrastructure/controller/DocumentController.java"
    click BC4 "https://github.com/evincere/mpd_concursos/blob/main/concurso-backend/src/main/java/ar/gov/mpd/concursobackend/notification/infrastructure/rest/controller/NotificationController.java"
    click S1 "https://github.com/evincere/mpd_concursos/blob/main/concurso-backend/src/main/java/ar/gov/mpd/concursobackend/auth/domain/jwt/JwtTokenFilter.java"
    click S2 "https://github.com/evincere/mpd_concursos/blob/main/concurso-backend/src/main/java/ar/gov/mpd/concursobackend/auth/infrastructure/config/SecurityConfig.java"
    click DS "https://github.com/evincere/mpd_concursos/tree/main/concurso-backend/document-storage-dev"
    click D1 "https://github.com/evincere/mpd_concursos/tree/main/concurso-backend/Dockerfile"
    click D2 "https://github.com/evincere/mpd_concursos/blob/main/concurso-backend/pom.xml"
    click D3 "https://github.com/evincere/mpd_concursos/blob/main/mpd-concursos-app-frontend/package.json"
    click DB "https://github.com/evincere/mpd_concursos/blob/main/concurso-backend/src/main/resources/schema.sql"
    click DScr "https://github.com/evincere/mpd_concursos/blob/main/mysql/init.sql"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef backend fill:#FCF3CF,stroke:#B7950B,stroke-width:2px;
    classDef controller fill:#D6EAF8,stroke:#2874A6,stroke-width:2px;
    classDef security fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
    classDef database fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef doc fill:#EBDEF0,stroke:#AF7AC5,stroke-width:2px;
    classDef deploy fill:#D5F5E3,stroke:#28B463,stroke-width:2px;
```
