# afadhitya/wallet-app architecture

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

- Interactive diagram: https://gitdiagram.com/afadhitya/wallet-app
- Repository: https://github.com/afadhitya/wallet-app

## Overview

Wallet App is an offline-first personal-finance CLI. Users invoke wallet commands to record and organize money activity, then inspect budgets, scheduled bills, forecasts, and reports; command handlers delegate domain work to services, which use generated SQL queries against SQLite. The tree and README document the broader feature set, but excerpts only expose selected transaction and persistence behavior, so uncertain cross-service calls are omitted. Configuration, exchange-rate management, and self-update are represented as separate capabilities.

Main entry points: [`internal/cli/root.go`](https://github.com/afadhitya/wallet-app/blob/main/internal/cli/root.go) (Command handlers), [`internal/service/service.go`](https://github.com/afadhitya/wallet-app/blob/main/internal/service/service.go) (Service wiring), [`internal/gen/querier.go`](https://github.com/afadhitya/wallet-app/blob/main/internal/gen/querier.go) (Generated queries), [`cmd/wallet/main.go`](https://github.com/afadhitya/wallet-app/blob/main/cmd/wallet/main.go) (Wallet command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI interface"]
  node_wallet["Wallet command<br/>[main.go]"]
  node_cli["Command handlers<br/>[root.go]"]
  node_format["Output formatting<br/>[format.go]"]
end

subgraph group_domain["Finance domains"]
  node_transactions["Transactions<br/>[transaction.go]"]
  node_accounts["Accounts<br/>[account.go]"]
  node_categories["Categories<br/>[category.go]"]
  node_tags["Tags<br/>[tag.go]"]
  node_budgets["Budgets<br/>[budget.go]"]
  node_planned["Planned payments<br/>[planned_payment.go]"]
  node_forecast["Forecasting<br/>[forecast.go]"]
  node_reports["Reports<br/>[report.go]"]
  node_currency["Currency conversion<br/>[currency.go]"]
  node_service["Service wiring<br/>[service.go]"]
end

subgraph group_storage["Persistence"]
  node_db["SQLite setup<br/>[db.go]"]
  node_queries["Generated queries<br/>[querier.go]"]
  node_models["Finance records<br/>[models.go]"]
  node_sqlite[("SQLite database")]
end

subgraph group_support["Configuration and updates"]
  node_config["App configuration<br/>[config.go]"]
  node_rates["Exchange rates<br/>[rates.go]"]
  node_updater["Self updater<br/>[updater.go]"]
end

node_user(("Wallet user"))
node_release["Release service"]

node_user -->|"runs commands"| node_wallet
node_wallet -->|"executes root"| node_cli
node_cli -->|"dispatches activity"| node_transactions
node_cli -->|"dispatches account ops"| node_accounts
node_cli -->|"dispatches category ops"| node_categories
node_cli -->|"dispatches tag ops"| node_tags
node_cli -->|"dispatches budget ops"| node_budgets
node_cli -->|"dispatches bill ops"| node_planned
node_cli -->|"dispatches forecasts"| node_forecast
node_cli -->|"dispatches reports"| node_reports
node_cli -->|"dispatches rate ops"| node_currency
node_cli -->|"formats responses"| node_format
node_service -->|"creates queries"| node_queries
node_transactions -->|"uses service wiring"| node_service
node_accounts -->|"uses service wiring"| node_service
node_categories -->|"uses service wiring"| node_service
node_tags -->|"uses service wiring"| node_service
node_budgets -->|"uses service wiring"| node_service
node_planned -->|"uses service wiring"| node_service
node_forecast -->|"uses service wiring"| node_service
node_reports -->|"uses service wiring"| node_service
node_currency -->|"uses service wiring"| node_service
node_queries -->|"reads and writes"| node_sqlite
node_queries -->|"maps records"| node_models
node_db -->|"opens and migrates"| node_sqlite
node_config -->|"configures rates"| node_rates
node_updater -.->|"checks and downloads"| node_release

click node_wallet "https://github.com/afadhitya/wallet-app/blob/main/cmd/wallet/main.go"
click node_cli "https://github.com/afadhitya/wallet-app/blob/main/internal/cli/root.go"
click node_format "https://github.com/afadhitya/wallet-app/blob/main/internal/cli/format.go"
click node_transactions "https://github.com/afadhitya/wallet-app/blob/main/internal/service/transaction.go"
click node_accounts "https://github.com/afadhitya/wallet-app/blob/main/internal/service/account.go"
click node_categories "https://github.com/afadhitya/wallet-app/blob/main/internal/service/category.go"
click node_tags "https://github.com/afadhitya/wallet-app/blob/main/internal/service/tag.go"
click node_budgets "https://github.com/afadhitya/wallet-app/blob/main/internal/service/budget.go"
click node_planned "https://github.com/afadhitya/wallet-app/blob/main/internal/service/planned_payment.go"
click node_forecast "https://github.com/afadhitya/wallet-app/blob/main/internal/service/forecast.go"
click node_reports "https://github.com/afadhitya/wallet-app/blob/main/internal/service/report.go"
click node_currency "https://github.com/afadhitya/wallet-app/blob/main/internal/service/currency.go"
click node_service "https://github.com/afadhitya/wallet-app/blob/main/internal/service/service.go"
click node_db "https://github.com/afadhitya/wallet-app/blob/main/internal/db/db.go"
click node_queries "https://github.com/afadhitya/wallet-app/blob/main/internal/gen/querier.go"
click node_models "https://github.com/afadhitya/wallet-app/blob/main/internal/gen/models.go"
click node_config "https://github.com/afadhitya/wallet-app/blob/main/pkg/config/config.go"
click node_rates "https://github.com/afadhitya/wallet-app/blob/main/pkg/config/rates.go"
click node_updater "https://github.com/afadhitya/wallet-app/blob/main/pkg/update/updater.go"

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_wallet,node_cli,node_format,node_user toneBlue
class node_transactions,node_accounts,node_categories,node_tags,node_budgets,node_planned,node_forecast,node_reports,node_currency,node_service toneAmber
class node_db,node_queries,node_models,node_sqlite toneMint
class node_config,node_rates,node_updater toneRose
class node_release toneIndigo
```

## Components

### CLI interface

- [Wallet command](https://github.com/afadhitya/wallet-app/blob/main/cmd/wallet/main.go): `cmd/wallet/main.go`
- [Command handlers](https://github.com/afadhitya/wallet-app/blob/main/internal/cli/root.go): `internal/cli/root.go`
- [Output formatting](https://github.com/afadhitya/wallet-app/blob/main/internal/cli/format.go): `internal/cli/format.go`

### Finance domains

- [Transactions](https://github.com/afadhitya/wallet-app/blob/main/internal/service/transaction.go): `internal/service/transaction.go`
- [Accounts](https://github.com/afadhitya/wallet-app/blob/main/internal/service/account.go): `internal/service/account.go`
- [Categories](https://github.com/afadhitya/wallet-app/blob/main/internal/service/category.go): `internal/service/category.go`
- [Tags](https://github.com/afadhitya/wallet-app/blob/main/internal/service/tag.go): `internal/service/tag.go`
- [Budgets](https://github.com/afadhitya/wallet-app/blob/main/internal/service/budget.go): `internal/service/budget.go`
- [Planned payments](https://github.com/afadhitya/wallet-app/blob/main/internal/service/planned_payment.go): `internal/service/planned_payment.go`
- [Forecasting](https://github.com/afadhitya/wallet-app/blob/main/internal/service/forecast.go): `internal/service/forecast.go`
- [Reports](https://github.com/afadhitya/wallet-app/blob/main/internal/service/report.go): `internal/service/report.go`
- [Currency conversion](https://github.com/afadhitya/wallet-app/blob/main/internal/service/currency.go): `internal/service/currency.go`
- [Service wiring](https://github.com/afadhitya/wallet-app/blob/main/internal/service/service.go): `internal/service/service.go`

### Persistence

- [SQLite setup](https://github.com/afadhitya/wallet-app/blob/main/internal/db/db.go): `internal/db/db.go`
- [Generated queries](https://github.com/afadhitya/wallet-app/blob/main/internal/gen/querier.go): `internal/gen/querier.go`
- [Finance records](https://github.com/afadhitya/wallet-app/blob/main/internal/gen/models.go): `internal/gen/models.go`
- **SQLite database**

### Configuration and updates

- [App configuration](https://github.com/afadhitya/wallet-app/blob/main/pkg/config/config.go): `pkg/config/config.go`
- [Exchange rates](https://github.com/afadhitya/wallet-app/blob/main/pkg/config/rates.go): `pkg/config/rates.go`
- [Self updater](https://github.com/afadhitya/wallet-app/blob/main/pkg/update/updater.go): `pkg/update/updater.go`

### Other components

- **Wallet user**
- **Release service**

## Connections

- Wallet user → Wallet command: runs commands
- Wallet command → Command handlers: executes root
- Command handlers → Transactions: dispatches activity
- Command handlers → Accounts: dispatches account ops
- Command handlers → Categories: dispatches category ops
- Command handlers → Tags: dispatches tag ops
- Command handlers → Budgets: dispatches budget ops
- Command handlers → Planned payments: dispatches bill ops
- Command handlers → Forecasting: dispatches forecasts
- Command handlers → Reports: dispatches reports
- Command handlers → Currency conversion: dispatches rate ops
- Command handlers → Output formatting: formats responses
- Service wiring → Generated queries: creates queries
- Transactions → Service wiring: uses service wiring
- Accounts → Service wiring: uses service wiring
- Categories → Service wiring: uses service wiring
- Tags → Service wiring: uses service wiring
- Budgets → Service wiring: uses service wiring
- Planned payments → Service wiring: uses service wiring
- Forecasting → Service wiring: uses service wiring
- Reports → Service wiring: uses service wiring
- Currency conversion → Service wiring: uses service wiring
- Generated queries → SQLite database: reads and writes
- Generated queries → Finance records: maps records
- SQLite setup → SQLite database: opens and migrates
- App configuration → Exchange rates: configures rates
- Self updater → Release service: checks and downloads
