# lafluc/mangoaccounting architecture

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

- Interactive diagram: https://gitdiagram.com/lafluc/mangoaccounting
- Repository: https://github.com/lafluc/mangoaccounting

## Overview

MangoAccounting is a macOS bookkeeping app for Swiss self-employment. Users enter transactions with receipt attachments and manage depreciable assets; they can review an annual Erfolgsrechnung and Bilanz PDF, or create, save, reopen, and export invoices with Swiss QR payment codes. The graph includes the documented asset and reporting capabilities even where their implementation was not sampled. Invoice and transaction components are grounded in the source index and excerpts; some links to unsampled screens or persistence are therefore omitted or marked unverified.

Main entry points: [`MangoAccounting/InvoiceGeneratorView.swift`](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/InvoiceGeneratorView.swift) (Invoice editor), [`MangoAccounting/TabItem.swift`](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TabItem.swift) (Tab definitions), [`MangoAccounting/TransactionsListView.swift`](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TransactionsListView.swift) (Transaction list), [`MangoAccounting/DocumentListView.swift`](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/DocumentListView.swift) (Saved documents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App navigation"]
  node_app["App entry"]
  node_navigation["Main navigation<br/>[MainView.swift]"]
  node_tabs["Tab definitions<br/>[TabItem.swift]"]
end

subgraph group_bookkeeping["Bookkeeping"]
  node_transaction_entry["Transaction entry"]
  node_transaction_list["Transaction list"]
  node_transaction_detail["Transaction details"]
  node_transaction_entity[("Transaction records")]
  node_category_manager["Category manager"]
  node_suggestions["Title suggestions"]
  node_assets["Asset management"]
  node_asset_entry["Asset entry<br/>[AddAssetView.swift]"]
  node_asset_entity[("Asset records")]
end

subgraph group_reports["Annual reporting"]
  node_annual_report["Annual report"]
  node_report_pdf["Report PDF"]
  node_report_generator["Report calculations"]
end

subgraph group_invoices["Invoices and archive"]
  node_invoice_editor["Invoice editor"]
  node_invoice_model["Invoice draft<br/>[Invoice.swift]"]
  node_pagination["Invoice pagination"]
  node_invoice_renderer["Invoice renderer<br/>[InvoiceView.swift]"]
  node_qr_builder["Swiss QR builder"]
  node_document_list["Saved documents"]
  node_document_store[("Document archive")]
end

subgraph group_shared["Shared domain and storage"]
  node_fiscal_calendar["Fiscal calendar"]
  node_transaction_years["Transaction years"]
  node_money["Money rounding<br/>[Money.swift]"]
  node_settings["Business settings<br/>[UserSettings.swift]"]
  node_persistence[("Core Data setup<br/>[Persistence.swift]")]
end

node_user(("Bookkeeper"))

node_user -->|"launches"| node_app
node_app -->|"shows"| node_navigation
node_tabs -->|"routes to"| node_transaction_list
node_tabs -->|"routes to"| node_assets
node_tabs -->|"routes to"| node_annual_report
node_tabs -->|"routes to"| node_invoice_editor
node_tabs -->|"routes to"| node_document_list
node_transaction_entry -->|"uses categories"| node_category_manager
node_transaction_entry -->|"uses suggestions"| node_suggestions
node_transaction_list -->|"opens editor"| node_transaction_entry
node_transaction_list -->|"opens details"| node_transaction_detail
node_transaction_list -->|"uses years"| node_transaction_years
node_transaction_years -->|"uses calendar"| node_fiscal_calendar
node_asset_entry -.->|"records asset"| node_asset_entity
node_assets -.->|"opens editor"| node_asset_entry
node_annual_report -.->|"requests totals"| node_report_generator
node_annual_report -.->|"exports PDF"| node_report_pdf
node_report_generator -->|"rounds totals"| node_money
node_report_generator -.->|"uses year bounds"| node_fiscal_calendar
node_invoice_editor -->|"edits draft"| node_invoice_model
node_invoice_editor -->|"loads issuer details"| node_settings
node_invoice_editor -->|"renders invoice"| node_invoice_renderer
node_invoice_editor -->|"saves invoice"| node_document_store
node_invoice_editor -->|"calculates pages"| node_pagination
node_invoice_renderer -->|"uses page breaks"| node_pagination
node_invoice_renderer -->|"builds QR code"| node_qr_builder
node_invoice_model -->|"rounds line totals"| node_money
node_document_list -->|"loads archive"| node_document_store
node_document_list -->|"opens invoice editor"| node_invoice_editor
node_document_list -->|"reads invoice source"| node_invoice_model
node_transaction_entry -.->|"records transaction"| node_transaction_entity
node_transaction_list -.->|"reads transactions"| node_transaction_entity
node_navigation -.->|"uses data context"| node_persistence

click node_app "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/MangoAccounting.swift"
click node_navigation "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/MainView.swift"
click node_tabs "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TabItem.swift"
click node_transaction_entry "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AddTransactionView.swift"
click node_transaction_list "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TransactionsListView.swift"
click node_transaction_detail "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TransactionDetailView.swift"
click node_transaction_entity "https://github.com/lafluc/mangoaccounting/blob/main/TransactionItem%2BCoreDataProperties.swift"
click node_category_manager "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/CategoryManager.swift"
click node_suggestions "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TitleSuggestionStore.swift"
click node_assets "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AssetsListView.swift"
click node_asset_entry "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AddAssetView.swift"
click node_asset_entity "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AssetItem%2BCoreDataProperties.swift"
click node_annual_report "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AnnualReportView.swift"
click node_report_pdf "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AnnualReportPDFView.swift"
click node_report_generator "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/ReportGenerator.swift"
click node_fiscal_calendar "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/FiscalCalendar.swift"
click node_transaction_years "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TransactionYears.swift"
click node_money "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/Money.swift"
click node_settings "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/UserSettings.swift"
click node_invoice_editor "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/InvoiceGeneratorView.swift"
click node_invoice_model "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/Invoice.swift"
click node_pagination "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/InvoicePagination.swift"
click node_invoice_renderer "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/InvoiceView.swift"
click node_qr_builder "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/SwissQRBuilder.swift"
click node_document_list "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/DocumentListView.swift"
click node_document_store "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/DocumentStore.swift"
click node_persistence "https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/Persistence.swift"

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_navigation,node_tabs toneBlue
class node_transaction_entry,node_transaction_list,node_transaction_detail,node_transaction_entity,node_category_manager,node_suggestions,node_assets,node_asset_entry,node_asset_entity toneAmber
class node_annual_report,node_report_pdf,node_report_generator toneMint
class node_invoice_editor,node_invoice_model,node_pagination,node_invoice_renderer,node_qr_builder,node_document_list,node_document_store toneRose
class node_fiscal_calendar,node_transaction_years,node_money,node_settings,node_persistence,node_user toneIndigo
```

## Components

### App navigation

- [App entry](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/MangoAccounting.swift): `MangoAccounting/MangoAccounting.swift`
- [Main navigation](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/MainView.swift): `MangoAccounting/MainView.swift`
- [Tab definitions](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TabItem.swift): `MangoAccounting/TabItem.swift`

### Bookkeeping

- [Transaction entry](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AddTransactionView.swift): `MangoAccounting/AddTransactionView.swift`
- [Transaction list](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TransactionsListView.swift): `MangoAccounting/TransactionsListView.swift`
- [Transaction details](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TransactionDetailView.swift): `MangoAccounting/TransactionDetailView.swift`
- [Transaction records](https://github.com/lafluc/mangoaccounting/blob/main/TransactionItem%2BCoreDataProperties.swift): `TransactionItem+CoreDataProperties.swift`
- [Category manager](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/CategoryManager.swift): `MangoAccounting/CategoryManager.swift`
- [Title suggestions](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TitleSuggestionStore.swift): `MangoAccounting/TitleSuggestionStore.swift`
- [Asset management](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AssetsListView.swift): `MangoAccounting/AssetsListView.swift`
- [Asset entry](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AddAssetView.swift): `MangoAccounting/AddAssetView.swift`
- [Asset records](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AssetItem%2BCoreDataProperties.swift): `MangoAccounting/AssetItem+CoreDataProperties.swift`

### Annual reporting

- [Annual report](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AnnualReportView.swift): `MangoAccounting/AnnualReportView.swift`
- [Report PDF](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/AnnualReportPDFView.swift): `MangoAccounting/AnnualReportPDFView.swift`
- [Report calculations](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/ReportGenerator.swift): `MangoAccounting/ReportGenerator.swift`

### Invoices and archive

- [Invoice editor](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/InvoiceGeneratorView.swift): `MangoAccounting/InvoiceGeneratorView.swift`
- [Invoice draft](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/Invoice.swift): `MangoAccounting/Invoice.swift`
- [Invoice pagination](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/InvoicePagination.swift): `MangoAccounting/InvoicePagination.swift`
- [Invoice renderer](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/InvoiceView.swift): `MangoAccounting/InvoiceView.swift`
- [Swiss QR builder](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/SwissQRBuilder.swift): `MangoAccounting/SwissQRBuilder.swift`
- [Saved documents](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/DocumentListView.swift): `MangoAccounting/DocumentListView.swift`
- [Document archive](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/DocumentStore.swift): `MangoAccounting/DocumentStore.swift`

### Shared domain and storage

- [Fiscal calendar](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/FiscalCalendar.swift): `MangoAccounting/FiscalCalendar.swift`
- [Transaction years](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/TransactionYears.swift): `MangoAccounting/TransactionYears.swift`
- [Money rounding](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/Money.swift): `MangoAccounting/Money.swift`
- [Business settings](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/UserSettings.swift): `MangoAccounting/UserSettings.swift`
- [Core Data setup](https://github.com/lafluc/mangoaccounting/blob/main/MangoAccounting/Persistence.swift): `MangoAccounting/Persistence.swift`

### Other components

- **Bookkeeper**

## Connections

- Bookkeeper → App entry: launches (evidence: `MangoAccounting/MangoAccounting.swift`)
- App entry → Main navigation: shows (evidence: `MangoAccounting/MangoAccounting.swift`)
- Tab definitions → Transaction list: routes to (evidence: `MangoAccounting/TabItem.swift`)
- Tab definitions → Asset management: routes to (evidence: `MangoAccounting/TabItem.swift`)
- Tab definitions → Annual report: routes to (evidence: `MangoAccounting/TabItem.swift`)
- Tab definitions → Invoice editor: routes to (evidence: `MangoAccounting/TabItem.swift`)
- Tab definitions → Saved documents: routes to (evidence: `MangoAccounting/TabItem.swift`)
- Transaction entry → Category manager: uses categories (evidence: `MangoAccounting/AddTransactionView.swift`)
- Transaction entry → Title suggestions: uses suggestions (evidence: `MangoAccounting/AddTransactionView.swift`)
- Transaction list → Transaction entry: opens editor (evidence: `MangoAccounting/TransactionsListView.swift`)
- Transaction list → Transaction details: opens details (evidence: `MangoAccounting/TransactionsListView.swift`)
- Transaction list → Transaction years: uses years (evidence: `MangoAccounting/TransactionsListView.swift`)
- Transaction years → Fiscal calendar: uses calendar (evidence: `MangoAccounting/TransactionYears.swift`)
- Asset entry → Asset records: records asset
- Asset management → Asset entry: opens editor
- Annual report → Report calculations: requests totals
- Annual report → Report PDF: exports PDF
- Report calculations → Money rounding: rounds totals (evidence: `MangoAccounting/ReportGenerator.swift`)
- Report calculations → Fiscal calendar: uses year bounds
- Invoice editor → Invoice draft: edits draft (evidence: `MangoAccounting/InvoiceGeneratorView.swift`)
- Invoice editor → Business settings: loads issuer details (evidence: `MangoAccounting/InvoiceGeneratorView.swift`)
- Invoice editor → Invoice renderer: renders invoice (evidence: `MangoAccounting/InvoiceGeneratorView.swift`)
- Invoice editor → Document archive: saves invoice (evidence: `MangoAccounting/InvoiceGeneratorView.swift`)
- Invoice editor → Invoice pagination: calculates pages (evidence: `MangoAccounting/InvoiceGeneratorView.swift`)
- Invoice renderer → Invoice pagination: uses page breaks (evidence: `MangoAccounting/InvoiceView.swift`)
- Invoice renderer → Swiss QR builder: builds QR code (evidence: `MangoAccounting/InvoiceView.swift`)
- Invoice draft → Money rounding: rounds line totals (evidence: `MangoAccounting/Invoice.swift`)
- Saved documents → Document archive: loads archive (evidence: `MangoAccounting/DocumentListView.swift`)
- Saved documents → Invoice editor: opens invoice editor (evidence: `MangoAccounting/DocumentListView.swift`)
- Saved documents → Invoice draft: reads invoice source (evidence: `MangoAccounting/DocumentListView.swift`)
- Transaction entry → Transaction records: records transaction
- Transaction list → Transaction records: reads transactions
- Main navigation → Core Data setup: uses data context
