# mmrtonmoybd/tohobil architecture

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

- Interactive diagram: https://gitdiagram.com/mmrtonmoybd/tohobil
- Repository: https://github.com/mmrtonmoybd/tohobil

## Overview

Tohobil is an offline-first personal-finance app: users sign in, organize books and money records locally, and use planning, debt, wealth, vault, and reporting features; the app can synchronize backups with a PHP API. An admin site operates accounts and app services separately from users’ ledgers. The graph keeps local finance, synchronization, API, and operations as distinct areas. Some feature and controller internals were not sampled, so only documented or indexed relationships are shown; dashed edges mark documented-but-unsampled or optional integration links.

Main entry points: [`src/app/App.tsx`](https://github.com/mmrtonmoybd/tohobil/blob/main/src/app/App.tsx) (App routing), [`api/app/Config/Routes.php`](https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Config/Routes.php) (PHP API), [`src/db/repository.ts`](https://github.com/mmrtonmoybd/tohobil/blob/main/src/db/repository.ts) (Finance repository), [`src/features/money/QuickAdd.tsx`](https://github.com/mmrtonmoybd/tohobil/blob/main/src/features/money/QuickAdd.tsx) (Transaction entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile finance app"]
  node_app["App routing<br/>[App.tsx]"]
  node_identity["Identity and API client<br/>[identity.ts]"]
  node_identity_screens["Sign-in screens"]
  node_transactions["Transaction entry<br/>[QuickAdd.tsx]"]
  node_money_views["Money screens"]
  node_planning["Bills budgets goals"]
  node_debts["Debts and installments"]
  node_wealth["Assets and wealth<br/>[AssetsScreen.tsx]"]
  node_vault["Document vault"]
  node_reports["Reports and search"]
  node_settings["Settings and backup UI"]
end

subgraph group_local["Offline finance data"]
  node_local_store[("Finance repository<br/>[repository.ts]")]
  node_db_connection["Local database access<br/>[connection.ts]"]
  node_money_store["Finance state<br/>[store.ts]"]
  node_money_format["Currency and minor units<br/>[money.ts]"]
  node_display_prefs["Display preferences<br/>[displayPrefs.ts]"]
  node_file_storage["Attachment storage<br/>[fileStorage.ts]"]
end

subgraph group_sync["Sync and API"]
  node_sync_engine["Sync engine<br/>[engine.ts]"]
  node_upload_queue["Attachment upload queue<br/>[uploadQueue.ts]"]
  node_api["PHP API<br/>[Routes.php]"]
  node_api_sync["Server sync service<br/>[SyncService.php]"]
  node_api_files["Server file service<br/>[FileService.php]"]
  node_api_auth["API identity endpoints<br/>[Auth.php]"]
  node_api_database[("Server database<br/>[Database.php]")]
  node_cron["Scheduled services"]
  node_rates[("Stored exchange rates")]
end

subgraph group_ops["Operations and administration"]
  node_admin_site["Admin site routing<br/>[App.tsx]"]
  node_admin_auth["Admin authentication<br/>[auth.tsx]"]
  node_admin_api["Admin API client<br/>[api.ts]"]
  node_admin_capabilities["User device and service operations"]
  node_admin_controllers["Admin API endpoints"]
end

node_user(("Finance user"))
node_admin_user(("Operations staff"))
node_rate_provider(("Exchange-rate provider"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_identity_screens
node_app -->|"routes to"| node_transactions
node_app -.->|"routes to"| node_money_views
node_app -.->|"routes to"| node_planning
node_app -.->|"routes to"| node_debts
node_app -.->|"routes to"| node_wealth
node_app -.->|"routes to"| node_vault
node_app -.->|"routes to"| node_reports
node_app -->|"routes to"| node_settings
node_identity_screens -->|"uses"| node_identity
node_identity -.->|"sends API requests"| node_api
node_transactions -->|"saves entries"| node_money_store
node_transactions -->|"uses repository"| node_local_store
node_money_store -->|"delegates writes"| node_local_store
node_local_store -->|"queries"| node_db_connection
node_money_store -->|"converts amounts"| node_money_format
node_money_format -->|"reads preferences"| node_display_prefs
node_settings -->|"manages cache"| node_file_storage
node_settings -->|"reads storage usage"| node_local_store
node_sync_engine -->|"reads local changes"| node_db_connection
node_sync_engine -->|"synchronizes backup"| node_api
node_upload_queue -->|"uses attachments"| node_file_storage
node_upload_queue -->|"uses credentials"| node_identity
node_api -->|"routes sync requests"| node_api_sync
node_api -->|"routes sign-in"| node_api_auth
node_api_sync -->|"persists synchronized data"| node_api_database
node_api -.->|"routes file requests"| node_api_files
node_admin_user -->|"operates"| node_admin_site
node_admin_site -->|"provides authentication"| node_admin_auth
node_admin_site -->|"routes operations"| node_admin_capabilities
node_admin_auth -->|"uses API client"| node_admin_api
node_admin_capabilities -.->|"calls API"| node_admin_api
node_admin_api -.->|"requests operations"| node_admin_controllers
node_cron -.->|"refreshes snapshot"| node_rates
node_rate_provider -->|"supplies rates"| node_rates
node_api -->|"serves stored rates"| node_rates

click node_app "https://github.com/mmrtonmoybd/tohobil/blob/main/src/app/App.tsx"
click node_identity "https://github.com/mmrtonmoybd/tohobil/blob/main/src/app/identity.ts"
click node_identity_screens "https://github.com/mmrtonmoybd/tohobil/blob/main/src/app/IdentityScreens.tsx"
click node_transactions "https://github.com/mmrtonmoybd/tohobil/blob/main/src/features/money/QuickAdd.tsx"
click node_money_views "https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/money"
click node_planning "https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/planning"
click node_debts "https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/debts"
click node_wealth "https://github.com/mmrtonmoybd/tohobil/blob/main/src/features/wealth/AssetsScreen.tsx"
click node_vault "https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/vault"
click node_reports "https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/reports"
click node_settings "https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/settings"
click node_local_store "https://github.com/mmrtonmoybd/tohobil/blob/main/src/db/repository.ts"
click node_db_connection "https://github.com/mmrtonmoybd/tohobil/blob/main/src/db/connection.ts"
click node_money_store "https://github.com/mmrtonmoybd/tohobil/blob/main/src/features/money/store.ts"
click node_money_format "https://github.com/mmrtonmoybd/tohobil/blob/main/src/lib/money.ts"
click node_display_prefs "https://github.com/mmrtonmoybd/tohobil/blob/main/src/lib/displayPrefs.ts"
click node_file_storage "https://github.com/mmrtonmoybd/tohobil/blob/main/src/lib/fileStorage.ts"
click node_sync_engine "https://github.com/mmrtonmoybd/tohobil/blob/main/src/sync/engine.ts"
click node_upload_queue "https://github.com/mmrtonmoybd/tohobil/blob/main/src/sync/uploadQueue.ts"
click node_api "https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Config/Routes.php"
click node_api_sync "https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Services/SyncService.php"
click node_api_files "https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Services/FileService.php"
click node_api_auth "https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Controllers/Api/V1/Auth.php"
click node_api_database "https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Config/Database.php"
click node_admin_site "https://github.com/mmrtonmoybd/tohobil/blob/main/admin/src/App.tsx"
click node_admin_auth "https://github.com/mmrtonmoybd/tohobil/blob/main/admin/src/lib/auth.tsx"
click node_admin_api "https://github.com/mmrtonmoybd/tohobil/blob/main/admin/src/lib/api.ts"
click node_admin_capabilities "https://github.com/mmrtonmoybd/tohobil/tree/main/admin/src/pages"
click node_admin_controllers "https://github.com/mmrtonmoybd/tohobil/tree/main/api/app/Controllers/Admin"
click node_cron "https://github.com/mmrtonmoybd/tohobil/tree/main/api/app/Commands"
click node_rates "https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Services/ExchangeRateService.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_app,node_identity,node_identity_screens,node_transactions,node_money_views,node_planning,node_debts,node_wealth,node_vault,node_reports,node_settings,node_user toneBlue
class node_local_store,node_db_connection,node_money_store,node_money_format,node_display_prefs,node_file_storage toneAmber
class node_sync_engine,node_upload_queue,node_api,node_api_sync,node_api_files,node_api_auth,node_api_database,node_cron,node_rates toneMint
class node_admin_site,node_admin_auth,node_admin_api,node_admin_capabilities,node_admin_controllers toneRose
class node_admin_user,node_rate_provider toneIndigo
```

## Components

### Mobile finance app

- [App routing](https://github.com/mmrtonmoybd/tohobil/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [Identity and API client](https://github.com/mmrtonmoybd/tohobil/blob/main/src/app/identity.ts): `src/app/identity.ts`
- [Sign-in screens](https://github.com/mmrtonmoybd/tohobil/blob/main/src/app/IdentityScreens.tsx): `src/app/IdentityScreens.tsx`
- [Transaction entry](https://github.com/mmrtonmoybd/tohobil/blob/main/src/features/money/QuickAdd.tsx): `src/features/money/QuickAdd.tsx`
- [Money screens](https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/money): `src/features/money`
- [Bills budgets goals](https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/planning): `src/features/planning`
- [Debts and installments](https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/debts): `src/features/debts`
- [Assets and wealth](https://github.com/mmrtonmoybd/tohobil/blob/main/src/features/wealth/AssetsScreen.tsx): `src/features/wealth/AssetsScreen.tsx`
- [Document vault](https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/vault): `src/features/vault`
- [Reports and search](https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/reports): `src/features/reports`
- [Settings and backup UI](https://github.com/mmrtonmoybd/tohobil/tree/main/src/features/settings): `src/features/settings`

### Offline finance data

- [Finance repository](https://github.com/mmrtonmoybd/tohobil/blob/main/src/db/repository.ts): `src/db/repository.ts`
- [Local database access](https://github.com/mmrtonmoybd/tohobil/blob/main/src/db/connection.ts): `src/db/connection.ts`
- [Finance state](https://github.com/mmrtonmoybd/tohobil/blob/main/src/features/money/store.ts): `src/features/money/store.ts`
- [Currency and minor units](https://github.com/mmrtonmoybd/tohobil/blob/main/src/lib/money.ts): `src/lib/money.ts`
- [Display preferences](https://github.com/mmrtonmoybd/tohobil/blob/main/src/lib/displayPrefs.ts): `src/lib/displayPrefs.ts`
- [Attachment storage](https://github.com/mmrtonmoybd/tohobil/blob/main/src/lib/fileStorage.ts): `src/lib/fileStorage.ts`

### Sync and API

- [Sync engine](https://github.com/mmrtonmoybd/tohobil/blob/main/src/sync/engine.ts): `src/sync/engine.ts`
- [Attachment upload queue](https://github.com/mmrtonmoybd/tohobil/blob/main/src/sync/uploadQueue.ts): `src/sync/uploadQueue.ts`
- [PHP API](https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Config/Routes.php): `api/app/Config/Routes.php`
- [Server sync service](https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Services/SyncService.php): `api/app/Services/SyncService.php`
- [Server file service](https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Services/FileService.php): `api/app/Services/FileService.php`
- [API identity endpoints](https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Controllers/Api/V1/Auth.php): `api/app/Controllers/Api/V1/Auth.php`
- [Server database](https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Config/Database.php): `api/app/Config/Database.php`
- [Scheduled services](https://github.com/mmrtonmoybd/tohobil/tree/main/api/app/Commands): `api/app/Commands`
- [Stored exchange rates](https://github.com/mmrtonmoybd/tohobil/blob/main/api/app/Services/ExchangeRateService.php): `api/app/Services/ExchangeRateService.php`

### Operations and administration

- [Admin site routing](https://github.com/mmrtonmoybd/tohobil/blob/main/admin/src/App.tsx): `admin/src/App.tsx`
- [Admin authentication](https://github.com/mmrtonmoybd/tohobil/blob/main/admin/src/lib/auth.tsx): `admin/src/lib/auth.tsx`
- [Admin API client](https://github.com/mmrtonmoybd/tohobil/blob/main/admin/src/lib/api.ts): `admin/src/lib/api.ts`
- [User device and service operations](https://github.com/mmrtonmoybd/tohobil/tree/main/admin/src/pages): `admin/src/pages`
- [Admin API endpoints](https://github.com/mmrtonmoybd/tohobil/tree/main/api/app/Controllers/Admin): `api/app/Controllers/Admin`

### Other components

- **Finance user**
- **Operations staff**
- **Exchange-rate provider**

## Connections

- Finance user → App routing: uses (evidence: `README.md`)
- App routing → Sign-in screens: routes to (evidence: `src/app/App.tsx`)
- App routing → Transaction entry: routes to (evidence: `src/app/App.tsx`)
- App routing → Money screens: routes to (evidence: `src/app/App.tsx`)
- App routing → Bills budgets goals: routes to (evidence: `src/app/App.tsx`)
- App routing → Debts and installments: routes to (evidence: `src/app/App.tsx`)
- App routing → Assets and wealth: routes to (evidence: `src/app/App.tsx`)
- App routing → Document vault: routes to (evidence: `src/app/App.tsx`)
- App routing → Reports and search: routes to (evidence: `src/app/App.tsx`)
- App routing → Settings and backup UI: routes to (evidence: `src/app/App.tsx`)
- Sign-in screens → Identity and API client: uses (evidence: `src/app/IdentityScreens.tsx`)
- Identity and API client → PHP API: sends API requests (evidence: `README.md`)
- Transaction entry → Finance state: saves entries (evidence: `src/features/money/QuickAdd.tsx`)
- Transaction entry → Finance repository: uses repository (evidence: `src/features/money/QuickAdd.tsx`)
- Finance state → Finance repository: delegates writes (evidence: `src/features/money/store.ts`)
- Finance repository → Local database access: queries (evidence: `src/db/repository.ts`)
- Finance state → Currency and minor units: converts amounts (evidence: `src/features/money/store.ts`)
- Currency and minor units → Display preferences: reads preferences (evidence: `src/lib/money.ts`)
- Settings and backup UI → Attachment storage: manages cache (evidence: `src/features/settings/StorageSettingsScreen.tsx`)
- Settings and backup UI → Finance repository: reads storage usage (evidence: `src/features/settings/StorageSettingsScreen.tsx`)
- Sync engine → Local database access: reads local changes (evidence: `src/sync/engine.ts`)
- Sync engine → PHP API: synchronizes backup (evidence: `README.md`)
- Attachment upload queue → Attachment storage: uses attachments (evidence: `src/sync/uploadQueue.ts`)
- Attachment upload queue → Identity and API client: uses credentials (evidence: `src/sync/uploadQueue.ts`)
- PHP API → Server sync service: routes sync requests (evidence: `api/app/Config/Routes.php`)
- PHP API → API identity endpoints: routes sign-in (evidence: `api/app/Config/Routes.php`)
- Server sync service → Server database: persists synchronized data (evidence: `api/app/Services/SyncService.php`)
- PHP API → Server file service: routes file requests
- Operations staff → Admin site routing: operates (evidence: `README.md`)
- Admin site routing → Admin authentication: provides authentication (evidence: `admin/src/App.tsx`)
- Admin site routing → User device and service operations: routes operations (evidence: `admin/src/App.tsx`)
- Admin authentication → Admin API client: uses API client (evidence: `admin/src/lib/auth.tsx`)
- User device and service operations → Admin API client: calls API (evidence: `admin/src/pages/StoragePage.tsx`)
- Admin API client → Admin API endpoints: requests operations
- Scheduled services → Stored exchange rates: refreshes snapshot (evidence: `README.md`)
- Exchange-rate provider → Stored exchange rates: supplies rates (evidence: `README.md`)
- PHP API → Stored exchange rates: serves stored rates (evidence: `README.md`)
