# beeziniss/ekofycapstone architecture

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

- Interactive diagram: https://gitdiagram.com/beeziniss/ekofycapstone
- Repository: https://github.com/beeziniss/ekofycapstone

## Overview

##### Project type and purpose
- This is an ASP .NET Core RESTful API (“EkofyApp.Api”) following a classic layered (hexagonal) architecture.
- Purpose: expose business operations over HTTP, orchestrate domain logic (in the Domain layer), map/use cases and validation (in the Application layer), delegate persistence and external integrations (in the Infrastructure layer), and handle cross-cutting concerns (filters, configuration).

##### File structure
- Top-level solution contains four projects:
- EkofyApp.Api – the ASP .NET Core Web API project (controllers, HTTP filters, environment loader, appsettings).
- EkofyApp.Application – service interfaces, UnitOfWork abstraction, AutoMapper profiles, DbContext abstractions, and MongoDB settings.
- EkofyApp.Domain – core entities, enums, exceptions, and utility classes.
- EkofyApp.Infrastructure – concrete implementations of repositories/unit‐of‐work, third-party services (Cloudinary), and DI bootstrap.
- Key files:
- DatabaseContext/EkofyDbContext.cs – EF Core or MongoDB context.
- ThirdPartyServices/CloudinaryService – image storage integration.
- DependencyInjection.cs – wiring up Application + Infrastructure into the DI container.
- Filters/BaseExceptionFilter.cs – global exception handling pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    Client["API Consumer / Frontend"]:::external

    %% API Layer
    subgraph "API Layer" 
        direction TB
        Program["Program.cs"]:::api
        ApiCsproj["EkofyApp.Api.csproj"]:::api
        AppSettings["appsettings.json"]:::api
        DevSettings["appsettings.Development.json"]:::api
        EnvLoader["EnvironmentVariableLoader.cs"]:::api
        ExceptionFilter["BaseExceptionFilter.cs"]:::api
        HttpFile["EkofyApp.Api.http"]:::api
        Controllers["Controllers"]:::api
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        DbContext["EkofyDbContext.cs"]:::app
        MongoSetting["MongoDbSetting.cs"]:::app
        IUnitOfWork["IUnitOfWork.cs"]:::app
        ICloudinarySvc["ICloudinaryService.cs"]:::app
        MappingProfile["MappingProfile.cs"]:::app
        IMapFrom["IMapFrom.cs"]:::app
        AppCsproj["EkofyApp.Application.csproj"]:::app
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        Enums["ImageTag.cs"]:::domain
        BaseEx["BaseException.cs"]:::domain
        BadReqEx["BadRequestCustomException.cs"]:::domain
        AuthEx["UnauthorizedCustomException.cs"]:::domain
        ForbiddenEx["ForbiddenCustomException.cs"]:::domain
        NotFoundEx["NotFoundCustomException.cs"]:::domain
        ConflictEx["ConflictCustomException.cs"]:::domain
        UnprocEx["UnprocessableEntityCustomException.cs"]:::domain
        ExtSvcEx["ExternalServiceCustomException.cs"]:::domain
        BadGatewayEx["BadGatewayCustomException .cs"]:::domain
        ValidationEx["ValidationCustomException.cs"]:::domain
        Utils["Utils"]:::domain
        DomainCsproj["EkofyApp.Domain.csproj"]:::domain
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        direction TB
        DI["DependencyInjection.cs"]:::infra
        UnitOfWorkImpl["UnitOfWork.cs"]:::infra
        CloudinarySvcImpl["CloudinaryService.cs"]:::infra
        InfraCsproj["EkofyApp.Infrastructure.csproj"]:::infra
    end

    %% External Services
    subgraph "External Services"
        direction TB
        MongoDB[(MongoDB Atlas)]:::external
        Cloudinary((Cloudinary API)):::external
    end

    %% Connections
    Client -->|"HTTP Request"| Controllers
    Controllers -->|"Environment & Config"| EnvLoader
    Controllers -->|"Filters Pipeline"| ExceptionFilter
    Controllers -->|"calls Application"| IUnitOfWork
    Controllers -->|"calls Application"| ICloudinarySvc

    IUnitOfWork -->|returns UnitOfWork| UnitOfWorkImpl
    IUnitOfWork -->|abstraction| DbContext
    DbContext -->|persists data| MongoDB

    ICloudinarySvc -->|implementation| CloudinarySvcImpl
    CloudinarySvcImpl -->|calls UploadAsync| Cloudinary

    MappingProfile -->|maps DTO↔Entity| Enums

    DI -->|"wires up Interfaces"| IUnitOfWork
    DI -->|"wires up Interfaces"| ICloudinarySvc

    %% Click Events API
    click Program "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Api/Program.cs"
    click ApiCsproj "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Api/EkofyApp.Api.csproj"
    click AppSettings "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Api/appsettings.json"
    click DevSettings "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Api/appsettings.Development.json"
    click EnvLoader "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Api/EnvironmentVariableLoader.cs"
    click ExceptionFilter "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Api/Filters/BaseExceptionFilter.cs"
    click HttpFile "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Api/EkofyApp.Api.http"

    %% Click Events Application
    click DbContext "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Application/DatabaseContext/EkofyDbContext.cs"
    click MongoSetting "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Application/DatabaseContext/MongoDbSetting.cs"
    click IUnitOfWork "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Application/ServiceInterfaces/IUnitOfWork.cs"
    click MappingProfile "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Application/Mappers/MappingProfile.cs"
    click IMapFrom "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Application/Mappers/IMapFrom.cs"
    click ICloudinarySvc "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Application/ThirdPartyServiceInterfaces/Cloudinary/ICloudinaryService.cs"
    click AppCsproj "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Application/EkofyApp.Application.csproj"

    %% Click Events Domain
    click Enums "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Enums/ImageTag.cs"
    click BaseEx "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Exceptions/BaseException.cs"
    click BadReqEx "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Exceptions/BadRequestCustomException.cs"
    click AuthEx "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Exceptions/UnauthorizedCustomException.cs"
    click ForbiddenEx "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Exceptions/ForbiddenCustomException.cs"
    click NotFoundEx "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Exceptions/NotFoundCustomException.cs"
    click ConflictEx "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Exceptions/ConflictCustomException.cs"
    click UnprocEx "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Exceptions/UnprocessableEntityCustomException.cs"
    click ExtSvcEx "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Exceptions/ExternalServiceCustomException.cs"
    click BadGatewayEx "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Exceptions/BadGatewayCustomException .cs"
    click ValidationEx "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/Exceptions/ValidationCustomException.cs"
    click Utils "https://github.com/beeziniss/ekofycapstone/tree/master/EkofyApp.Domain/Utils"
    click DomainCsproj "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Domain/EkofyApp.Domain.csproj"

    %% Click Events Infrastructure
    click DI "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Infrastructure/DependencyInjections/DependencyInjection.cs"
    click UnitOfWorkImpl "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Infrastructure/Services/UnitOfWork.cs"
    click CloudinarySvcImpl "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Infrastructure/ThirdPartyServices/Cloudinaries/CloudinaryService.cs"
    click InfraCsproj "https://github.com/beeziniss/ekofycapstone/blob/master/EkofyApp.Infrastructure/EkofyApp.Infrastructure.csproj"

    %% Styles
    classDef api fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef app fill:#d4edda,stroke:#333,stroke-width:1px
    classDef domain fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef infra fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef external fill:#d1ecf1,stroke:#333,stroke-width:1px
```
