# firta/myfinance architecture

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

- Interactive diagram: https://gitdiagram.com/firta/myfinance
- Repository: https://github.com/firta/myfinance

## Overview

MyFinance is a personal-finance API: clients use account, category, budget, transaction, transfer, and user/auth endpoints, with services applying domain operations and repositories persisting records. Authentication supports registration, login, refresh, and logout; the sampled auth service also provisions a default account and uses Redis for access-token lookup. Entity Framework models the finance and identity data in SQLite. Several controllers and services are indexed but unsampled, so their likely interactions are represented as capabilities without speculative call edges.

Main entry points: [`Controllers`](https://github.com/firta/myfinance/tree/master/Controllers) (Finance endpoints), [`Services/AuthService.cs`](https://github.com/firta/myfinance/blob/master/Services/AuthService.cs) (Authentication), [`Data/Context/AppDbContext.cs`](https://github.com/firta/myfinance/blob/master/Data/Context/AppDbContext.cs) (EF data context), [`Services/AccountService.cs`](https://github.com/firta/myfinance/blob/master/Services/AccountService.cs) (Accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API surface"]
  node_controllers["Finance endpoints"]
  node_auth_controller["Auth endpoints<br/>[AuthController.cs]"]
  node_api_responses["API responses<br/>[ApiResponse.cs]"]
end

subgraph group_finance["Finance domain"]
  node_account["Accounts<br/>[AccountService.cs]"]
  node_category["Categories<br/>[CategoryService.cs]"]
  node_budget["Budgets<br/>[BudgetService.cs]"]
  node_transactions["Transactions"]
  node_transfers["Transfers<br/>[TransferService.cs]"]
  node_account_dto["Account DTO<br/>[AccountDto.cs]"]
end

subgraph group_identity["Identity and access"]
  node_user_dto["User DTO<br/>[UserDto.cs]"]
  node_auth["Authentication<br/>[AuthService.cs]"]
  node_tokens["Token lifecycle<br/>[TokenService.cs]"]
  node_redis[("Redis cache<br/>[RedisService.cs]")]
  node_email["Email worker and queue"]
end

subgraph group_persistence["Persistence and infrastructure"]
  node_repositories["Repository operations<br/>[Repository.cs]"]
  node_db_context["EF data context<br/>[AppDbContext.cs]"]
  node_finance_entities["Finance records"]
  node_identity_entities["User and refresh records"]
  node_database[("SQLite database")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_controllers
node_client -->|"sends requests"| node_auth_controller
node_controllers -->|"calls"| node_account
node_controllers -->|"calls"| node_category
node_controllers -->|"calls"| node_budget
node_controllers -->|"calls"| node_transfers
node_auth_controller -->|"calls"| node_auth
node_auth -->|"generates tokens"| node_tokens
node_auth -->|"stores token"| node_redis
node_auth -->|"provisions account"| node_account
node_auth -->|"creates user DTO"| node_user_dto
node_account -->|"maps data"| node_account_dto
node_transactions -->|"creates transactions"| node_finance_entities
node_transactions -->|"reads and writes"| node_repositories
node_repositories -->|"uses context"| node_db_context
node_db_context -->|"maps records"| node_finance_entities
node_db_context -->|"maps records"| node_identity_entities
node_db_context -.->|"persists records"| node_database

click node_controllers "https://github.com/firta/myfinance/tree/master/Controllers"
click node_auth_controller "https://github.com/firta/myfinance/blob/master/Controllers/AuthController.cs"
click node_api_responses "https://github.com/firta/myfinance/blob/master/Responses/ApiResponse.cs"
click node_account "https://github.com/firta/myfinance/blob/master/Services/AccountService.cs"
click node_category "https://github.com/firta/myfinance/blob/master/Services/CategoryService.cs"
click node_budget "https://github.com/firta/myfinance/blob/master/Services/BudgetService.cs"
click node_transactions "https://github.com/firta/myfinance/blob/master/Services/TransactionService.cs"
click node_transfers "https://github.com/firta/myfinance/blob/master/Services/TransferService.cs"
click node_account_dto "https://github.com/firta/myfinance/blob/master/Dtos/AccountDto.cs"
click node_user_dto "https://github.com/firta/myfinance/blob/master/Dtos/UserDto.cs"
click node_auth "https://github.com/firta/myfinance/blob/master/Services/AuthService.cs"
click node_tokens "https://github.com/firta/myfinance/blob/master/Services/TokenService.cs"
click node_redis "https://github.com/firta/myfinance/blob/master/Services/RedisService.cs"
click node_repositories "https://github.com/firta/myfinance/blob/master/Repositories/Repository.cs"
click node_db_context "https://github.com/firta/myfinance/blob/master/Data/Context/AppDbContext.cs"
click node_finance_entities "https://github.com/firta/myfinance/tree/master/Data/Entities"
click node_identity_entities "https://github.com/firta/myfinance/tree/master/Data/Entities"
click node_email "https://github.com/firta/myfinance/tree/master/Services/EmailService"

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_controllers,node_auth_controller,node_api_responses,node_client toneBlue
class node_account,node_category,node_budget,node_transactions,node_transfers,node_account_dto toneAmber
class node_user_dto,node_auth,node_tokens,node_redis,node_email toneMint
class node_repositories,node_db_context,node_finance_entities,node_identity_entities,node_database toneRose
```

## Components

### API surface

- [Finance endpoints](https://github.com/firta/myfinance/tree/master/Controllers): `Controllers`
- [Auth endpoints](https://github.com/firta/myfinance/blob/master/Controllers/AuthController.cs): `Controllers/AuthController.cs`
- [API responses](https://github.com/firta/myfinance/blob/master/Responses/ApiResponse.cs): `Responses/ApiResponse.cs`

### Finance domain

- [Accounts](https://github.com/firta/myfinance/blob/master/Services/AccountService.cs): `Services/AccountService.cs`
- [Categories](https://github.com/firta/myfinance/blob/master/Services/CategoryService.cs): `Services/CategoryService.cs`
- [Budgets](https://github.com/firta/myfinance/blob/master/Services/BudgetService.cs): `Services/BudgetService.cs`
- [Transactions](https://github.com/firta/myfinance/blob/master/Services/TransactionService.cs): `Services/TransactionService.cs`
- [Transfers](https://github.com/firta/myfinance/blob/master/Services/TransferService.cs): `Services/TransferService.cs`
- [Account DTO](https://github.com/firta/myfinance/blob/master/Dtos/AccountDto.cs): `Dtos/AccountDto.cs`

### Identity and access

- [User DTO](https://github.com/firta/myfinance/blob/master/Dtos/UserDto.cs): `Dtos/UserDto.cs`
- [Authentication](https://github.com/firta/myfinance/blob/master/Services/AuthService.cs): `Services/AuthService.cs`
- [Token lifecycle](https://github.com/firta/myfinance/blob/master/Services/TokenService.cs): `Services/TokenService.cs`
- [Redis cache](https://github.com/firta/myfinance/blob/master/Services/RedisService.cs): `Services/RedisService.cs`
- [Email worker and queue](https://github.com/firta/myfinance/tree/master/Services/EmailService): `Services/EmailService`

### Persistence and infrastructure

- [Repository operations](https://github.com/firta/myfinance/blob/master/Repositories/Repository.cs): `Repositories/Repository.cs`
- [EF data context](https://github.com/firta/myfinance/blob/master/Data/Context/AppDbContext.cs): `Data/Context/AppDbContext.cs`
- [Finance records](https://github.com/firta/myfinance/tree/master/Data/Entities): `Data/Entities`
- [User and refresh records](https://github.com/firta/myfinance/tree/master/Data/Entities): `Data/Entities`
- **SQLite database**

### Other components

- **API client**

## Connections

- API client → Finance endpoints: sends requests
- API client → Auth endpoints: sends requests
- Finance endpoints → Accounts: calls (evidence: `Controllers/AccountController.cs`)
- Finance endpoints → Categories: calls (evidence: `Controllers/CategoryController.cs`)
- Finance endpoints → Budgets: calls (evidence: `Controllers/BudgetController.cs`)
- Finance endpoints → Transfers: calls (evidence: `Controllers/TransferController.cs`)
- Auth endpoints → Authentication: calls (evidence: `Controllers/AuthController.cs`)
- Authentication → Token lifecycle: generates tokens (evidence: `Services/AuthService.cs`)
- Authentication → Redis cache: stores token (evidence: `Services/AuthService.cs`)
- Authentication → Accounts: provisions account (evidence: `Services/AuthService.cs`)
- Authentication → User DTO: creates user DTO (evidence: `Services/AuthService.cs`)
- Accounts → Account DTO: maps data (evidence: `Services/AccountService.cs`)
- Transactions → Finance records: creates transactions (evidence: `Services/TransactionService.cs`)
- Transactions → Repository operations: reads and writes (evidence: `Services/TransactionService.cs`)
- Repository operations → EF data context: uses context (evidence: `Repositories/Repository.cs`)
- EF data context → Finance records: maps records (evidence: `Data/Context/AppDbContext.cs`)
- EF data context → User and refresh records: maps records (evidence: `Data/Context/AppDbContext.cs`)
- EF data context → SQLite database: persists records
