# arduia/proexpense architecture

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

- Interactive diagram: https://gitdiagram.com/arduia/proexpense
- Repository: https://github.com/arduia/proexpense

## Overview

#### Purpose and runtime
Pro Expense is a Kotlin/Android finance-note application (API 21+) for locally recording daily income and expenses, viewing logs, summaries, and category statistics. Privacy-oriented constraints exclude multi-account and cloud backup. The installable Android app is the `app` module; reusable Android/library modules provide backup, graph, currency, and shared primitives.

Key build roots: `settings.gradle.kts`, `app/build.gradle.kts`, `app/src/main/AndroidManifest.xml`.

#### Application bootstrap and navigation
`ExpenseApplication` is the process entry point and initializes the DI-backed application. `MainActivity` hosts the primary fragment-based UI; `MainHost`, the navigation drawer, and Navigation component graph establish screen transitions. Startup routes through splash/onboarding before the main experience, with persisted settings determining language, currency, and configuration state.

Paths:
- `app/src/main/java/com/arduia/expense/ExpenseApplication.kt`
- `app/src/main/java/com/arduia/expense/ui/MainActivity.kt`
- `app/src/main/res/navigation/main_nav.xml`

#### Presentation layer: MVVM feature flows
Feature fragments delegate state and actions to view models. Core flows are expense entry/editing, pageable/filterable expense logs, home/dashboard summaries, and statistics. UI-specific models and mappers isolate Android rendering from repository/domain representations. Home renders weekly spending through the graph library.

Paths:
- `app/src/main/java/com/arduia/expense/ui/entry/ExpenseEntryViewModel.kt`
- `app/src/main/java/com/arduia/expense/ui/expenselogs/ExpenseViewModel.kt`
- `app/src/main/java/com/arduia/expense/ui/home/HomeViewModel.kt`
- `app/src/main/java/com/arduia/expense/ui/statistics/StatisticsViewModel.kt`
- `week-expense-graph/src/main/java/com/arduia/graph/SpendGraph.kt`

#### Domain and repository boundary
Domain types model amounts, expense-store concerns, exchange-rate storage, and date/log filters. UI depends on repository interfaces; implementation classes coordinate persistence, settings, bundled currency data, backup records, and server interactions. Result wrappers provide operational/error boundaries between data and callers.

Paths:
- `app/src/main/java/com/arduia/expense/domain/Amount.kt`
- `app/src/main/java/com/arduia/expense/data/ExpenseRepository.kt`
- `app/src/main/java/com/arduia/expense/data/ExpenseRepositoryImpl.kt`
- `app/src/main/java/com/arduia/expense/data/SettingsRepositoryImpl.kt`

#### Local persistence and assets
Room is the authoritative store for expense and backup entities, with versioned schemas checked into the app. Preferences/DataStore-style DAO abstractions hold app settings and cached state. Currency definitions are packaged locally, supporting offline currency selection rather than a required exchange service.

Paths:
- `app/src/main/java/com/arduia/expense/data/local/ProExpenseDatabase.kt`
- `app/src/main/java/com/arduia/expense/data/local/ExpenseEnt.kt`
- `app/src/main/java/com/arduia/expense/data/local/PreferenceFlowStorageDaoImpl.kt`
- `app/schemas/com.arduia.expense.data.local.ProExpenseDatabase/6.json`
- `app/src/main/assets/currencies.json`

#### Backup/import-export pipeline
Backup is explicitly local file-based. App-specific backup sheets map expense and schema data into the generic Excel backup engine; WorkManager workers execute export/import off the UI thread and UI messaging reports outcomes. The `expense-backup` module defines portable backup metadata/schema, while `backup` supplies spreadsheet task abstractions.

Paths:
- `app/src/main/java/com/arduia/expense/data/backup/ExportWorker.kt`
- `app/src/main/java/com/arduia/expense/data/backup/ImportWorker.kt`
- `app/src/main/java/com/arduia/expense/data/backup/ExpenseBackupSheet.kt`
- `backup/src/main/java/com/arduia/backup/ExcelBackup.kt`
- `expense-backup/src/main/java/com/arduia/expense/backup/schema/BackupSchema.kt`

#### Background network integrations
Internet use is limited to feedback submission and app-version/update status. Repository DTOs define these network payload boundaries; WorkManager workers schedule feedback and update checks independently of foreground UI. There is no cloud sync/backup service.

