# healenium/healenium-backend architecture

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

- Interactive diagram: https://gitdiagram.com/healenium/healenium-backend
- Repository: https://github.com/healenium/healenium-backend

## Overview

##### And Label Major Components
- Docker & Containers: At the highest level, illustrate the two container components – one for the hlm-backend (Spring Boot application) and another for the database (e.g., Postgres as seen in the docker-compose examples).
- API Layer: This consists of the various REST controllers (EliteaController, HealingController, ImageController, ReportController) that expose the backend’s functionalities.
- Service Layer: Represent the business logic encapsulated by services (HealingService, EliteaService, ReportService, SelectorService) and their corresponding implementations.
- Data Access Layer: Show the repositories corresponding to domain entities (HealingRepository, HealingResultRepository, ReportRepository, SelectorRepository) that manage persistence.
- Domain Model & Converters: Include a section to represent the domain models (found in model/domain, model/dto, model/wrapper) along with converters and mappers that transform data between representations.
- Configuration & Integration: Don’t forget the configuration classes (LiquibaseConfiguration, JacksonConfiguration, WebConfiguration) and the external integrations (e.g., GitRestService, AmazonRestService).

##### Interactions and Data Flow
- That controllers delegate requests to the Service Layer, passing the data through converters if needed.
- Services interacting with the Data Access Layer (repositories) for CRUD operations, and highlight how Liquibase runs migration scripts via its configuration.

##### Architectural Patterns and Design Principles
- Layered (or MVC-like) architecture: separation of concerns between the presentation (controllers), business (services), and persistence (repositories) layers.
- Use of dependency injection and inversion of control provided by Spring Boot.
- Role of configuration management and migration (Liquibase) in maintaining the database schema.
- Mention how Docker and docker-compose are used for containerization and simplified deployment; the Dockerfile in the project supports creating consistent container images.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    Client["External Client"]:::client

    %% Application Architecture
    subgraph "Application Architecture"
        %% API Layer
        subgraph "API Layer"
            Controllers["API Controllers"]:::layer
        end

        %% Service Layer
        subgraph "Service Layer"
            Services["Service Interfaces"]:::layer
            ServiceImpl["Service Implementations"]:::layer
        end

        %% Data Access Layer
        subgraph "Data Access Layer"
            Repositories["Data Repositories"]:::layer
        end

        %% Domain Model & Converters
        subgraph "Domain Model & Converters"
            DomainModels["Domain Models"]:::layer
            DTOs["DTOs"]:::layer
            Wrappers["Wrappers"]:::layer
            Converters["Converters"]:::layer
        end

        %% Configuration & Integration
        subgraph "Configuration & Integration"
            Configurations["Configurations"]:::layer
            ExternalIntegrations["External Integrations"]:::layer
        end
    end

    %% Deployment: Docker Containers
    subgraph "Docker & Containers"
        BackendContainer["healenium-backend (Spring Boot)"]:::backend
        DatabaseContainer["healenium-db (Postgres)"]:::database
    end

    %% Infrastructure Files
    subgraph "Infrastructure Files"
        DockerfileNode["Dockerfile"]:::infra
        DockerComposeNode["docker-compose.yml"]:::infra
        ExampleComposeNode["example/docker-compose.yaml"]:::infra
    end

    %% Flow Connections
    Client -->|"HTTP request"| Controllers
    Controllers -->|"delegate"| Services
    Services -->|"invoke"| ServiceImpl
    ServiceImpl -->|"access"| Repositories
    Repositories <-->|"CRUD"| DatabaseContainer

    Controllers -->|"data conversion"| Converters
    Converters -->|"map to/from"| DomainModels
    ServiceImpl -->|"use domain"| DomainModels
    ServiceImpl -->|"calls"| ExternalIntegrations
    Configurations -->|"migrate schema"| DatabaseContainer

    %% Container hosting relation
    BackendContainer -->|"hosts"| Controllers
    BackendContainer -->|"hosts"| Services
    BackendContainer -->|"hosts"| ServiceImpl
    BackendContainer -->|"hosts"| Repositories
    BackendContainer -->|"hosts"| Configurations
    BackendContainer -->|"hosts"| Converters
    BackendContainer -->|"hosts"| DomainModels
    BackendContainer -->|"hosts"| DTOs
    BackendContainer -->|"hosts"| Wrappers
    BackendContainer -->|"hosts"| ExternalIntegrations

    %% Styles
    classDef client fill:#FFD700,stroke:#000,stroke-width:2px
    classDef backend fill:#ADD8E6,stroke:#000,stroke-width:2px
    classDef database fill:#98FB98,stroke:#000,stroke-width:2px
    classDef layer fill:#EFEFEF,stroke:#000,stroke-width:1px
    classDef infra fill:#FFCCCC,stroke:#000,stroke-width:1px

    %% Click Events for Component Mapping
    click Controllers "https://github.com/healenium/healenium-backend/tree/master/src/main/java/com/epam/healenium/controller"
    click Services "https://github.com/healenium/healenium-backend/tree/master/src/main/java/com/epam/healenium/service"
    click ServiceImpl "https://github.com/healenium/healenium-backend/tree/master/src/main/java/com/epam/healenium/service/impl"
    click Repositories "https://github.com/healenium/healenium-backend/tree/master/src/main/java/com/epam/healenium/repository"
    click DomainModels "https://github.com/healenium/healenium-backend/tree/master/src/main/java/com/epam/healenium/model/domain"
    click DTOs "https://github.com/healenium/healenium-backend/tree/master/src/main/java/com/epam/healenium/model/dto"
    click Wrappers "https://github.com/healenium/healenium-backend/tree/master/src/main/java/com/epam/healenium/model/wrapper"
    click Converters "https://github.com/healenium/healenium-backend/tree/master/src/main/java/com/epam/healenium/converter"
    click Configurations "https://github.com/healenium/healenium-backend/tree/master/src/main/java/com/epam/healenium/config"
    click ExternalIntegrations "https://github.com/healenium/healenium-backend/tree/master/src/main/java/com/epam/healenium/rest"
    click DockerfileNode "https://github.com/healenium/healenium-backend/tree/master/Dockerfile"
    click DockerComposeNode "https://github.com/healenium/healenium-backend/blob/master/docker-compose.yml"
    click ExampleComposeNode "https://github.com/healenium/healenium-backend/blob/master/example/docker-compose.yaml"
```
