# accyasser-cloud/flus architecture

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

- Interactive diagram: https://gitdiagram.com/accyasser-cloud/flus
- Repository: https://github.com/accyasser-cloud/flus

## Overview

Flus is a PHP/MySQL personal-finance application. Users register or log in, then manage transactions, categories, budgets, settings, and view dashboards and statistics; administrators also monitor the service and manage users. The runtime routes HTTP requests through controllers into domain services and models, with models using the shared database connection. The graph follows documented route and module references; unsampled view wiring and other uncertain links are omitted rather than inferred.

Main entry points: [`routes.php`](https://github.com/accyasser-cloud/flus/blob/main/routes.php) (Route Table), [`app/Controllers/TransactionController.php`](https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/TransactionController.php) (Transaction Controller), [`app/Models/Transaction.php`](https://github.com/accyasser-cloud/flus/blob/main/app/Models/Transaction.php) (Transactions), [`app/Core/Router.php`](https://github.com/accyasser-cloud/flus/blob/main/app/Core/Router.php) (Router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["HTTP Runtime"]
  node_index["Application Entry<br/>[index.php]"]
  node_routes["Route Table<br/>[routes.php]"]
  node_router["Router<br/>[Router.php]"]
  node_request["Request<br/>[Request.php]"]
  node_response["Response<br/>[Response.php]"]
  node_database[("Database Access<br/>[Database.php]")]
end

subgraph group_identity["Identity"]
  node_auth["Session Auth<br/>[Auth.php]"]
  node_authcontroller["Auth Controller<br/>[AuthController.php]"]
  node_authservice["Auth Service<br/>[AuthService.php]"]
  node_user_model["User Records<br/>[User.php]"]
end

subgraph group_finance["Finance Management"]
  node_transaction_controller["Transaction Controller"]
  node_transaction_service["Transaction Service"]
  node_transaction_model["Transactions<br/>[Transaction.php]"]
  node_category_controller["Category Controller"]
  node_category_service["Category Service"]
  node_category_model["Categories<br/>[Category.php]"]
  node_budget_controller["Budget Controller"]
  node_budget_service["Budget Service<br/>[BudgetService.php]"]
  node_budget_model["Budgets<br/>[Budget.php]"]
  node_transaction_view["Transaction Form<br/>[form.php]"]
end

subgraph group_insights["Insights and Settings"]
  node_dashboard_controller["Dashboard Controller"]
  node_statistics_controller["Statistics Controller"]
  node_statistics_service["Statistics Service"]
  node_settings_controller["Settings Controller"]
  node_settings_service["Settings Service"]
  node_settings_model["User Settings<br/>[UserSetting.php]"]
end

subgraph group_administration["Administration"]
  node_admin_dashboard["Admin Dashboard"]
  node_admin_users["Admin Users"]
  node_admin_service["Admin Service<br/>[AdminService.php]"]
end

node_user(("User"))

node_user -->|"sends request"| node_index
node_index -->|"dispatches"| node_router
node_index -->|"loads routes"| node_routes
node_router -->|"reads request"| node_request
node_router -->|"checks access"| node_auth
node_router -->|"sends response"| node_response
node_routes -->|"routes to"| node_authcontroller
node_routes -->|"routes to"| node_transaction_controller
node_routes -->|"routes to"| node_category_controller
node_routes -->|"routes to"| node_budget_controller
node_routes -->|"routes to"| node_dashboard_controller
node_routes -->|"routes to"| node_statistics_controller
node_routes -->|"routes to"| node_settings_controller
node_routes -->|"routes to"| node_admin_dashboard
node_routes -->|"routes to"| node_admin_users
node_authcontroller -->|"calls"| node_authservice
node_authservice -->|"uses records"| node_user_model
node_authservice -->|"manages session"| node_auth
node_transaction_controller -->|"calls"| node_transaction_service
node_transaction_controller -->|"reads input"| node_request
node_transaction_controller -->|"renders or redirects"| node_response
node_transaction_controller -->|"loads categories"| node_category_model
node_transaction_controller -->|"renders form"| node_transaction_view
node_transaction_service -->|"reads and writes"| node_transaction_model
node_transaction_service -->|"validates category"| node_category_model
node_category_controller -->|"calls"| node_category_service
node_category_service -->|"uses records"| node_category_model
node_budget_controller -->|"calls"| node_budget_service
node_budget_service -->|"uses records"| node_budget_model
node_budget_service -->|"reads totals"| node_transaction_model
node_dashboard_controller -->|"loads statistics"| node_statistics_service
node_dashboard_controller -->|"loads budgets"| node_budget_service
node_dashboard_controller -->|"loads transactions"| node_transaction_service
node_statistics_controller -->|"calls"| node_statistics_service
node_statistics_service -->|"queries totals"| node_transaction_model
node_settings_controller -->|"calls"| node_settings_service
node_settings_service -->|"uses settings"| node_settings_model
node_admin_dashboard -->|"loads metrics"| node_admin_service
node_admin_users -->|"manages users"| node_admin_service
node_admin_service -->|"manages accounts"| node_user_model
node_admin_service -->|"queries activity"| node_transaction_model
node_user_model -->|"queries database"| node_database
node_transaction_model -->|"queries database"| node_database
node_category_model -->|"queries database"| node_database
node_budget_model -->|"queries database"| node_database

click node_index "https://github.com/accyasser-cloud/flus/blob/main/index.php"
click node_routes "https://github.com/accyasser-cloud/flus/blob/main/routes.php"
click node_router "https://github.com/accyasser-cloud/flus/blob/main/app/Core/Router.php"
click node_request "https://github.com/accyasser-cloud/flus/blob/main/app/Core/Request.php"
click node_response "https://github.com/accyasser-cloud/flus/blob/main/app/Core/Response.php"
click node_database "https://github.com/accyasser-cloud/flus/blob/main/app/Core/Database.php"
click node_auth "https://github.com/accyasser-cloud/flus/blob/main/app/Core/Auth.php"
click node_authcontroller "https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/AuthController.php"
click node_authservice "https://github.com/accyasser-cloud/flus/blob/main/app/Services/AuthService.php"
click node_user_model "https://github.com/accyasser-cloud/flus/blob/main/app/Models/User.php"
click node_transaction_controller "https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/TransactionController.php"
click node_transaction_service "https://github.com/accyasser-cloud/flus/blob/main/app/Services/TransactionService.php"
click node_transaction_model "https://github.com/accyasser-cloud/flus/blob/main/app/Models/Transaction.php"
click node_category_controller "https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/CategoryController.php"
click node_category_service "https://github.com/accyasser-cloud/flus/blob/main/app/Services/CategoryService.php"
click node_category_model "https://github.com/accyasser-cloud/flus/blob/main/app/Models/Category.php"
click node_budget_controller "https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/BudgetController.php"
click node_budget_service "https://github.com/accyasser-cloud/flus/blob/main/app/Services/BudgetService.php"
click node_budget_model "https://github.com/accyasser-cloud/flus/blob/main/app/Models/Budget.php"
click node_transaction_view "https://github.com/accyasser-cloud/flus/blob/main/views/pages/transactions/form.php"
click node_dashboard_controller "https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/DashboardController.php"
click node_statistics_controller "https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/StatisticsController.php"
click node_statistics_service "https://github.com/accyasser-cloud/flus/blob/main/app/Services/StatisticsService.php"
click node_settings_controller "https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/SettingsController.php"
click node_settings_service "https://github.com/accyasser-cloud/flus/blob/main/app/Services/SettingsService.php"
click node_settings_model "https://github.com/accyasser-cloud/flus/blob/main/app/Models/UserSetting.php"
click node_admin_dashboard "https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/AdminDashboardController.php"
click node_admin_users "https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/AdminUsersController.php"
click node_admin_service "https://github.com/accyasser-cloud/flus/blob/main/app/Services/AdminService.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_index,node_routes,node_router,node_request,node_response,node_database,node_user toneBlue
class node_auth,node_authcontroller,node_authservice,node_user_model toneAmber
class node_transaction_controller,node_transaction_service,node_transaction_model,node_category_controller,node_category_service,node_category_model,node_budget_controller,node_budget_service,node_budget_model,node_transaction_view toneMint
class node_dashboard_controller,node_statistics_controller,node_statistics_service,node_settings_controller,node_settings_service,node_settings_model toneRose
class node_admin_dashboard,node_admin_users,node_admin_service toneIndigo
```

## Components

### HTTP Runtime

- [Application Entry](https://github.com/accyasser-cloud/flus/blob/main/index.php): `index.php`
- [Route Table](https://github.com/accyasser-cloud/flus/blob/main/routes.php): `routes.php`
- [Router](https://github.com/accyasser-cloud/flus/blob/main/app/Core/Router.php): `app/Core/Router.php`
- [Request](https://github.com/accyasser-cloud/flus/blob/main/app/Core/Request.php): `app/Core/Request.php`
- [Response](https://github.com/accyasser-cloud/flus/blob/main/app/Core/Response.php): `app/Core/Response.php`
- [Database Access](https://github.com/accyasser-cloud/flus/blob/main/app/Core/Database.php): `app/Core/Database.php`

### Identity

- [Session Auth](https://github.com/accyasser-cloud/flus/blob/main/app/Core/Auth.php): `app/Core/Auth.php`
- [Auth Controller](https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/AuthController.php): `app/Controllers/AuthController.php`
- [Auth Service](https://github.com/accyasser-cloud/flus/blob/main/app/Services/AuthService.php): `app/Services/AuthService.php`
- [User Records](https://github.com/accyasser-cloud/flus/blob/main/app/Models/User.php): `app/Models/User.php`

### Finance Management

- [Transaction Controller](https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/TransactionController.php): `app/Controllers/TransactionController.php`
- [Transaction Service](https://github.com/accyasser-cloud/flus/blob/main/app/Services/TransactionService.php): `app/Services/TransactionService.php`
- [Transactions](https://github.com/accyasser-cloud/flus/blob/main/app/Models/Transaction.php): `app/Models/Transaction.php`
- [Category Controller](https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/CategoryController.php): `app/Controllers/CategoryController.php`
- [Category Service](https://github.com/accyasser-cloud/flus/blob/main/app/Services/CategoryService.php): `app/Services/CategoryService.php`
- [Categories](https://github.com/accyasser-cloud/flus/blob/main/app/Models/Category.php): `app/Models/Category.php`
- [Budget Controller](https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/BudgetController.php): `app/Controllers/BudgetController.php`
- [Budget Service](https://github.com/accyasser-cloud/flus/blob/main/app/Services/BudgetService.php): `app/Services/BudgetService.php`
- [Budgets](https://github.com/accyasser-cloud/flus/blob/main/app/Models/Budget.php): `app/Models/Budget.php`
- [Transaction Form](https://github.com/accyasser-cloud/flus/blob/main/views/pages/transactions/form.php): `views/pages/transactions/form.php`

### Insights and Settings

- [Dashboard Controller](https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/DashboardController.php): `app/Controllers/DashboardController.php`
- [Statistics Controller](https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/StatisticsController.php): `app/Controllers/StatisticsController.php`
- [Statistics Service](https://github.com/accyasser-cloud/flus/blob/main/app/Services/StatisticsService.php): `app/Services/StatisticsService.php`
- [Settings Controller](https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/SettingsController.php): `app/Controllers/SettingsController.php`
- [Settings Service](https://github.com/accyasser-cloud/flus/blob/main/app/Services/SettingsService.php): `app/Services/SettingsService.php`
- [User Settings](https://github.com/accyasser-cloud/flus/blob/main/app/Models/UserSetting.php): `app/Models/UserSetting.php`

### Administration

- [Admin Dashboard](https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/AdminDashboardController.php): `app/Controllers/AdminDashboardController.php`
- [Admin Users](https://github.com/accyasser-cloud/flus/blob/main/app/Controllers/AdminUsersController.php): `app/Controllers/AdminUsersController.php`
- [Admin Service](https://github.com/accyasser-cloud/flus/blob/main/app/Services/AdminService.php): `app/Services/AdminService.php`

### Other components

- **User**

## Connections

- User → Application Entry: sends request
- Application Entry → Router: dispatches (evidence: `index.php`)
- Application Entry → Route Table: loads routes (evidence: `index.php`)
- Router → Request: reads request (evidence: `app/Core/Router.php`)
- Router → Session Auth: checks access (evidence: `app/Core/Router.php`)
- Router → Response: sends response (evidence: `app/Core/Router.php`)
- Route Table → Auth Controller: routes to (evidence: `routes.php`)
- Route Table → Transaction Controller: routes to (evidence: `routes.php`)
- Route Table → Category Controller: routes to (evidence: `routes.php`)
- Route Table → Budget Controller: routes to (evidence: `routes.php`)
- Route Table → Dashboard Controller: routes to (evidence: `routes.php`)
- Route Table → Statistics Controller: routes to (evidence: `routes.php`)
- Route Table → Settings Controller: routes to (evidence: `routes.php`)
- Route Table → Admin Dashboard: routes to (evidence: `routes.php`)
- Route Table → Admin Users: routes to (evidence: `routes.php`)
- Auth Controller → Auth Service: calls (evidence: `app/Controllers/AuthController.php`)
- Auth Service → User Records: uses records (evidence: `app/Services/AuthService.php`)
- Auth Service → Session Auth: manages session (evidence: `app/Services/AuthService.php`)
- Transaction Controller → Transaction Service: calls (evidence: `app/Controllers/TransactionController.php`)
- Transaction Controller → Request: reads input (evidence: `app/Controllers/TransactionController.php`)
- Transaction Controller → Response: renders or redirects (evidence: `app/Controllers/TransactionController.php`)
- Transaction Controller → Categories: loads categories (evidence: `app/Controllers/TransactionController.php`)
- Transaction Controller → Transaction Form: renders form (evidence: `app/Controllers/TransactionController.php`)
- Transaction Service → Transactions: reads and writes (evidence: `app/Services/TransactionService.php`)
- Transaction Service → Categories: validates category (evidence: `app/Services/TransactionService.php`)
- Category Controller → Category Service: calls (evidence: `app/Controllers/CategoryController.php`)
- Category Service → Categories: uses records (evidence: `app/Services/CategoryService.php`)
- Budget Controller → Budget Service: calls (evidence: `app/Controllers/BudgetController.php`)
- Budget Service → Budgets: uses records (evidence: `app/Services/BudgetService.php`)
- Budget Service → Transactions: reads totals (evidence: `app/Services/BudgetService.php`)
- Dashboard Controller → Statistics Service: loads statistics (evidence: `app/Controllers/DashboardController.php`)
- Dashboard Controller → Budget Service: loads budgets (evidence: `app/Controllers/DashboardController.php`)
- Dashboard Controller → Transaction Service: loads transactions (evidence: `app/Controllers/DashboardController.php`)
- Statistics Controller → Statistics Service: calls (evidence: `app/Controllers/StatisticsController.php`)
- Statistics Service → Transactions: queries totals (evidence: `app/Services/StatisticsService.php`)
- Settings Controller → Settings Service: calls (evidence: `app/Controllers/SettingsController.php`)
- Settings Service → User Settings: uses settings (evidence: `app/Services/SettingsService.php`)
- Admin Dashboard → Admin Service: loads metrics (evidence: `app/Controllers/AdminDashboardController.php`)
- Admin Users → Admin Service: manages users (evidence: `app/Controllers/AdminUsersController.php`)
- Admin Service → User Records: manages accounts (evidence: `app/Services/AdminService.php`)
- Admin Service → Transactions: queries activity (evidence: `app/Services/AdminService.php`)
- User Records → Database Access: queries database (evidence: `app/Models/User.php`)
- Transactions → Database Access: queries database (evidence: `app/Models/Transaction.php`)
- Categories → Database Access: queries database (evidence: `app/Models/Category.php`)
- Budgets → Database Access: queries database (evidence: `app/Models/Budget.php`)
