# entrydsm/equus-application architecture

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

- Interactive diagram: https://gitdiagram.com/entrydsm/equus-application
- Repository: https://github.com/entrydsm/equus-application

## Overview

##### Main Components
- Domain Layer (Core Business Logic):
- “application-domain”: Contains your domain models (such as Application, ApplicationCase, GraduationInfo, File, Score, Schedule, School, Status, and User).
- It is structured around DDD concepts with separate packages for exceptions, use cases, service implementations, domain events, and domain SPI (ports) definitions.
- The use of annotations like @UseCase, @DomainService, and @Aggregate signals that DDD is a key design principle.

- Application/Infrastructure Layer:
- “application-infrastructure”: Contains the actual implementations of those ports (persistence adapters, web/presentation adapters, event producers/consumers, PDF generation, Feign clients, Kafka integration, security configurations, etc.).

- External Services/Integrations:
- Interfaces to external systems are indicated by Feign client configurations (for Location, Schedule, School, Status, User).
- AWS S3 integration for file storage, external PDF, and Excel generators are also included.
- External messaging and event handling is enabled by Kafka as evidenced by KafkaProducer/KafkaConsumer configurations and topics.

##### Relationships and Interactions
- The presentation layer (exposed in the infrastructure module) receives HTTP/web requests, calling the appropriate use case in the domain layer.
- The domain layer, via its service (use case) implementations, interacts with persistence adapters or communicates domain events through SPI interfaces.
- External adapters (such as PDF generators, Excel generators, AWS S3 storage, Kafka event buses, and Feign clients) are invoked by the infrastructure layer to meet cross-cutting requirements.
- Dependency inversion: the domain layer defines interfaces (ports) that are implemented by the infrastructure, ensuring that business logic does not depend on technical details.

##### Architectural Patterns and Design Principles
- The project applies the Hexagonal (Ports-and-Adapters) pattern, clearly separating business rules from technical concerns.
- Domain-driven design is evident with a deep division of domain objects, use cases, events, and exceptions.
- Layered design is also used – with clear separations between presentation, application, domain, and infrastructure.
- Integration with external systems (via Feign, Kafka, AWS S3, etc.) and the use of configuration classes (e.g., for caching, security, PDF generation) emphasize a modular and decoupled design.

##### Relevant Technologies, Frameworks, or Libraries
- Kotlin as the primary language, managed by Gradle (build.gradle.kts files).
- Likely Spring Boot (or a similar framework) is used for dependency injection, web/presentation and configuration support.
- JPA and possibly QueryDSL for database interactions (“JpaRepository”, “Entity” packages).
- Kafka for event-driven messaging (KafkaProducerConfig, KafkaConsumerConfig).
- Feign clients for inter-service communication.
- AWS S3 integration for file storage and caching mechanisms (likely Redis application – see SchoolCacheRedisEntity).
- PDF and Excel generation for document handling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        A["Web Adapter (HTTP Controllers)"]:::presentation
    end

    subgraph "Application Layer"
        B["Use Cases / Application Service"]:::application
    end

    subgraph "Domain Layer"
        C["Domain Models & Business Logic"]:::domain
    end

    subgraph "Infrastructure Layer"
        D["Persistence Adapter (JPA Repositories)"]:::infrastructure
        E["Kafka Adapter (Event Bus)"]:::infrastructure
        F["Feign Clients (External API Calls)"]:::infrastructure
        G["AWS S3 Storage (File Storage)"]:::infrastructure
        H["PDF Generator (Document Generation)"]:::infrastructure
        I["Excel Generator (Document Generation)"]:::infrastructure
    end

    A -->|"handles"| B
    B -->|"executes"| C
    C -->|"persists"| D
    C -->|"publishes"| E
    C -->|"calls"| F
    C -->|"stores"| G
    C -->|"generatesPDF"| H
    C -->|"generatesExcel"| I

    click A "https://github.com/entrydsm/equus-application/tree/develop/application-infrastructure/src/main/kotlin/hs/kr/equus/application"
    click C "https://github.com/entrydsm/equus-application/tree/develop/application-domain/src/main/kotlin/hs/kr/equus/application/domain"
    click F "https://github.com/entrydsm/equus-application/tree/develop/application-infrastructure/src/main/kotlin/hs/kr/equus/application/global/feign/client"
    click G "https://github.com/entrydsm/equus-application/tree/develop/application-infrastructure/src/main/kotlin/hs/kr/equus/application/global/storage"
    click E "https://github.com/entrydsm/equus-application/tree/develop/application-infrastructure/src/main/kotlin/hs/kr/equus/application/global/kafka"
    click H "https://github.com/entrydsm/equus-application/tree/develop/application-infrastructure/src/main/kotlin/hs/kr/equus/application/global/document/pdf/generator"
    click I "https://github.com/entrydsm/equus-application/tree/develop/application-infrastructure/src/main/kotlin/hs/kr/equus/application/global/excel/generator"

    classDef presentation fill:#E0F7FA,stroke:#000,stroke-width:2px;
    classDef application fill:#C8E6C9,stroke:#000,stroke-width:2px;
    classDef domain fill:#FFF9C4,stroke:#000,stroke-width:2px;
    classDef infrastructure fill:#FFCCBC,stroke:#000,stroke-width:2px;
```
