# systemsscalability/epetparadise architecture

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

- Interactive diagram: https://gitdiagram.com/systemsscalability/epetparadise
- Repository: https://github.com/systemsscalability/epetparadise

## Overview

##### Main Components
- Presentation Layer:
– Represented by the “EPP.Presentation” project.
– Contains Controllers (for Entities, Management, Transactions) that expose REST endpoints.
– Includes configuration files and launch settings for local development.

- Application Layer:
– Found in the “EPP.Application” project.
– Contains DTOs, Services (grouped into Entities, Management, and Transactions), and Validation routines.
– Acts as the business logic layer that coordinates requests between the presentation layer and the domain/data layers.

- Domain Layer:
– Located in the “EPP.Domain” project.
– Holds the core domain models (Entities like Customer, Administrator, Product, Provider, as well as Management and Transaction models).
– Represents the core business rules and entities.

- Infrastructure Layer:
– Provided by the “EPP.Infrastructure” project.
– Contains the DataContext, Migrations, and any data access logic (typically using Entity Framework Core).
– Responsible for interacting with the database.

- Database:
– Although not visible directly in the code, the README instructs to “run the database up with Docker.” This indicates that a PostgreSQL or similar DB is being containerized (often along with Pgadmin for management via the docker-compose command).

- Containerization & Deployment:
– The project includes a “Dockerfile” and “docker-compose.yml” which build the API container and set up the database service.
– “deployment.yaml” describes the Kubernetes Deployment and Service configuration for container orchestration.

##### Relationships and Data Flow
- Clients (could be external consumers or front-end apps) interact with the API exposed by the Presentation layer.
- The Presentation layer’s controllers call the Application services to process incoming requests.
- Application services use domain models (from the Domain layer) and interact with the Infrastructure layer for database operations.
- The Infrastructure layer handles the data persistence, connecting to the external database service.
- On the deployment side, the API container (running this backend) is orchestrated by Kubernetes which ensures availability and horizontal scaling.

##### Architectural Patterns and Technologies
- Layered/Clean Architecture:

- Containerization & Microservices Deployment:
– Show how the Docker image (built from the Dockerfile) is deployed as a container in a Kubernetes Pod.
– Include details like the Kubernetes Deployment (with replicas) and Service (for load balancing).
– Include mention of Horizontal Pod Autoscaler (HPA) as described in the README for dynamic scaling.

- Data Persistence:
– Indicate usage of Entity Framework Core (in Infrastructure) and integration with a containerized database.

- DevOps/CI-CD Aspects:

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layered Architecture
    subgraph "Layered Architecture"
        A["External Client"]:::client
        subgraph "Presentation Layer"
            P["Controllers/REST Endpoints (EPP.Presentation)"]:::layer
        end
        subgraph "Application Layer"
            AP["Services & DTOs (EPP.Application)"]:::layer
        end
        subgraph "Domain Layer"
            D["Core Domain Models (EPP.Domain)"]:::layer
        end
        subgraph "Infrastructure Layer"
            I["DataContext & Migrations (EPP.Infrastructure)"]:::layer
        end
        DB["Database Container"]:::db
    end

    %% Containerization & Deployment
    subgraph "Containerization & Deployment"
        DkF["Dockerfile"]:::container
        DCY["docker-compose.yml"]:::container
        DC["Docker Build"]:::container
        K8sD["Kubernetes Deployment (api container)"]:::orchestration
        Pod["Kubernetes Pod"]:::orchestration
        K8sS["Kubernetes Service"]:::orchestration
        HPA["Horizontal Pod Autoscaler"]:::orchestration
    end

    %% Relationships in Layered Architecture
    A -->|"HTTP_Request"| P
    P -->|"Invokes_Services"| AP
    AP -->|"Processes_Domain"| D
    AP -->|"Uses_Infrastructure"| I
    I -->|"Persists_Data"| DB

    %% Relationship between Presentation Layer and Containerization
    P ---|"Image_Build"| DC

    %% Relationships in Containerization & Deployment
    DkF --> DC
    DCY --> DC
    DC --> K8sD
    K8sD --> Pod
    Pod --> K8sS
    K8sD --> HPA

    %% Click Events
    click P "https://github.com/systemsscalability/epetparadise/blob/develop/src/EPP.Presentation"
    click AP "https://github.com/systemsscalability/epetparadise/blob/develop/src/EPP.Application"
    click D "https://github.com/systemsscalability/epetparadise/blob/develop/src/EPP.Domain"
    click I "https://github.com/systemsscalability/epetparadise/blob/develop/src/EPP.Infrastructure"
    click DkF "https://github.com/systemsscalability/epetparadise/tree/develop/Dockerfile"
    click DCY "https://github.com/systemsscalability/epetparadise/blob/develop/docker-compose.yml"
    click K8sD "https://github.com/systemsscalability/epetparadise/blob/develop/deployment.yaml"

    %% Styles
    classDef layer fill:#E3F2FD,stroke:#1E88E5,stroke-width:2px;
    classDef container fill:#FFECB3,stroke:#FFA000,stroke-width:2px;
    classDef orchestration fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef db fill:#F8BBD0,stroke:#C2185B,stroke-width:2px;
    classDef client fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
```
