# gagatun16/kyrsach20 architecture

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

- Interactive diagram: https://gitdiagram.com/gagatun16/kyrsach20
- Repository: https://github.com/gagatun16/kyrsach20

## Overview

1. This repository is a small C++ desktop application, likely a coursework project, for managing users, wallets, and money transfers. The architecture is centered on a local in-process domain model rather than a client/server system.

2. The presentation layer is a Win32 + OpenGL + Dear ImGui GUI. `main.cpp` and the `example_win32_opengl3` project wire up the application window, render loop, and UI widgets. That means the UI, business logic, and persistence all live in the same executable boundary.

3. The core domain objects are `User`, `Admin`, `WalletBalance`, and `Transaction`. `Admin` appears to represent elevated access or management capabilities, while `User` and `WalletBalance` represent account state. `Transaction` is the base abstraction for money movement.

4. Money movement is split into transaction subtypes: `incomingTransaction`, `outgoingTransaction`, `internalTransfer`, and `externalWithdrawal`. This suggests the app treats different transfer directions and destinations as separate business cases, likely because each has distinct validation and logging rules.

5. `TransferProcessor` is the main orchestration boundary for transaction execution. It is likely responsible for applying business rules, updating balances, choosing the right transaction subtype, and coordinating persistence/logging after the transfer is accepted.

6. `UserManager` is the central registry/controller for user-related operations. It likely owns or indexes the active users, handles creation/removal/lookups, and provides the data needed by the UI and transfer logic.

7. `TransactionLogger` is a distinct persistence/logging subsystem. The repo contains `transactions_logs/` with per-transaction text files, which implies completed transactions are written out as individual records rather than to a database.

8. The application uses flat-file storage for state. `users.txt` and `wallets.txt` store the main account data, while `transactions_logs/*.txt` stores transaction history. There is no evidence of an external DB or network service; persistence is local and file-based.

9. The runtime flow is likely: UI action in ImGui -> `UserManager`/`TransferProcessor` domain call -> balance and transaction objects updated -> `TransactionLogger` writes a record -> the text files represent the current persisted state. This separation is the clearest architectural boundary in the repo.

10. The repository also contains a separate `test` project plus Visual Studio and MinGW build scripts. That indicates the codebase is structured for local desktop builds and validation, not for deployment to a remote environment.

11. The many `Debug/` and `.obj/.tlog/.pdb` files are build artifacts, not architectural components. They show the project is developed and built in Visual Studio, with an additional `build_mingw.bat` path for an alternate toolchain.

12. If you are drawing an architecture diagram, the key boxes are: GUI shell, domain model, transfer processing, user management, transaction logging, and file storage. The main arrows are UI-to-domain commands and domain-to-text-file persistence; there are no obvious external services or distributed boundaries.

