# joaomateusferr/financial-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/joaomateusferr/financial-dashboard
- Repository: https://github.com/joaomateusferr/financial-dashboard

## Overview

This is a PHP financial dashboard intended to automate personal finances and investments. Its visible web workflow serves sign-in and login pages, submits account/session operations through the UI controller to the API, then routes authenticated users to dashboard views. The API also exposes user/session and common investment-reference data, including exchange-traded assets. The tree contains additional finance and automation services for income reports, prices, AI categorization, email, and shared memory; their detailed runtime wiring is not shown, so uncertain links are omitted.

Main entry points: [`app/routes.php`](https://github.com/joaomateusferr/financial-dashboard/blob/main/app/routes.php) (Route table), [`src/UiControllers/OperationController.php`](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/UiControllers/OperationController.php) (Account operations), [`src/Controllers/ExchangeTradedAssetsController.php`](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Controllers/ExchangeTradedAssetsController.php) (Asset endpoints), [`src/Controllers/SessionController.php`](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Controllers/SessionController.php) (Sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_entry["HTTP entry<br/>[index.php]"]
  node_routes["Route table<br/>[routes.php]"]
  node_home["Home pages<br/>[HomeController.php]"]
  node_operations["Account operations"]
  node_dashboard["Dashboard view"]
  node_ui["Page templates"]
end

subgraph group_identity["Identity and API"]
  node_api["API responses<br/>[ApiBase.php]"]
  node_user_api["User accounts<br/>[UserController.php]"]
  node_session_api["Sessions"]
  node_auth["Auth gate<br/>[AuthMiddleware.php]"]
  node_user_repo["User repository<br/>[UserRepository.php]"]
  node_session_repo["Session repository"]
end

subgraph group_investments["Investment data"]
  node_assets_api["Asset endpoints"]
  node_asset_repo["Traded assets"]
  node_exchange_repo["Exchange lookup"]
  node_reference_api["Reference endpoints"]
end

subgraph group_finance["Finance services"]
  node_income_report["B3 income report<br/>[B3IncomeReport.php]"]
  node_categorization["Transaction categorization"]
  node_prices["Asset close prices"]
  node_email["Email delivery<br/>[EmailSender.php]"]
  node_shared_memory["Shared memory<br/>[SharedMemory.php]"]
end

subgraph group_infrastructure["Persistence"]
  node_database[("MariaDB access<br/>[MariaDB.php]")]
end

node_user(("Dashboard user"))

node_user -.->|"requests pages"| node_entry
node_entry -->|"loads routes"| node_routes
node_routes -->|"routes pages"| node_home
node_routes -->|"routes submissions"| node_operations
node_routes -->|"routes dashboard"| node_dashboard
node_routes -->|"routes API"| node_user_api
node_routes -->|"routes API"| node_session_api
node_routes -->|"routes assets"| node_assets_api
node_routes -->|"routes reference data"| node_reference_api
node_home -->|"renders pages"| node_ui
node_dashboard -.->|"renders dashboard"| node_ui
node_operations -.->|"builds responses"| node_api
node_operations -->|"requests account API"| node_user_api
node_operations -->|"requests session API"| node_session_api
node_user_api -->|"queries users"| node_user_repo
node_session_api -->|"looks up user"| node_user_repo
node_session_api -->|"manages sessions"| node_session_repo
node_auth -->|"checks session"| node_session_repo
node_routes -->|"protects routes"| node_auth
node_assets_api -->|"checks admin"| node_session_repo
node_assets_api -->|"validates exchanges"| node_exchange_repo
node_assets_api -->|"inserts and updates"| node_asset_repo
node_user_repo -->|"queries database"| node_database
node_session_repo -->|"queries database"| node_database
node_asset_repo -->|"queries database"| node_database
node_exchange_repo -->|"queries database"| node_database

click node_entry "https://github.com/joaomateusferr/financial-dashboard/blob/main/public/index.php"
click node_routes "https://github.com/joaomateusferr/financial-dashboard/blob/main/app/routes.php"
click node_home "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/UiControllers/HomeController.php"
click node_operations "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/UiControllers/OperationController.php"
click node_dashboard "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/UiControllers/DashboardController.php"
click node_ui "https://github.com/joaomateusferr/financial-dashboard/tree/main/views"
click node_api "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/ApiBase.php"
click node_user_api "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Controllers/UserController.php"
click node_session_api "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Controllers/SessionController.php"
click node_auth "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Middlewares/AuthMiddleware.php"
click node_user_repo "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Repositories/UserRepository.php"
click node_session_repo "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Repositories/SessionRepository.php"
click node_assets_api "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Controllers/ExchangeTradedAssetsController.php"
click node_asset_repo "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Repositories/ExchangeTradedAssetsRepository.php"
click node_exchange_repo "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Repositories/ExchangeRepository.php"
click node_reference_api "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Controllers/AssetQualificationController.php"
click node_income_report "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/B3IncomeReport.php"
click node_categorization "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/TransactionAiCategorization.php"
click node_prices "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/AssetsClosePrice.php"
click node_email "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/EmailSender.php"
click node_shared_memory "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/SharedMemory.php"
click node_database "https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/MariaDB.php"

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_entry,node_routes,node_home,node_operations,node_dashboard,node_ui,node_user toneBlue
class node_api,node_user_api,node_session_api,node_auth,node_user_repo,node_session_repo toneAmber
class node_assets_api,node_asset_repo,node_exchange_repo,node_reference_api toneMint
class node_income_report,node_categorization,node_prices,node_email,node_shared_memory toneRose
class node_database toneIndigo
```

## Components

### Web experience

- [HTTP entry](https://github.com/joaomateusferr/financial-dashboard/blob/main/public/index.php): `public/index.php`
- [Route table](https://github.com/joaomateusferr/financial-dashboard/blob/main/app/routes.php): `app/routes.php`
- [Home pages](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/UiControllers/HomeController.php): `src/UiControllers/HomeController.php`
- [Account operations](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/UiControllers/OperationController.php): `src/UiControllers/OperationController.php`
- [Dashboard view](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/UiControllers/DashboardController.php): `src/UiControllers/DashboardController.php`
- [Page templates](https://github.com/joaomateusferr/financial-dashboard/tree/main/views): `views`

### Identity and API

- [API responses](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/ApiBase.php): `src/Services/ApiBase.php`
- [User accounts](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Controllers/UserController.php): `src/Controllers/UserController.php`
- [Sessions](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Controllers/SessionController.php): `src/Controllers/SessionController.php`
- [Auth gate](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Middlewares/AuthMiddleware.php): `src/Middlewares/AuthMiddleware.php`
- [User repository](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Repositories/UserRepository.php): `src/Repositories/UserRepository.php`
- [Session repository](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Repositories/SessionRepository.php): `src/Repositories/SessionRepository.php`

### Investment data

- [Asset endpoints](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Controllers/ExchangeTradedAssetsController.php): `src/Controllers/ExchangeTradedAssetsController.php`
- [Traded assets](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Repositories/ExchangeTradedAssetsRepository.php): `src/Repositories/ExchangeTradedAssetsRepository.php`
- [Exchange lookup](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Repositories/ExchangeRepository.php): `src/Repositories/ExchangeRepository.php`
- [Reference endpoints](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Controllers/AssetQualificationController.php): `src/Controllers/AssetQualificationController.php`

### Finance services

- [B3 income report](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/B3IncomeReport.php): `src/Services/B3IncomeReport.php`
- [Transaction categorization](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/TransactionAiCategorization.php): `src/Services/TransactionAiCategorization.php`
- [Asset close prices](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/AssetsClosePrice.php): `src/Services/AssetsClosePrice.php`
- [Email delivery](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/EmailSender.php): `src/Services/EmailSender.php`
- [Shared memory](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/SharedMemory.php): `src/Services/SharedMemory.php`

### Persistence

- [MariaDB access](https://github.com/joaomateusferr/financial-dashboard/blob/main/src/Services/MariaDB.php): `src/Services/MariaDB.php`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → HTTP entry: requests pages
- HTTP entry → Route table: loads routes (evidence: `public/index.php`)
- Route table → Home pages: routes pages (evidence: `app/routes.php`)
- Route table → Account operations: routes submissions (evidence: `app/routes.php`)
- Route table → Dashboard view: routes dashboard (evidence: `app/routes.php`)
- Route table → User accounts: routes API (evidence: `app/routes.php`)
- Route table → Sessions: routes API (evidence: `app/routes.php`)
- Route table → Asset endpoints: routes assets (evidence: `app/routes.php`)
- Route table → Reference endpoints: routes reference data (evidence: `app/routes.php`)
- Home pages → Page templates: renders pages (evidence: `src/UiControllers/HomeController.php`)
- Dashboard view → Page templates: renders dashboard
- Account operations → API responses: builds responses
- Account operations → User accounts: requests account API (evidence: `src/UiControllers/OperationController.php`)
- Account operations → Sessions: requests session API (evidence: `src/UiControllers/OperationController.php`)
- User accounts → User repository: queries users (evidence: `src/Controllers/UserController.php`)
- Sessions → User repository: looks up user (evidence: `src/Controllers/SessionController.php`)
- Sessions → Session repository: manages sessions (evidence: `src/Controllers/SessionController.php`)
- Auth gate → Session repository: checks session (evidence: `src/Middlewares/AuthMiddleware.php`)
- Route table → Auth gate: protects routes (evidence: `app/routes.php`)
- Asset endpoints → Session repository: checks admin (evidence: `src/Controllers/ExchangeTradedAssetsController.php`)
- Asset endpoints → Exchange lookup: validates exchanges (evidence: `src/Controllers/ExchangeTradedAssetsController.php`)
- Asset endpoints → Traded assets: inserts and updates (evidence: `src/Controllers/ExchangeTradedAssetsController.php`)
- User repository → MariaDB access: queries database (evidence: `src/Repositories/UserRepository.php`)
- Session repository → MariaDB access: queries database (evidence: `src/Repositories/SessionRepository.php`)
- Traded assets → MariaDB access: queries database (evidence: `src/Repositories/ExchangeTradedAssetsRepository.php`)
- Exchange lookup → MariaDB access: queries database (evidence: `src/Repositories/ExchangeRepository.php`)
