# daohainam/clean-architecture-miniatm architecture

> Architecture diagram of the GitHub repository daohainam/clean-architecture-miniatm, 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/daohainam/clean-architecture-miniatm
- Repository: https://github.com/daohainam/clean-architecture-miniatm

## Overview

##### Project type and purpose
- The project is an example mini-ATM application designed to teach Clean Architecture principles. Notice that it’s used in a video series on Clean Architecture.
- Its core focus is on separating concerns into different layers, such as Domain (Entities), Application (Use Case), and Infrastructure (data persistence, web presentation, external resources).

##### File structure for layer identification
- Domain/Entities: The MiniATM.Entities folder encapsulates the domain models (e.g., BankAccount, Customer, Transaction) along with domain events and exceptions.
- Application/Use Cases: Under MiniATM.UseCase (and MiniATM.UseCase.Caching), you find business logic components like CashWithdrawalManager and TransferManager, along with interfaces and repository contracts. This represents the “Application” or “Use Case” layer.
- Infrastructure: There are multiple implementations in the MiniATM.Infrastructure layer:
- Data persistence implementations with InMemory and SqlServer projects, including repositories and unit-of-work classes. The SqlServer project includes migration files and database context.
- Web presentation: Controllers (e.g., CoreBankingController, HomeController) and Razor views (under Views) that act as the entry point for user interactions.
- Supporting components such as cash storage and caching.
- Additional supporting folders include DBScripts and Tests, which are used to set up the database and verify functionality respectively.

##### Relevant technologies, frameworks, and libraries
- .NET/C# (indicated by .csproj files and C# source code).
- Entity Framework for SQL Server migrations and repository mapping (evident from the Migrations folder and MapperProfile).
- ASP.NET MVC (Controllers, Razor Views) for web presentation.
- JavaScript and CSS libraries (Bootstrap, jQuery) found under wwwroot.

##### Final detailed advice
- Clearly delineate boundaries between layers; this is the key principle of Clean Architecture being demonstrated.
- Verify that all external libraries (like Bootstrap, jQuery) and runtime configuration elements (like appsettings.json, launchSettings.json) are noted as supporting components, providing context to the deployment environment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Domain Layer
    subgraph "Domain Layer"
        DE["Domain Entities"]:::domain
    end

    %% Application Layer
    subgraph "Application Layer"
        UC["Use Cases"]:::application
        CA["Caching"]:::application
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        subgraph "Persistence"
            IM["InMemory Repositories"]:::infrastructure
            SS["SQL Server Repositories"]:::infrastructure
        end
        subgraph "Presentation"
            CO["Controllers"]:::infrastructure
            VI["Views"]:::infrastructure
        end
        ES["Cash Storage"]:::infrastructure
    end

    %% Supporting Components
    DS["DB Scripts"]:::support
    TS["Tests"]:::tests

    %% Component Relationships
    CO -->|"calls"| UC
    UC -->|"uses"| DE
    UC -->|"accesses"| IM
    UC -->|"accesses"| SS
    SS -->|"uses schema"| DS
    CO -->|"triggers"| VI
    CO -->|"integrates"| ES
    TS -.->|"tests"| UC

    %% Click Events
    click DE "https://github.com/daohainam/clean-architecture-miniatm/blob/master/MiniATM.Entities"
    click UC "https://github.com/daohainam/clean-architecture-miniatm/blob/master/MiniATM.UseCase"
    click CA "https://github.com/daohainam/clean-architecture-miniatm/blob/master/MiniATM.UseCase.Caching"
    click IM "https://github.com/daohainam/clean-architecture-miniatm/blob/master/MiniATM.Infrastructure.InMemory"
    click SS "https://github.com/daohainam/clean-architecture-miniatm/blob/master/MiniATM.Infrastructure.SqlServer"
    click CO "https://github.com/daohainam/clean-architecture-miniatm/tree/master/MiniATM.Infrastructure/Controllers"
    click VI "https://github.com/daohainam/clean-architecture-miniatm/tree/master/MiniATM.Infrastructure/Views"
    click ES "https://github.com/daohainam/clean-architecture-miniatm/tree/master/MiniATM.Infrastructure/CashStorage"
    click DS "https://github.com/daohainam/clean-architecture-miniatm/tree/master/DBScripts"
    click TS "https://github.com/daohainam/clean-architecture-miniatm/tree/master/Tests"

    %% Styles
    classDef domain fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef application fill:#A9DFBF,stroke:#239B56,stroke-width:2px;
    classDef infrastructure fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef tests fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
    classDef support fill:#FADBD8,stroke:#CB4335,stroke-width:2px;
```
