# nika97z/atm architecture

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

- Interactive diagram: https://gitdiagram.com/nika97z/atm
- Repository: https://github.com/nika97z/atm

## Overview

This is a console ATM application. A user chooses registration or login in the UI; the service layer handles identity and account workflows, while the repository reads and writes user records in a JSON-lines data file. The service layer also supports account operations and loan requests, and the domain models represent users, accounts, and loans. Evidence is limited to the README (empty) and the supplied excerpts; unsampled service behavior is represented only where its capabilities are visible in the excerpt or source index.

Main entry points: [`ATM.Services/Services.cs`](https://github.com/nika97z/atm/blob/master/ATM.Services/Services.cs) (Registration and login), [`ATM.Core/Interfaces/Interface1.cs`](https://github.com/nika97z/atm/blob/master/ATM.Core/Interfaces/Interface1.cs) (Repository contract), [`ATM.UI/Program.cs`](https://github.com/nika97z/atm/blob/master/ATM.UI/Program.cs) (Console entry), [`ATM.Infrastructure/Repository/Repository.cs`](https://github.com/nika97z/atm/blob/master/ATM.Infrastructure/Repository/Repository.cs) (User repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Console UI"]
  node_program["Console entry<br/>[Program.cs]"]
end

subgraph group_services["ATM Services"]
  node_identity["Registration and login<br/>[Services.cs]"]
  node_account_ops["Account operations<br/>[Services.cs]"]
  node_loan_ops["Loan requests<br/>[Services.cs]"]
  node_admin_ops["Admin workflows<br/>[Services.cs]"]
end

subgraph group_domain["Core Domain"]
  node_repository_contract["Repository contract<br/>[Interface1.cs]"]
  node_user_model["User roles<br/>[User.cs]"]
  node_client_model["Client user<br/>[ClientUser.cs]"]
  node_admin_model["Admin user<br/>[AdminUser.cs]"]
  node_account_model["Account<br/>[Account.cs]"]
  node_loan_model["Loan<br/>[Loans.cs]"]
  node_loan_status["Loan statuses<br/>[LoanStatus.cs]"]
  node_funds_error["Insufficient funds"]
end

subgraph group_storage["Persistence"]
  node_repository["User repository<br/>[Repository.cs]"]
  node_data_file[("User data file<br/>[Data.txt]")]
end

node_actor(("ATM user"))

node_actor -->|"chooses option"| node_program
node_program -->|"registers or logs in"| node_identity
node_program -->|"constructs and injects"| node_repository
node_identity -->|"reads and registers"| node_repository_contract
node_account_ops -->|"updates clients"| node_repository_contract
node_repository -->|"implements"| node_repository_contract
node_repository -->|"reads and writes"| node_data_file
node_account_ops -->|"throws and handles"| node_funds_error
node_identity -->|"checks roles"| node_user_model
node_identity -->|"registers clients"| node_client_model
node_identity -->|"registers admins"| node_admin_model
node_account_ops -->|"creates and changes"| node_account_model
node_account_ops -->|"updates accounts"| node_client_model
node_loan_ops -->|"records requests"| node_loan_model
node_loan_ops -->|"checks status"| node_loan_status
node_admin_ops -.->|"uses admin records"| node_repository_contract

click node_program "https://github.com/nika97z/atm/blob/master/ATM.UI/Program.cs"
click node_identity "https://github.com/nika97z/atm/blob/master/ATM.Services/Services.cs"
click node_account_ops "https://github.com/nika97z/atm/blob/master/ATM.Services/Services.cs"
click node_loan_ops "https://github.com/nika97z/atm/blob/master/ATM.Services/Services.cs"
click node_admin_ops "https://github.com/nika97z/atm/blob/master/ATM.Services/Services.cs"
click node_repository "https://github.com/nika97z/atm/blob/master/ATM.Infrastructure/Repository/Repository.cs"
click node_data_file "https://github.com/nika97z/atm/blob/master/ATM.Infrastructure/Data/Data.txt"
click node_repository_contract "https://github.com/nika97z/atm/blob/master/ATM.Core/Interfaces/Interface1.cs"
click node_user_model "https://github.com/nika97z/atm/blob/master/ATM.Core/Models/User.cs"
click node_client_model "https://github.com/nika97z/atm/blob/master/ATM.Core/Models/ClientUser.cs"
click node_admin_model "https://github.com/nika97z/atm/blob/master/ATM.Core/Models/AdminUser.cs"
click node_account_model "https://github.com/nika97z/atm/blob/master/ATM.Core/Models/Account.cs"
click node_loan_model "https://github.com/nika97z/atm/blob/master/ATM.Core/Models/Loans.cs"
click node_loan_status "https://github.com/nika97z/atm/blob/master/ATM.Core/Enums/LoanStatus.cs"
click node_funds_error "https://github.com/nika97z/atm/blob/master/ATM.Core/Exceptions/InsufficientFundsException.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_program,node_actor toneBlue
class node_identity,node_account_ops,node_loan_ops,node_admin_ops toneAmber
class node_repository_contract,node_user_model,node_client_model,node_admin_model,node_account_model,node_loan_model,node_loan_status,node_funds_error toneMint
class node_repository,node_data_file toneRose
```

## Components

### Console UI

- [Console entry](https://github.com/nika97z/atm/blob/master/ATM.UI/Program.cs): `ATM.UI/Program.cs`

### ATM Services

- [Registration and login](https://github.com/nika97z/atm/blob/master/ATM.Services/Services.cs): `ATM.Services/Services.cs`
- [Account operations](https://github.com/nika97z/atm/blob/master/ATM.Services/Services.cs): `ATM.Services/Services.cs`
- [Loan requests](https://github.com/nika97z/atm/blob/master/ATM.Services/Services.cs): `ATM.Services/Services.cs`
- [Admin workflows](https://github.com/nika97z/atm/blob/master/ATM.Services/Services.cs): `ATM.Services/Services.cs`

### Core Domain

- [Repository contract](https://github.com/nika97z/atm/blob/master/ATM.Core/Interfaces/Interface1.cs): `ATM.Core/Interfaces/Interface1.cs`
- [User roles](https://github.com/nika97z/atm/blob/master/ATM.Core/Models/User.cs): `ATM.Core/Models/User.cs`
- [Client user](https://github.com/nika97z/atm/blob/master/ATM.Core/Models/ClientUser.cs): `ATM.Core/Models/ClientUser.cs`
- [Admin user](https://github.com/nika97z/atm/blob/master/ATM.Core/Models/AdminUser.cs): `ATM.Core/Models/AdminUser.cs`
- [Account](https://github.com/nika97z/atm/blob/master/ATM.Core/Models/Account.cs): `ATM.Core/Models/Account.cs`
- [Loan](https://github.com/nika97z/atm/blob/master/ATM.Core/Models/Loans.cs): `ATM.Core/Models/Loans.cs`
- [Loan statuses](https://github.com/nika97z/atm/blob/master/ATM.Core/Enums/LoanStatus.cs): `ATM.Core/Enums/LoanStatus.cs`
- [Insufficient funds](https://github.com/nika97z/atm/blob/master/ATM.Core/Exceptions/InsufficientFundsException.cs): `ATM.Core/Exceptions/InsufficientFundsException.cs`

### Persistence

- [User repository](https://github.com/nika97z/atm/blob/master/ATM.Infrastructure/Repository/Repository.cs): `ATM.Infrastructure/Repository/Repository.cs`
- [User data file](https://github.com/nika97z/atm/blob/master/ATM.Infrastructure/Data/Data.txt): `ATM.Infrastructure/Data/Data.txt`

### Other components

- **ATM user**

## Connections

- ATM user → Console entry: chooses option (evidence: `ATM.UI/Program.cs`)
- Console entry → Registration and login: registers or logs in (evidence: `ATM.UI/Program.cs`)
- Console entry → User repository: constructs and injects (evidence: `ATM.UI/Program.cs`)
- Registration and login → Repository contract: reads and registers (evidence: `ATM.Services/Services.cs`)
- Account operations → Repository contract: updates clients (evidence: `ATM.Services/Services.cs`)
- User repository → Repository contract: implements (evidence: `ATM.Infrastructure/Repository/Repository.cs`)
- User repository → User data file: reads and writes (evidence: `ATM.Infrastructure/Repository/Repository.cs`)
- Account operations → Insufficient funds: throws and handles (evidence: `ATM.Services/Services.cs`)
- Registration and login → User roles: checks roles (evidence: `ATM.Services/Services.cs`)
- Registration and login → Client user: registers clients (evidence: `ATM.UI/Program.cs`)
- Registration and login → Admin user: registers admins (evidence: `ATM.UI/Program.cs`)
- Account operations → Account: creates and changes (evidence: `ATM.Services/Services.cs`)
- Account operations → Client user: updates accounts (evidence: `ATM.Services/Services.cs`)
- Loan requests → Loan: records requests (evidence: `ATM.Services/Services.cs`)
- Loan requests → Loan statuses: checks status (evidence: `ATM.Services/Services.cs`)
- Admin workflows → Repository contract: uses admin records (evidence: `ATM.Services/Services.cs`)
