# santiago-morfe/hecoto_backend architecture

> Architecture diagram of the GitHub repository santiago-morfe/hecoto_backend, 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/santiago-morfe/hecoto_backend
- Repository: https://github.com/santiago-morfe/hecoto_backend

## Overview

##### Project Type & Core Purpose
- Recognize that this is a backend RESTful API project built on .NET 8.
- It is structured into distinct layers: API (the presentation layer), Application (business logic and services), Domain (core entities/interfaces), and Infrastructure (EF Core implementation and repository patterns).
- Features include dependency injection (DI), unit testing (with xUnit), and dockerized deployment.

##### Analyzing the File Structure
- Top-Level Components:
- API: Contains the main WebAPI, configuration files (appsettings.json), and launch settings that define the presentation layer.
- Application: Encapsulates business/service logic; also includes its own Dockerfile for containerizing application services.
- Domain: Holds the domain entities and interfaces, which drive the core business rules.
- Infrastructure: Provides concrete implementations (repositories, EF Core integration) that interact with external resources like databases.
- Tests: Contains unit tests ensuring the robustness of business logic.
- docker-compose.yml: Coordinates Docker container setups, ensuring development and deployment configurations are standardized.
- The solution file (HecotoBackend.sln) ties the projects together.

##### Key Components
a. API Layer (Presentation)
- This as the entry point for client requests.
- How it exposes endpoints (e.g., Swagger documentation listed in the README).
b. Application Layer (Business Logic)
- Services and logic that transform data between the API and Domain.
c. Domain Layer (Core Business Entities)
- Domain entities and interfaces.
- That this is the central heart of the business, unaffected by external changes.
d. Infrastructure Layer (Data Access & External Integrations)
- EF Core, repository implementations, and any other integrations.
e. Testing Layer
- A separate component for unit tests to validate the behavior of the layers.
f. Docker & Deployment
- How docker-compose coordinates the deployment (e.g., linking API with other services).

##### Relationships and Interactions
- From API to Application (client requests processed by service methods).
- From Application to Domain (business logic leverages domain entities/validations).
- From Application to Infrastructure (repositories interfacing with databases).
- Dependency injection, where higher layers (e.g., API) depend on abstractions defined in Domain and receive implementations from Infrastructure at runtime.

##### Architectural Patterns & Technologies to Highlight
- Layered Architecture – clearly separate each layer (Presentation, Business Logic, Domain, Data).
- Dependency Injection – show DI containers where dependencies are wired.
- Use of Entity Framework Core in Infrastructure for database interactions.
- Docker containerization for running the API, as noted by Dockerfiles and docker-compose.
- Integration with xUnit for unit testing.
- Technologies: .NET 8, Docker, EF Core.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Presentation Layer"
        A1["Hecoto.Backend.API"]:::api
        A2["Configuration (appsettings.json, launchSettings.json)"]:::api
    end

    subgraph "Business Logic Layer"
        B["Hecoto.Backend.Application"]:::app
        B2["Dockerfile (Application)"]:::app
    end

    subgraph "Domain Layer"
        C["Hecoto.Backend.Domain"]:::domain
    end

    subgraph "Infrastructure Layer"
        D["Hecoto.Backend.Infrastructure"]:::infra
    end

    subgraph "Testing Layer"
        E["Hecoto.Backend.Tests"]:::test
    end

    F["docker-compose.yml"]:::deploy

    %% Relationships
    F -->|"deploys"| A1
    F -->|"deploys"| B
    A1 -->|"calls"| B
    B -->|"processes"| C
    B -->|"accesses"| D
    E -->|"tests"| A1
    E -->|"tests"| B
    E -->|"tests"| C
    E -->|"tests"| D

    %% Styles
    classDef api fill:#ffe6e6,stroke:#cc0000,stroke-width:2px;
    classDef app fill:#e6f0ff,stroke:#003399,stroke-width:2px;
    classDef domain fill:#e6ffe6,stroke:#009900,stroke-width:2px;
    classDef infra fill:#fff5cc,stroke:#cc6600,stroke-width:2px;
    classDef test fill:#ffe6ff,stroke:#cc0099,stroke-width:2px;
    classDef deploy fill:#f2e6ff,stroke:#8000ff,stroke-width:2px;

    %% Click Events
    click A1 "https://github.com/santiago-morfe/hecoto_backend/tree/master/API/"
    click B "https://github.com/santiago-morfe/hecoto_backend/tree/master/Application/"
    click B2 "https://github.com/santiago-morfe/hecoto_backend/tree/master/Application/Dockerfile"
    click C "https://github.com/santiago-morfe/hecoto_backend/tree/master/Domain/"
    click D "https://github.com/santiago-morfe/hecoto_backend/tree/master/Infrastructure/"
    click E "https://github.com/santiago-morfe/hecoto_backend/tree/master/Tests/"
    click F "https://github.com/santiago-morfe/hecoto_backend/blob/master/docker-compose.yml"
```
