# asadhshujau/invoicer architecture

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

- Interactive diagram: https://gitdiagram.com/asadhshujau/invoicer
- Repository: https://github.com/asadhshujau/invoicer

## Overview

Invoicer is a local-first browser invoice editor: users enter invoice details in the live sheet, which is paginated for preview and reused for PDF export or printing. The graph includes invoice persistence, image assets, backup/restore, settings, and offline/update behavior documented in the README or represented in the tree. Edges are limited to explicit imports and calls in the excerpts or SOURCE INDEX; unsampled feature internals are represented by their exact source paths, with uncertain wiring omitted.

Main entry points: [`src/stores/invoice.ts`](https://github.com/asadhshujau/invoicer/blob/main/src/stores/invoice.ts) (Invoice state), [`src/App.vue`](https://github.com/asadhshujau/invoicer/blob/main/src/App.vue) (App shell), [`src/composables/useBackup.ts`](https://github.com/asadhshujau/invoicer/blob/main/src/composables/useBackup.ts) (Backup workflow), [`src/components/paper/PagedInvoice.vue`](https://github.com/asadhshujau/invoicer/blob/main/src/components/paper/PagedInvoice.vue) (Paged invoice)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and editing"]
  node_app_root["App shell<br/>[App.vue]"]
  node_edit_fields["Editable fields"]
  node_invoice_sheet["Invoice sheet<br/>[InvoicePaper.vue]"]
  node_paged_invoice["Paged invoice<br/>[PagedInvoice.vue]"]
  node_preview["Page preview<br/>[PagePreview.vue]"]
  node_ui_store["UI state<br/>[ui.ts]"]
  node_settings["Invoice settings<br/>[SettingsPanel.vue]"]
end

subgraph group_invoice["Invoice domain"]
  node_invoice_store["Invoice state<br/>[invoice.ts]"]
  node_invoice_model["Invoice model<br/>[invoice.ts]"]
  node_invoice_math["Invoice calculations<br/>[totals.ts]"]
  node_line_items["Line item rules<br/>[lines.ts]"]
  node_validation["Schema and migrations<br/>[schema.ts]"]
  node_pagination["Page planning<br/>[usePagination.ts]"]
end

subgraph group_persistence["Local persistence"]
  node_indexeddb[("IndexedDB<br/>[db.ts]")]
  node_invoice_repo["Invoice repository"]
  node_asset_store["Asset state<br/>[assets.ts]"]
  node_asset_repo["Asset repository<br/>[assetRepository.ts]"]
  node_tab_sync["Tab synchronization<br/>[tabSync.ts]"]
end

subgraph group_output["Export and backup"]
  node_export_sheet["Export controls<br/>[ExportSheet.vue]"]
  node_pdf_file["PDF file export<br/>[usePdfFile.ts]"]
  node_print["Print view<br/>[usePrint.ts]"]
  node_backup_dialogs["Backup dialogs<br/>[BackupDialogs.vue]"]
  node_backup_logic["Backup processing<br/>[backup.ts]"]
  node_backup_composable["Backup workflow<br/>[useBackup.ts]"]
end

subgraph group_platform["Browser platform"]
  node_offline_update["Update handling<br/>[useAppUpdate.ts]"]
end

node_user(("Invoice maker"))
node_browser(("Browser"))

node_user -->|"edits invoice"| node_app_root
node_app_root -->|"loads and saves"| node_invoice_store
node_app_root -->|"loads UI state"| node_ui_store
node_app_root -.->|"shows editor"| node_invoice_sheet
node_edit_fields -.->|"edits invoice"| node_invoice_store
node_invoice_sheet -.->|"renders pages"| node_paged_invoice
node_preview -->|"renders preview"| node_paged_invoice
node_preview -->|"reads invoice"| node_invoice_store
node_paged_invoice -->|"requests page plan"| node_pagination
node_pagination -->|"reads invoice"| node_invoice_store
node_pagination -->|"filters blank lines"| node_line_items
node_settings -.->|"updates settings"| node_invoice_store
node_invoice_store -->|"loads and saves"| node_invoice_repo
node_invoice_repo -->|"reads and writes"| node_indexeddb
node_invoice_store -->|"announces saves"| node_tab_sync
node_invoice_repo -->|"validates stored data"| node_validation
node_invoice_store -->|"holds invoice data"| node_invoice_model
node_invoice_store -->|"builds backups"| node_backup_logic
node_invoice_store -->|"uses totals"| node_invoice_math
node_invoice_store -.->|"loads invoice assets"| node_asset_store
node_asset_store -->|"loads and stores assets"| node_asset_repo
node_asset_repo -->|"uses database"| node_indexeddb
node_export_sheet -->|"prepares pages"| node_paged_invoice
node_export_sheet -->|"exports PDF"| node_pdf_file
node_export_sheet -.->|"prints invoice"| node_print
node_backup_dialogs -.->|"manages backup"| node_backup_composable
node_backup_composable -->|"encodes and reads"| node_backup_logic
node_backup_composable -->|"imports invoice"| node_invoice_store
node_backup_composable -->|"handles images"| node_asset_store
node_app_root -->|"checks updates"| node_offline_update
node_offline_update -.->|"checks app version"| node_browser

click node_app_root "https://github.com/asadhshujau/invoicer/blob/main/src/App.vue"
click node_edit_fields "https://github.com/asadhshujau/invoicer/tree/main/src/components/fields"
click node_invoice_sheet "https://github.com/asadhshujau/invoicer/blob/main/src/components/paper/InvoicePaper.vue"
click node_paged_invoice "https://github.com/asadhshujau/invoicer/blob/main/src/components/paper/PagedInvoice.vue"
click node_preview "https://github.com/asadhshujau/invoicer/blob/main/src/components/paper/PagePreview.vue"
click node_ui_store "https://github.com/asadhshujau/invoicer/blob/main/src/stores/ui.ts"
click node_settings "https://github.com/asadhshujau/invoicer/blob/main/src/components/app/SettingsPanel.vue"
click node_invoice_store "https://github.com/asadhshujau/invoicer/blob/main/src/stores/invoice.ts"
click node_invoice_model "https://github.com/asadhshujau/invoicer/blob/main/src/domain/invoice.ts"
click node_invoice_math "https://github.com/asadhshujau/invoicer/blob/main/src/domain/totals.ts"
click node_line_items "https://github.com/asadhshujau/invoicer/blob/main/src/domain/lines.ts"
click node_validation "https://github.com/asadhshujau/invoicer/blob/main/src/domain/schema.ts"
click node_pagination "https://github.com/asadhshujau/invoicer/blob/main/src/composables/usePagination.ts"
click node_indexeddb "https://github.com/asadhshujau/invoicer/blob/main/src/storage/db.ts"
click node_invoice_repo "https://github.com/asadhshujau/invoicer/blob/main/src/storage/invoiceRepository.ts"
click node_asset_store "https://github.com/asadhshujau/invoicer/blob/main/src/stores/assets.ts"
click node_asset_repo "https://github.com/asadhshujau/invoicer/blob/main/src/storage/assetRepository.ts"
click node_tab_sync "https://github.com/asadhshujau/invoicer/blob/main/src/storage/tabSync.ts"
click node_export_sheet "https://github.com/asadhshujau/invoicer/blob/main/src/components/app/ExportSheet.vue"
click node_pdf_file "https://github.com/asadhshujau/invoicer/blob/main/src/composables/usePdfFile.ts"
click node_print "https://github.com/asadhshujau/invoicer/blob/main/src/composables/usePrint.ts"
click node_backup_dialogs "https://github.com/asadhshujau/invoicer/blob/main/src/components/app/BackupDialogs.vue"
click node_backup_logic "https://github.com/asadhshujau/invoicer/blob/main/src/domain/backup.ts"
click node_backup_composable "https://github.com/asadhshujau/invoicer/blob/main/src/composables/useBackup.ts"
click node_offline_update "https://github.com/asadhshujau/invoicer/blob/main/src/composables/useAppUpdate.ts"

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_root,node_edit_fields,node_invoice_sheet,node_paged_invoice,node_preview,node_ui_store,node_settings,node_browser toneBlue
class node_invoice_store,node_invoice_model,node_invoice_math,node_line_items,node_validation,node_pagination toneAmber
class node_indexeddb,node_invoice_repo,node_asset_store,node_asset_repo,node_tab_sync toneMint
class node_export_sheet,node_pdf_file,node_print,node_backup_dialogs,node_backup_logic,node_backup_composable toneRose
class node_offline_update,node_user toneIndigo
```

## Components

### App and editing

- [App shell](https://github.com/asadhshujau/invoicer/blob/main/src/App.vue): `src/App.vue`
- [Editable fields](https://github.com/asadhshujau/invoicer/tree/main/src/components/fields): `src/components/fields`
- [Invoice sheet](https://github.com/asadhshujau/invoicer/blob/main/src/components/paper/InvoicePaper.vue): `src/components/paper/InvoicePaper.vue`
- [Paged invoice](https://github.com/asadhshujau/invoicer/blob/main/src/components/paper/PagedInvoice.vue): `src/components/paper/PagedInvoice.vue`
- [Page preview](https://github.com/asadhshujau/invoicer/blob/main/src/components/paper/PagePreview.vue): `src/components/paper/PagePreview.vue`
- [UI state](https://github.com/asadhshujau/invoicer/blob/main/src/stores/ui.ts): `src/stores/ui.ts`
- [Invoice settings](https://github.com/asadhshujau/invoicer/blob/main/src/components/app/SettingsPanel.vue): `src/components/app/SettingsPanel.vue`

### Invoice domain

- [Invoice state](https://github.com/asadhshujau/invoicer/blob/main/src/stores/invoice.ts): `src/stores/invoice.ts`
- [Invoice model](https://github.com/asadhshujau/invoicer/blob/main/src/domain/invoice.ts): `src/domain/invoice.ts`
- [Invoice calculations](https://github.com/asadhshujau/invoicer/blob/main/src/domain/totals.ts): `src/domain/totals.ts`
- [Line item rules](https://github.com/asadhshujau/invoicer/blob/main/src/domain/lines.ts): `src/domain/lines.ts`
- [Schema and migrations](https://github.com/asadhshujau/invoicer/blob/main/src/domain/schema.ts): `src/domain/schema.ts`
- [Page planning](https://github.com/asadhshujau/invoicer/blob/main/src/composables/usePagination.ts): `src/composables/usePagination.ts`

### Local persistence

- [IndexedDB](https://github.com/asadhshujau/invoicer/blob/main/src/storage/db.ts): `src/storage/db.ts`
- [Invoice repository](https://github.com/asadhshujau/invoicer/blob/main/src/storage/invoiceRepository.ts): `src/storage/invoiceRepository.ts`
- [Asset state](https://github.com/asadhshujau/invoicer/blob/main/src/stores/assets.ts): `src/stores/assets.ts`
- [Asset repository](https://github.com/asadhshujau/invoicer/blob/main/src/storage/assetRepository.ts): `src/storage/assetRepository.ts`
- [Tab synchronization](https://github.com/asadhshujau/invoicer/blob/main/src/storage/tabSync.ts): `src/storage/tabSync.ts`

### Export and backup

- [Export controls](https://github.com/asadhshujau/invoicer/blob/main/src/components/app/ExportSheet.vue): `src/components/app/ExportSheet.vue`
- [PDF file export](https://github.com/asadhshujau/invoicer/blob/main/src/composables/usePdfFile.ts): `src/composables/usePdfFile.ts`
- [Print view](https://github.com/asadhshujau/invoicer/blob/main/src/composables/usePrint.ts): `src/composables/usePrint.ts`
- [Backup dialogs](https://github.com/asadhshujau/invoicer/blob/main/src/components/app/BackupDialogs.vue): `src/components/app/BackupDialogs.vue`
- [Backup processing](https://github.com/asadhshujau/invoicer/blob/main/src/domain/backup.ts): `src/domain/backup.ts`
- [Backup workflow](https://github.com/asadhshujau/invoicer/blob/main/src/composables/useBackup.ts): `src/composables/useBackup.ts`

### Browser platform

- [Update handling](https://github.com/asadhshujau/invoicer/blob/main/src/composables/useAppUpdate.ts): `src/composables/useAppUpdate.ts`

### Other components

- **Invoice maker**
- **Browser**

## Connections

- Invoice maker → App shell: edits invoice (evidence: `README.md`)
- App shell → Invoice state: loads and saves (evidence: `src/App.vue`)
- App shell → UI state: loads UI state (evidence: `src/App.vue`)
- App shell → Invoice sheet: shows editor (evidence: `src/App.vue`)
- Editable fields → Invoice state: edits invoice
- Invoice sheet → Paged invoice: renders pages
- Page preview → Paged invoice: renders preview (evidence: `src/components/paper/PagePreview.vue`)
- Page preview → Invoice state: reads invoice (evidence: `src/components/paper/PagePreview.vue`)
- Paged invoice → Page planning: requests page plan (evidence: `src/components/paper/PagedInvoice.vue`)
- Page planning → Invoice state: reads invoice (evidence: `src/composables/usePagination.ts`)
- Page planning → Line item rules: filters blank lines (evidence: `src/composables/usePagination.ts`)
- Invoice settings → Invoice state: updates settings
- Invoice state → Invoice repository: loads and saves (evidence: `src/stores/invoice.ts`)
- Invoice repository → IndexedDB: reads and writes (evidence: `src/storage/invoiceRepository.ts`)
- Invoice state → Tab synchronization: announces saves (evidence: `src/stores/invoice.ts`)
- Invoice repository → Schema and migrations: validates stored data (evidence: `src/storage/invoiceRepository.ts`)
- Invoice state → Invoice model: holds invoice data (evidence: `src/stores/invoice.ts`)
- Invoice state → Backup processing: builds backups (evidence: `src/stores/invoice.ts`)
- Invoice state → Invoice calculations: uses totals (evidence: `src/stores/invoice.ts`)
- Invoice state → Asset state: loads invoice assets (evidence: `src/stores/invoice.ts`)
- Asset state → Asset repository: loads and stores assets (evidence: `src/stores/assets.ts`)
- Asset repository → IndexedDB: uses database (evidence: `src/storage/assetRepository.ts`)
- Export controls → Paged invoice: prepares pages (evidence: `src/components/app/ExportSheet.vue`)
- Export controls → PDF file export: exports PDF (evidence: `src/components/app/ExportSheet.vue`)
- Export controls → Print view: prints invoice
- Backup dialogs → Backup workflow: manages backup
- Backup workflow → Backup processing: encodes and reads (evidence: `src/composables/useBackup.ts`)
- Backup workflow → Invoice state: imports invoice (evidence: `src/composables/useBackup.ts`)
- Backup workflow → Asset state: handles images (evidence: `src/composables/useBackup.ts`)
- App shell → Update handling: checks updates (evidence: `src/App.vue`)
- Update handling → Browser: checks app version
