# luanvarg/reto-kruger-vaccination-inventory architecture

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

- Interactive diagram: https://gitdiagram.com/luanvarg/reto-kruger-vaccination-inventory
- Repository: https://github.com/luanvarg/reto-kruger-vaccination-inventory

## Overview

##### Project’s Main Components
- Application Entry Point: VaccinationInventoryApplication.java, which boots up the Spring Boot application.
- Controllers: Under the “controller” package (e.g., EmployeeController.java) that expose endpoints for operations such as registering, updating, deleting, and fetching employee data.
- Entities: In the “entity” package (e.g., EmployeeEntity.java) representing the data model that maps to database tables.
- Repositories: In the “repository” package (e.g., EmployeeRepository.java) for data access and persistence logic.
- Services: In the “service” and “service/impl” packages (e.g., EmployeeService and EmployeeServiceImpl) that contain the business logic.
- Security: Under the “security” package (e.g., BasicAuthWebSecurityConfiguration.java) configuring basic HTTP authentication.
- Data Model Documentation: Referenced in the DataModel directory, which visually represents the database schema.
- External Components: PostgreSQL database deployed on GCP (with connection details provided in the README) and Swagger UI for API documentation.

##### Relationships and Interactions
- HTTP Client (or Swagger UI) → Controller: API calls are received by the controllers.
- Controller → Service: Controllers delegate requests to the Service layer to process business logic.
- Service → Repository: The Service layer calls Repository methods to interact with the PostgreSQL database.
- Database: The PostgreSQL database holds the persistent data.
- Security: All incoming HTTP requests are filtered and authenticated via the BasicAuthWebSecurityConfiguration.
- Maven and Build Tools: While not a runtime architectural element, the pom.xml and Maven Wrapper components indicate project configuration and dependency management.

##### Architectural Patterns and Design Principles
- Layered (n-tier) Architecture: The project is clearly separated into distinct layers (Controller, Service, Repository, Entity).
- RESTful API Design: Controllers expose HTTP endpoints following standard REST conventions.
- Security by Configuration: Basic HTTP authentication is configured centrally, ensuring that endpoints are protected.
- Dependency Injection: Spring Boot manages beans and wiring between controllers, services, repositories, and security components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Subgraphs
    subgraph "Startup"
        A1["VaccinationInventoryApplication"]
    end

    subgraph "Security Layer"
        S1["Basic Auth Security Configuration"]
    end

    subgraph "Controller Layer"
        C1["Employee Controller"]
    end

    subgraph "Business Logic Layer"
        B1["Employee Service Interface"]
        B2["Employee Service Implementation"]
    end

    subgraph "Data Access Layer"
        D1["Employee Repository"]
        D2["Employee Entity"]
    end

    subgraph "External & Documentation"
        EX1["PostgreSQL Database (GCP)"]
        EX2["Data Model Documentation"]
        EX3["HTTP Client / Swagger UI"]
    end

    %% Relationships
    EX3 -->|"calls"| S1
    S1 -->|"authenticates"| C1
    A1 -->|"initializes"| S1
    A1 -->|"initializes"| C1
    C1 -->|"delegatesTo"| B1
    B1 -->|"implementedBy"| B2
    B2 -->|"calls"| D1
    D1 -->|"persistsTo"| EX1
    D1 -->|"mapsTo"| D2
    D2 -->|"describedIn"| EX2

    %% Click Events
    click A1 "https://github.com/luanvarg/reto-kruger-vaccination-inventory/blob/master/src/main/java/com/developer/vaccinationinventory/VaccinationInventoryApplication.java"
    click C1 "https://github.com/luanvarg/reto-kruger-vaccination-inventory/blob/master/src/main/java/com/developer/vaccinationinventory/controller/EmployeeController.java"
    click D2 "https://github.com/luanvarg/reto-kruger-vaccination-inventory/blob/master/src/main/java/com/developer/vaccinationinventory/entity/EmployeeEntity.java"
    click D1 "https://github.com/luanvarg/reto-kruger-vaccination-inventory/blob/master/src/main/java/com/developer/vaccinationinventory/repository/EmployeeRepository.java"
    click B1 "https://github.com/luanvarg/reto-kruger-vaccination-inventory/blob/master/src/main/java/com/developer/vaccinationinventory/service/EmployeeService.java"
    click B2 "https://github.com/luanvarg/reto-kruger-vaccination-inventory/blob/master/src/main/java/com/developer/vaccinationinventory/service/impl/EmployeeServiceImpl.java"
    click S1 "https://github.com/luanvarg/reto-kruger-vaccination-inventory/blob/master/src/main/java/com/developer/vaccinationinventory/security/BasicAuthWebSecurityConfiguration.java"
    click EX2 "https://github.com/luanvarg/reto-kruger-vaccination-inventory/tree/master/DataModel"

    %% Styles
    classDef startup fill:#f9f,stroke:#333,stroke-width:2px;
    classDef security fill:#ffcccc,stroke:#a33,stroke-width:2px;
    classDef controller fill:#ccf,stroke:#33a,stroke-width:2px;
    classDef business fill:#cfc,stroke:#3a3,stroke-width:2px;
    classDef data fill:#ffc,stroke:#aa3,stroke-width:2px;
    classDef external fill:#eef,stroke:#55a,stroke-width:2px;

    class A1 startup;
    class S1 security;
    class C1 controller;
    class B1,B2 business;
    class D1,D2 data;
    class EX1,EX2,EX3 external;
```