Main entry points: [`main.cpp`](https://github.com/gagatun16/kyrsach20/blob/master/main.cpp) (main.cpp), [`Transaction.h`](https://github.com/gagatun16/kyrsach20/blob/master/Transaction.h) (Transaction), [`UserManager.h`](https://github.com/gagatun16/kyrsach20/blob/master/UserManager.h) (UserManager), [`TransferProcessor.h`](https://github.com/gagatun16/kyrsach20/blob/master/TransferProcessor.h) (TransferProcessor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_ui["UI Shell"]
  node_main_cpp["main.cpp<br/>entrypoint<br/>[main.cpp]"]
  node_proj_vcxproj["Win32 app"]
  node_imgui_core["ImGui core<br/>ui toolkit<br/>[imgui.h]"]
  node_imgui_win32["Win32 bridge<br/>platform layer<br/>[imgui_impl_win32.h]"]
  node_imgui_gl["OpenGL bridge<br/>render layer"]
end

subgraph group_group_domain["Domain Model"]
  node_user_h["User<br/>entity<br/>[User.h]"]
  node_admin_h["Admin<br/>entity<br/>[Admin.h]"]
  node_wallet_h["Wallet<br/>entity<br/>[WalletBalance.h]"]
  node_txn_h["Transaction<br/>entity<br/>[Transaction.h]"]
  node_incoming_h["Incoming<br/>transaction subtype"]
  node_outgoing_h["Outgoing<br/>transaction subtype"]
  node_internal_h["Internal xfer<br/>transaction subtype<br/>[internalTransfer.h]"]
  node_external_h["External withdraw<br/>transaction subtype"]
end

subgraph group_group_process["Processing"]
  node_user_mgr["UserManager<br/>controller<br/>[UserManager.h]"]
  node_transfer_proc["TransferProcessor<br/>orchestrator"]
end

subgraph group_group_persist["Persistence"]
  node_txn_log["TransactionLogger"]
  node_users_store["users.txt<br/>flat file<br/>[users.txt]"]
  node_wallets_store["wallets.txt<br/>flat file<br/>[wallets.txt]"]
  node_txn_logs_dir["transactions_logs<br/>log store"]
end

subgraph group_group_build["Build"]
  node_test_proj["test.vcxproj<br/>test project<br/>[test.vcxproj]"]
end

node_proj_vcxproj -->|"builds"| node_main_cpp
node_main_cpp -->|"uses"| node_imgui_core
node_main_cpp -->|"uses"| node_imgui_win32
node_main_cpp -->|"uses"| node_imgui_gl
node_main_cpp -->|"commands"| node_user_mgr
node_main_cpp -->|"commands"| node_transfer_proc
node_user_mgr -->|"manages"| node_user_h
node_user_h -->|"specializes"| node_admin_h
node_user_h -->|"owns"| node_wallet_h
node_transfer_proc -->|"coordinates"| node_txn_h
node_txn_h -->|"subtype"| node_incoming_h
node_txn_h -->|"subtype"| node_outgoing_h
node_txn_h -->|"subtype"| node_internal_h
node_txn_h -->|"subtype"| node_external_h
node_transfer_proc -->|"updates"| node_wallet_h
node_transfer_proc -->|"logs"| node_txn_log
node_txn_log -->|"writes"| node_txn_logs_dir
node_user_mgr -->|"persists"| node_users_store
node_user_mgr -->|"persists"| node_wallets_store
node_test_proj -->|"covers"| node_user_mgr
node_test_proj -->|"covers"| node_transfer_proc

click node_main_cpp "https://github.com/gagatun16/kyrsach20/blob/master/main.cpp"
click node_proj_vcxproj "https://github.com/gagatun16/kyrsach20/blob/master/example_win32_opengl3.vcxproj"
click node_imgui_core "https://github.com/gagatun16/kyrsach20/blob/master/imgui.h"
click node_imgui_win32 "https://github.com/gagatun16/kyrsach20/blob/master/imgui_impl_win32.h"
click node_imgui_gl "https://github.com/gagatun16/kyrsach20/blob/master/imgui_impl_opengl3.h"
click node_user_h "https://github.com/gagatun16/kyrsach20/blob/master/User.h"
click node_admin_h "https://github.com/gagatun16/kyrsach20/blob/master/Admin.h"
click node_wallet_h "https://github.com/gagatun16/kyrsach20/blob/master/WalletBalance.h"
click node_txn_h "https://github.com/gagatun16/kyrsach20/blob/master/Transaction.h"
click node_incoming_h "https://github.com/gagatun16/kyrsach20/blob/master/incomingTransaction.h"
click node_outgoing_h "https://github.com/gagatun16/kyrsach20/blob/master/outgoingTransaction.h"
click node_internal_h "https://github.com/gagatun16/kyrsach20/blob/master/internalTransfer.h"
click node_external_h "https://github.com/gagatun16/kyrsach20/blob/master/externalWithdrawal.h"
click node_user_mgr "https://github.com/gagatun16/kyrsach20/blob/master/UserManager.h"
click node_transfer_proc "https://github.com/gagatun16/kyrsach20/blob/master/TransferProcessor.h"
click node_txn_log "https://github.com/gagatun16/kyrsach20/blob/master/TransactionLogger.h"
click node_users_store "https://github.com/gagatun16/kyrsach20/blob/master/users.txt"
click node_wallets_store "https://github.com/gagatun16/kyrsach20/blob/master/wallets.txt"
click node_txn_logs_dir "https://github.com/gagatun16/kyrsach20/tree/master/transactions_logs"
click node_test_proj "https://github.com/gagatun16/kyrsach20/blob/master/test.vcxproj"

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_main_cpp,node_proj_vcxproj,node_imgui_core,node_imgui_win32,node_imgui_gl toneBlue
class node_user_h,node_admin_h,node_wallet_h,node_txn_h,node_incoming_h,node_outgoing_h,node_internal_h,node_external_h toneAmber
class node_user_mgr,node_transfer_proc toneMint
class node_txn_log,node_users_store,node_wallets_store,node_txn_logs_dir toneRose
class node_test_proj toneIndigo
```

## Components

### UI Shell

Win32/OpenGL/ImGui front end and app entrypoint

- [main.cpp](https://github.com/gagatun16/kyrsach20/blob/master/main.cpp): entrypoint · Application entrypoint and runtime loop · `main.cpp`
- [Win32 app](https://github.com/gagatun16/kyrsach20/blob/master/example_win32_opengl3.vcxproj): project · Desktop GUI project definition · `example_win32_opengl3.vcxproj`
- [ImGui core](https://github.com/gagatun16/kyrsach20/blob/master/imgui.h): ui toolkit · Immediate-mode UI framework · `imgui.h`
- [Win32 bridge](https://github.com/gagatun16/kyrsach20/blob/master/imgui_impl_win32.h): platform layer · Windowing and input integration · `imgui_impl_win32.h`
- [OpenGL bridge](https://github.com/gagatun16/kyrsach20/blob/master/imgui_impl_opengl3.h): render layer · OpenGL renderer integration · `imgui_impl_opengl3.h`

### Domain Model

Users, balances, and transaction entities

- [User](https://github.com/gagatun16/kyrsach20/blob/master/User.h): entity · Account holder domain object · `User.h`
- [Admin](https://github.com/gagatun16/kyrsach20/blob/master/Admin.h): entity · Privileged user role · `Admin.h`
- [Wallet](https://github.com/gagatun16/kyrsach20/blob/master/WalletBalance.h): entity · Wallet balance and funds state · `WalletBalance.h`
- [Transaction](https://github.com/gagatun16/kyrsach20/blob/master/Transaction.h): entity · Base money-movement abstraction · `Transaction.h`
- [Incoming](https://github.com/gagatun16/kyrsach20/blob/master/incomingTransaction.h): transaction subtype · Incoming funds transaction · `incomingTransaction.h`
- [Outgoing](https://github.com/gagatun16/kyrsach20/blob/master/outgoingTransaction.h): transaction subtype · Outgoing funds transaction · `outgoingTransaction.h`
- [Internal xfer](https://github.com/gagatun16/kyrsach20/blob/master/internalTransfer.h): transaction subtype · Transfer within the system · `internalTransfer.h`
- [External withdraw](https://github.com/gagatun16/kyrsach20/blob/master/externalWithdrawal.h): transaction subtype · Withdrawal to an external destination · `externalWithdrawal.h`

### Processing

Orchestration and management services

- [UserManager](https://github.com/gagatun16/kyrsach20/blob/master/UserManager.h): controller · User registry and account operations · `UserManager.h`
- [TransferProcessor](https://github.com/gagatun16/kyrsach20/blob/master/TransferProcessor.h): orchestrator · Validates and executes transfers · `TransferProcessor.h`

### Persistence

Flat-file state and transaction records

- [TransactionLogger](https://github.com/gagatun16/kyrsach20/blob/master/TransactionLogger.h): logger · Writes transaction records · `TransactionLogger.h`
- [users.txt](https://github.com/gagatun16/kyrsach20/blob/master/users.txt): flat file · Persisted user records · `users.txt`
- [wallets.txt](https://github.com/gagatun16/kyrsach20/blob/master/wallets.txt): flat file · Persisted wallet state · `wallets.txt`
- [transactions_logs](https://github.com/gagatun16/kyrsach20/tree/master/transactions_logs): log store · Per-transaction text records · `transactions_logs`

### Build

Project and test harness

- [test.vcxproj](https://github.com/gagatun16/kyrsach20/blob/master/test.vcxproj): test project · Separate local test/build target · `test.vcxproj`

## Connections

- Win32 app → main.cpp: builds · Desktop executable is assembled from the app entrypoint and supporting code
- main.cpp → ImGui core: uses · Main loop drives the immediate-mode UI
- main.cpp → Win32 bridge: uses · Window and input plumbing
- main.cpp → OpenGL bridge: uses · Rendering backend hookup
- main.cpp → UserManager: commands · UI actions are routed into user/account operations
- main.cpp → TransferProcessor: commands · UI actions trigger transfer execution
- UserManager → User: manages · Registry operates on user entities
- User → Admin: specializes · Admin is a privileged user variant
- User → Wallet: owns · Users are associated with wallet state
- TransferProcessor → Transaction: coordinates · Processor works through the transaction abstraction
- Transaction → Incoming: subtype · Incoming money case
- Transaction → Outgoing: subtype · Outgoing money case
- Transaction → Internal xfer: subtype · Internal transfer case
- Transaction → External withdraw: subtype · External withdrawal case
- TransferProcessor → Wallet: updates · Balances are adjusted when transfers are accepted
- TransferProcessor → TransactionLogger: logs · Accepted transfers are recorded
- TransactionLogger → transactions_logs: writes · Transaction history is stored as text files
- UserManager → users.txt: persists · User registry state is serialized to flat files
- UserManager → wallets.txt: persists · Wallet data is stored separately
- test.vcxproj → UserManager: covers · Test build includes core domain and processing code
- test.vcxproj → TransferProcessor: covers · Test build exercises transfer logic
