# davidamunga/mpesa2csv architecture

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

- Interactive diagram: https://gitdiagram.com/davidamunga/mpesa2csv
- Repository: https://github.com/davidamunga/mpesa2csv

## Overview

mpesa2csv is an offline M-PESA statement converter. The main workflow is selecting PDFs, extracting and parsing their ledger locally, previewing transactions, configuring options, and exporting a chosen format. The graph also includes documented spreadsheet analyses, webhook delivery, and update checks. Some connections rely on README workflow descriptions or import/reference evidence; unsampled implementation details are not inferred as definite calls.

Main entry points: [`src/App.tsx`](https://github.com/davidamunga/mpesa2csv/blob/main/src/App.tsx) (Workflow coordinator), [`src/services/exportService.ts`](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/exportService.ts) (Format dispatcher), [`src/components/export-options.tsx`](https://github.com/davidamunga/mpesa2csv/blob/main/src/components/export-options.tsx) (Export configuration), [`src/services/tabulaService.ts`](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/tabulaService.ts) (PDF extraction and parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Statement workflow"]
  node_app["Workflow coordinator<br/>[App.tsx]"]
  node_upload["PDF selection<br/>[file-uploader.tsx]"]
  node_extract["PDF extraction and parsing<br/>[tabulaService.ts]"]
  node_native["Native PDF commands<br/>[lib.rs]"]
  node_ledger["Transaction filters"]
end

subgraph group_exports["Export and analysis"]
  node_exportoptions["Export configuration<br/>[export-options.tsx]"]
  node_export["Format dispatcher<br/>[exportService.ts]"]
  node_csv["CSV export<br/>[csvService.ts]"]
  node_xlsx["Excel workbook<br/>[xlsxService.ts]"]
  node_json["JSON export<br/>[jsonService.ts]"]
  node_ofx["OFX and QFX export<br/>[ofxService.ts]"]
  node_qif["QIF export<br/>[qifService.ts]"]
  node_sheets["Analysis sheets"]
  node_dates["Date formatting<br/>[dateFormatter.ts]"]
end

subgraph group_integrations["App integrations"]
  node_webhook["Webhook delivery<br/>[webhookService.ts]"]
  node_updates["Update checker<br/>[update-checker.tsx]"]
end

subgraph group_presentation["User interface"]
  node_ui["UI primitives"]
end

node_user(("Statement user"))
node_tabula["Tabula extractor"]
node_api(("User API endpoint"))
node_release["Release service"]

node_user -->|"selects PDFs"| node_upload
node_upload -->|"provides files"| node_app
node_app -->|"processes statements"| node_extract
node_extract -->|"invokes extraction"| node_native
node_native -.->|"extracts tables"| node_tabula
node_extract -->|"returns parsed ledger"| node_app
node_app -.->|"previews transactions"| node_ledger
node_user -->|"chooses format"| node_exportoptions
node_app -->|"shows options"| node_exportoptions
node_app -->|"starts export"| node_export
node_export -->|"dispatches CSV"| node_csv
node_export -->|"dispatches XLSX"| node_xlsx
node_export -->|"dispatches JSON"| node_json
node_export -->|"dispatches OFX/QFX"| node_ofx
node_export -->|"dispatches QIF"| node_qif
node_xlsx -->|"adds analysis sheets"| node_sheets
node_xlsx -->|"formats dates"| node_dates
node_exportoptions -->|"sends extracted data"| node_webhook
node_webhook -->|"posts JSON"| node_api
node_updates -.->|"checks releases"| node_release
node_app -->|"displays updates"| node_updates
node_app -->|"renders controls"| node_ui
node_exportoptions -->|"renders controls"| node_ui

click node_app "https://github.com/davidamunga/mpesa2csv/blob/main/src/App.tsx"
click node_upload "https://github.com/davidamunga/mpesa2csv/blob/main/src/components/file-uploader.tsx"
click node_extract "https://github.com/davidamunga/mpesa2csv/blob/main/src/services/tabulaService.ts"
click node_native "https://github.com/davidamunga/mpesa2csv/blob/main/src-tauri/src/lib.rs"
click node_ledger "https://github.com/davidamunga/mpesa2csv/blob/main/src/services/transactionFilters.ts"
click node_exportoptions "https://github.com/davidamunga/mpesa2csv/blob/main/src/components/export-options.tsx"
click node_export "https://github.com/davidamunga/mpesa2csv/blob/main/src/services/exportService.ts"
click node_csv "https://github.com/davidamunga/mpesa2csv/blob/main/src/services/csvService.ts"
click node_xlsx "https://github.com/davidamunga/mpesa2csv/blob/main/src/services/xlsxService.ts"
click node_json "https://github.com/davidamunga/mpesa2csv/blob/main/src/services/jsonService.ts"
click node_ofx "https://github.com/davidamunga/mpesa2csv/blob/main/src/services/ofxService.ts"
click node_qif "https://github.com/davidamunga/mpesa2csv/blob/main/src/services/qifService.ts"
click node_sheets "https://github.com/davidamunga/mpesa2csv/tree/main/src/services/exports"
click node_dates "https://github.com/davidamunga/mpesa2csv/blob/main/src/utils/dateFormatter.ts"
click node_webhook "https://github.com/davidamunga/mpesa2csv/blob/main/src/services/webhookService.ts"
click node_updates "https://github.com/davidamunga/mpesa2csv/blob/main/src/components/update-checker.tsx"
click node_ui "https://github.com/davidamunga/mpesa2csv/tree/main/src/components/ui"

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_upload,node_extract,node_native,node_ledger,node_user,node_api toneBlue
class node_exportoptions,node_export,node_csv,node_xlsx,node_json,node_ofx,node_qif,node_sheets,node_dates toneAmber
class node_webhook,node_updates toneMint
class node_ui toneRose
class node_tabula,node_release toneIndigo
```

## Components

### Statement workflow

- [Workflow coordinator](https://github.com/davidamunga/mpesa2csv/blob/main/src/App.tsx): `src/App.tsx`
- [PDF selection](https://github.com/davidamunga/mpesa2csv/blob/main/src/components/file-uploader.tsx): `src/components/file-uploader.tsx`
- [PDF extraction and parsing](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/tabulaService.ts): `src/services/tabulaService.ts`
- [Native PDF commands](https://github.com/davidamunga/mpesa2csv/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Transaction filters](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/transactionFilters.ts): `src/services/transactionFilters.ts`

### Export and analysis

- [Export configuration](https://github.com/davidamunga/mpesa2csv/blob/main/src/components/export-options.tsx): `src/components/export-options.tsx`
- [Format dispatcher](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/exportService.ts): `src/services/exportService.ts`
- [CSV export](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/csvService.ts): `src/services/csvService.ts`
- [Excel workbook](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/xlsxService.ts): `src/services/xlsxService.ts`
- [JSON export](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/jsonService.ts): `src/services/jsonService.ts`
- [OFX and QFX export](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/ofxService.ts): `src/services/ofxService.ts`
- [QIF export](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/qifService.ts): `src/services/qifService.ts`
- [Analysis sheets](https://github.com/davidamunga/mpesa2csv/tree/main/src/services/exports): `src/services/exports`
- [Date formatting](https://github.com/davidamunga/mpesa2csv/blob/main/src/utils/dateFormatter.ts): `src/utils/dateFormatter.ts`

### App integrations

- [Webhook delivery](https://github.com/davidamunga/mpesa2csv/blob/main/src/services/webhookService.ts): `src/services/webhookService.ts`
- [Update checker](https://github.com/davidamunga/mpesa2csv/blob/main/src/components/update-checker.tsx): `src/components/update-checker.tsx`

### User interface

- [UI primitives](https://github.com/davidamunga/mpesa2csv/tree/main/src/components/ui): `src/components/ui`

### Other components

- **Statement user**
- **Tabula extractor**
- **User API endpoint**
- **Release service**

## Connections

- Statement user → PDF selection: selects PDFs (evidence: `README.md`)
- PDF selection → Workflow coordinator: provides files (evidence: `src/App.tsx`)
- Workflow coordinator → PDF extraction and parsing: processes statements (evidence: `README.md`)
- PDF extraction and parsing → Native PDF commands: invokes extraction (evidence: `src/services/tabulaService.ts`)
- Native PDF commands → Tabula extractor: extracts tables
- PDF extraction and parsing → Workflow coordinator: returns parsed ledger (evidence: `README.md`)
- Workflow coordinator → Transaction filters: previews transactions
- Statement user → Export configuration: chooses format (evidence: `README.md`)
- Workflow coordinator → Export configuration: shows options (evidence: `src/App.tsx`)
- Workflow coordinator → Format dispatcher: starts export (evidence: `README.md`)
- Format dispatcher → CSV export: dispatches CSV (evidence: `src/services/exportService.ts`)
- Format dispatcher → Excel workbook: dispatches XLSX (evidence: `src/services/exportService.ts`)
- Format dispatcher → JSON export: dispatches JSON (evidence: `src/services/exportService.ts`)
- Format dispatcher → OFX and QFX export: dispatches OFX/QFX (evidence: `src/services/exportService.ts`)
- Format dispatcher → QIF export: dispatches QIF (evidence: `src/services/exportService.ts`)
- Excel workbook → Analysis sheets: adds analysis sheets (evidence: `src/services/xlsxService.ts`)
- Excel workbook → Date formatting: formats dates (evidence: `src/services/xlsxService.ts`)
- Export configuration → Webhook delivery: sends extracted data (evidence: `src/components/export-options.tsx`)
- Webhook delivery → User API endpoint: posts JSON (evidence: `README.md`)
- Update checker → Release service: checks releases
- Workflow coordinator → Update checker: displays updates (evidence: `src/App.tsx`)
- Workflow coordinator → UI primitives: renders controls (evidence: `src/App.tsx`)
- Export configuration → UI primitives: renders controls (evidence: `src/components/export-options.tsx`)