Paths:
- `app/src/main/java/com/arduia/expense/data/ProExpenseServerRepositoryImpl.kt`
- `app/src/main/java/com/arduia/expense/data/FeedbackWorker.kt`
- `app/src/main/java/com/arduia/expense/data/update/CheckAboutUpdateWorker.kt`
- `app/src/main/java/com/arduia/expense/data/network/FeedbackDto.kt`

#### Dependency composition and shared modules
Dagger Hilt modules compose database, network, repositories, domain services, UI mappers, navigation, and background work dependencies. `shared` provides cross-cutting Android/core utilities; `currency-store` contains exchange-rate store types, though README limitations indicate mixed-currency expense handling is not active.

Paths:
- `app/src/main/java/com/arduia/expense/di/DatabaseModule.kt`
- `app/src/main/java/com/arduia/expense/di/RepositoryModule.kt`
- `app/src/main/java/com/arduia/expense/di/NetworkModule.kt`
- `shared/src/main/java/com/arduia/core/arch/Mapper.kt`
- `currency-store/src/main/java/com/arduia/currencystore/Store.kt`

Main entry points: [`app/src/main/res/navigation/main_nav.xml`](https://github.com/arduia/proexpense/blob/main/app/src/main/res/navigation/main_nav.xml) (Main navigation graph), [`app/src/main/java/com/arduia/expense/data/ExpenseRepositoryImpl.kt`](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/ExpenseRepositoryImpl.kt) (Repository implementations), [`app/src/main/java/com/arduia/expense/data/ExpenseRepository.kt`](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/ExpenseRepository.kt) (Repository boundary), [`app/src/main/java/com/arduia/expense/di/RepositoryModule.kt`](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/di/RepositoryModule.kt) (Hilt composition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Android app"]
  node_application{{"ExpenseApplication<br/>process bootstrap"}}
  node_activity["MainActivity<br/>UI host<br/>[MainActivity.kt]"]
  node_navigation["Main navigation graph<br/>Navigation Component<br/>[main_nav.xml]"]
  node_entry_vm["Expense entry VM<br/>ViewModel"]
  node_logs_vm["Expense logs VM<br/>ViewModel"]
  node_home_vm["Home VM<br/>ViewModel<br/>[HomeViewModel.kt]"]
  node_statistics_vm["Statistics VM<br/>ViewModel"]
  node_hilt_modules{{"Hilt composition<br/>DI modules"}}
end

subgraph group_data["Data and local storage"]
  node_repositories["Repository boundary<br/>repository interface"]
  node_repository_impl["Repository implementations<br/>data orchestration"]
  node_settings["Settings repository<br/>settings persistence"]
  node_database[("ProExpenseDatabase<br/>Room database")]
  node_expense_entity["Expense entity<br/>Room entity<br/>[ExpenseEnt.kt]"]
  node_preferences[("Preference flow storage<br/>settings DAO")]
  node_currency_assets["Currency definitions<br/>bundled asset<br/>[currencies.json]"]
end

subgraph group_background["Background integrations"]
  node_backup_workers["Import / export workers<br/>WorkManager workers<br/>[ExportWorker.kt]"]
  node_backup_sheet["Expense backup sheet<br/>backup mapper"]
  node_server_workers["Feedback and update workers<br/>WorkManager workers<br/>[FeedbackWorker.kt]"]
  node_server_repository["Server repository<br/>network repository"]
end

subgraph group_modules["Reusable modules"]
  node_excel_backup["Excel backup engine<br/>spreadsheet backup<br/>[ExcelBackup.kt]"]
  node_spend_graph["Weekly spend graph<br/>graph library<br/>[SpendGraph.kt]"]
end

node_application -->|"initializes"| node_hilt_modules
node_application -->|"starts"| node_activity
node_activity -->|"hosts"| node_navigation
node_navigation -->|"expense entry"| node_entry_vm
node_navigation -->|"expense logs"| node_logs_vm
node_navigation -->|"dashboard"| node_home_vm
node_navigation -->|"statistics"| node_statistics_vm
node_entry_vm -->|"uses"| node_repositories
node_logs_vm -->|"uses"| node_repositories
node_home_vm -->|"uses"| node_repositories
node_statistics_vm -->|"uses"| node_repositories
node_home_vm -->|"renders weekly spending"| node_spend_graph
node_repositories -->|"implemented by"| node_repository_impl
node_repository_impl -->|"persists expenses"| node_database
node_repository_impl -->|"uses settings"| node_settings
node_repository_impl -->|"loads currencies"| node_currency_assets
node_database -->|"stores"| node_expense_entity
node_settings -->|"persists through"| node_preferences
node_backup_workers -->|"maps backup data"| node_backup_sheet
node_backup_sheet -->|"uses"| node_excel_backup
node_backup_workers -->|"exports / imports"| node_database
node_server_workers -->|"calls"| node_server_repository
node_hilt_modules -.->|"provides"| node_repository_impl
node_hilt_modules -.->|"injects"| node_backup_workers
node_hilt_modules -.->|"injects"| node_server_workers

click node_application "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ExpenseApplication.kt"
click node_activity "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ui/MainActivity.kt"
click node_navigation "https://github.com/arduia/proexpense/blob/main/app/src/main/res/navigation/main_nav.xml"
click node_entry_vm "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ui/entry/ExpenseEntryViewModel.kt"
click node_logs_vm "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ui/expenselogs/ExpenseViewModel.kt"
click node_home_vm "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ui/home/HomeViewModel.kt"
click node_statistics_vm "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ui/statistics/StatisticsViewModel.kt"
click node_repositories "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/ExpenseRepository.kt"
click node_repository_impl "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/ExpenseRepositoryImpl.kt"
click node_settings "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/SettingsRepositoryImpl.kt"
click node_database "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/local/ProExpenseDatabase.kt"
click node_expense_entity "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/local/ExpenseEnt.kt"
click node_preferences "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/local/PreferenceFlowStorageDaoImpl.kt"
click node_currency_assets "https://github.com/arduia/proexpense/blob/main/app/src/main/assets/currencies.json"
click node_backup_workers "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/backup/ExportWorker.kt"
click node_backup_sheet "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/backup/ExpenseBackupSheet.kt"
click node_excel_backup "https://github.com/arduia/proexpense/blob/main/backup/src/main/java/com/arduia/backup/ExcelBackup.kt"
click node_server_workers "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/FeedbackWorker.kt"
click node_server_repository "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/ProExpenseServerRepositoryImpl.kt"
click node_spend_graph "https://github.com/arduia/proexpense/blob/main/week-expense-graph/src/main/java/com/arduia/graph/SpendGraph.kt"
click node_hilt_modules "https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/di/RepositoryModule.kt"

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_application,node_activity,node_navigation,node_entry_vm,node_logs_vm,node_home_vm,node_statistics_vm,node_hilt_modules toneBlue
class node_repositories,node_repository_impl,node_settings,node_database,node_expense_entity,node_preferences,node_currency_assets toneAmber
class node_backup_workers,node_backup_sheet,node_server_workers,node_server_repository toneMint
class node_excel_backup,node_spend_graph toneRose
```

## Components

### Android app

- [ExpenseApplication](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ExpenseApplication.kt): process bootstrap · Initializes the Hilt-backed application process. · `app/src/main/java/com/arduia/expense/ExpenseApplication.kt`
- [MainActivity](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ui/MainActivity.kt): UI host · Hosts the fragment-based primary experience. · `app/src/main/java/com/arduia/expense/ui/MainActivity.kt`
- [Main navigation graph](https://github.com/arduia/proexpense/blob/main/app/src/main/res/navigation/main_nav.xml): Navigation Component · Routes splash, onboarding, drawer, and main screens. · `app/src/main/res/navigation/main_nav.xml`
- [Expense entry VM](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ui/entry/ExpenseEntryViewModel.kt): ViewModel · `app/src/main/java/com/arduia/expense/ui/entry/ExpenseEntryViewModel.kt`
- [Expense logs VM](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ui/expenselogs/ExpenseViewModel.kt): ViewModel · Provides pageable and filterable expense logs. · `app/src/main/java/com/arduia/expense/ui/expenselogs/ExpenseViewModel.kt`
- [Home VM](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ui/home/HomeViewModel.kt): ViewModel · Supplies dashboard and weekly spending state. · `app/src/main/java/com/arduia/expense/ui/home/HomeViewModel.kt`
- [Statistics VM](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/ui/statistics/StatisticsViewModel.kt): ViewModel · `app/src/main/java/com/arduia/expense/ui/statistics/StatisticsViewModel.kt`
- [Hilt composition](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/di/RepositoryModule.kt): DI modules · Composes database, repositories, network, UI, and worker dependencies. · `app/src/main/java/com/arduia/expense/di/RepositoryModule.kt`

### Data and local storage

- [Repository boundary](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/ExpenseRepository.kt): repository interface · UI accesses expense data through repository contracts. · `app/src/main/java/com/arduia/expense/data/ExpenseRepository.kt`
- [Repository implementations](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/ExpenseRepositoryImpl.kt): data orchestration · Coordinates expenses, settings, assets, backup, and server operations. · `app/src/main/java/com/arduia/expense/data/ExpenseRepositoryImpl.kt`
- [Settings repository](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/SettingsRepositoryImpl.kt): settings persistence · Persists language, currency, and onboarding configuration. · `app/src/main/java/com/arduia/expense/data/SettingsRepositoryImpl.kt`
- [ProExpenseDatabase](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/local/ProExpenseDatabase.kt): Room database · Authoritative local store for expenses and backup entities. · `app/src/main/java/com/arduia/expense/data/local/ProExpenseDatabase.kt`
- [Expense entity](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/local/ExpenseEnt.kt): Room entity · `app/src/main/java/com/arduia/expense/data/local/ExpenseEnt.kt`
- [Preference flow storage](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/local/PreferenceFlowStorageDaoImpl.kt): settings DAO · Stores settings and cached application state. · `app/src/main/java/com/arduia/expense/data/local/PreferenceFlowStorageDaoImpl.kt`
- [Currency definitions](https://github.com/arduia/proexpense/blob/main/app/src/main/assets/currencies.json): bundled asset · Offline currency selection data. · `app/src/main/assets/currencies.json`

### Background integrations

- [Import / export workers](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/backup/ExportWorker.kt): WorkManager workers · Run local file backup operations off the UI thread. · `app/src/main/java/com/arduia/expense/data/backup/ExportWorker.kt`
- [Expense backup sheet](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/backup/ExpenseBackupSheet.kt): backup mapper · Maps expense and schema data into backup sheets. · `app/src/main/java/com/arduia/expense/data/backup/ExpenseBackupSheet.kt`
- [Feedback and update workers](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/FeedbackWorker.kt): WorkManager workers · Independently submit feedback and check app version status. · `app/src/main/java/com/arduia/expense/data/FeedbackWorker.kt`
- [Server repository](https://github.com/arduia/proexpense/blob/main/app/src/main/java/com/arduia/expense/data/ProExpenseServerRepositoryImpl.kt): network repository · Limited network boundary for feedback and update status. · `app/src/main/java/com/arduia/expense/data/ProExpenseServerRepositoryImpl.kt`

### Reusable modules

- [Excel backup engine](https://github.com/arduia/proexpense/blob/main/backup/src/main/java/com/arduia/backup/ExcelBackup.kt): spreadsheet backup · Generic spreadsheet task abstractions. · `backup/src/main/java/com/arduia/backup/ExcelBackup.kt`
- [Weekly spend graph](https://github.com/arduia/proexpense/blob/main/week-expense-graph/src/main/java/com/arduia/graph/SpendGraph.kt): graph library · `week-expense-graph/src/main/java/com/arduia/graph/SpendGraph.kt`

## Connections

- ExpenseApplication → Hilt composition: initializes
- ExpenseApplication → MainActivity: starts
- MainActivity → Main navigation graph: hosts
- Main navigation graph → Expense entry VM: expense entry
- Main navigation graph → Expense logs VM: expense logs
- Main navigation graph → Home VM: dashboard
- Main navigation graph → Statistics VM: statistics
- Expense entry VM → Repository boundary: uses
- Expense logs VM → Repository boundary: uses
- Home VM → Repository boundary: uses
- Statistics VM → Repository boundary: uses
- Home VM → Weekly spend graph: renders weekly spending
- Repository boundary → Repository implementations: implemented by
- Repository implementations → ProExpenseDatabase: persists expenses
- Repository implementations → Settings repository: uses settings
- Repository implementations → Currency definitions: loads currencies
- ProExpenseDatabase → Expense entity: stores
- Settings repository → Preference flow storage: persists through
- Import / export workers → Expense backup sheet: maps backup data
- Expense backup sheet → Excel backup engine: uses
- Import / export workers → ProExpenseDatabase: exports / imports
- Feedback and update workers → Server repository: calls
- Hilt composition → Repository implementations: provides
- Hilt composition → Import / export workers: injects
- Hilt composition → Feedback and update workers: injects
