# harsh-91/statement-importer architecture

> Architecture diagram of the GitHub repository harsh-91/statement-importer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harsh-91/statement-importer
- Repository: https://github.com/harsh-91/statement-importer

## Overview

Statement Importer is an offline-first desktop application for importing and reconciling bank statements into PostgreSQL. The main workflow is: a user launches the local desktop UI, configures storage, uploads statements, and receives import results backed by normalized transaction data. The graph also preserves documented capabilities for safe custom mappings, diagnostics and bug reports, database maintenance, updates, and read-only REST/MCP access. Most edges are supported by the README or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`app.py`](https://github.com/harsh-91/statement-importer/blob/main/app.py) (Web application), [`statement_importer/database.py`](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/database.py) (Transaction database), [`statement_importer/local_postgres.py`](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/local_postgres.py) (Managed PostgreSQL), [`statement_importer/config.py`](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/config.py) (Connection settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_desktop_shell["Desktop shell<br/>[desktop.py]"]
  node_web_app["Web application<br/>[app.py]"]
  node_setup_ui["Storage setup<br/>[setup.html]"]
  node_import_ui["Import screens<br/>[imports.html]"]
end

subgraph group_imports["Statement processing"]
  node_import_handler["Import workflow<br/>[app.py]"]
  node_statement_parsers["Statement parsers<br/>[parsers.py]"]
  node_mapping["Custom mapping<br/>[mapping.py]"]
end

subgraph group_storage["Data and safety"]
  node_database[("Transaction database<br/>[database.py]")]
  node_settings["Connection settings<br/>[config.py]"]
  node_local_postgres[("Managed PostgreSQL<br/>[local_postgres.py]")]
  node_access["Reporting and access<br/>[access.py]"]
  node_maintenance["Database safety<br/>[maintenance.py]"]
end

subgraph group_services["Local integrations"]
  node_api["REST and MCP<br/>[api.py]"]
  node_claude_extension["Claude extension<br/>[index.js]"]
end

subgraph group_operations["Operations"]
  node_diagnostics["Diagnostics<br/>[diagnostics.py]"]
  node_report_relay["Report relay<br/>[index.js]"]
  node_updater["Legacy and beta updates<br/>[updater.py]"]
  node_version["Version metadata<br/>[version.py]"]
  node_package_detection["Package detection<br/>[windows_package.py]"]
end

node_user(("Desktop user"))
node_bug_triage["GitHub triage"]

node_user -->|"launches"| node_desktop_shell
node_desktop_shell -->|"serves locally"| node_web_app
node_user -->|"uses"| node_web_app
node_web_app -->|"renders"| node_setup_ui
node_web_app -->|"renders"| node_import_ui
node_web_app -->|"configures"| node_settings
node_web_app -->|"sets up storage"| node_local_postgres
node_web_app -->|"routes imports"| node_import_handler
node_import_handler -->|"parses files"| node_statement_parsers
node_import_handler -->|"supports mapped files"| node_mapping
node_import_handler -->|"records imports"| node_database
node_database -->|"loads connection"| node_settings
node_database -->|"uses fingerprints"| node_statement_parsers
node_mapping -->|"uses parsing"| node_statement_parsers
node_mapping -->|"loads settings"| node_settings
node_local_postgres -->|"uses configuration"| node_settings
node_local_postgres -->|"prepares schema"| node_database
node_web_app -->|"offers safety tools"| node_maintenance
node_maintenance -->|"loads connection"| node_settings
node_maintenance -->|"uses PostgreSQL tools"| node_local_postgres
node_web_app -->|"registers services"| node_api
node_api -->|"authenticates and queries"| node_access
node_api -->|"serves transaction data"| node_database
node_claude_extension -.->|"forwards MCP requests"| node_api
node_web_app -->|"offers diagnostics"| node_diagnostics
node_diagnostics -->|"checks configuration"| node_settings
node_diagnostics -->|"checks database"| node_database
node_diagnostics -->|"checks local server"| node_local_postgres
node_diagnostics -->|"submits reports"| node_report_relay
node_report_relay -->|"forwards reports"| node_bug_triage
node_web_app -->|"offers updates"| node_updater
node_updater -->|"compares versions"| node_version
node_web_app -->|"checks package type"| node_package_detection
node_desktop_shell -->|"starts managed server"| node_local_postgres

click node_desktop_shell "https://github.com/harsh-91/statement-importer/blob/main/desktop.py"
click node_web_app "https://github.com/harsh-91/statement-importer/blob/main/app.py"
click node_setup_ui "https://github.com/harsh-91/statement-importer/blob/main/templates/setup.html"
click node_import_ui "https://github.com/harsh-91/statement-importer/blob/main/templates/imports.html"
click node_import_handler "https://github.com/harsh-91/statement-importer/blob/main/app.py"
click node_statement_parsers "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/parsers.py"
click node_mapping "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/mapping.py"
click node_database "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/database.py"
click node_settings "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/config.py"
click node_local_postgres "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/local_postgres.py"
click node_access "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/access.py"
click node_maintenance "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/maintenance.py"
click node_api "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/api.py"
click node_claude_extension "https://github.com/harsh-91/statement-importer/blob/main/claude-desktop/server/index.js"
click node_diagnostics "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/diagnostics.py"
click node_report_relay "https://github.com/harsh-91/statement-importer/blob/main/report-relay/src/index.js"
click node_updater "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/updater.py"
click node_version "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/version.py"
click node_package_detection "https://github.com/harsh-91/statement-importer/blob/main/statement_importer/windows_package.py"

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_desktop_shell,node_web_app,node_setup_ui,node_import_ui,node_user toneBlue
class node_import_handler,node_statement_parsers,node_mapping toneAmber
class node_database,node_settings,node_local_postgres,node_access,node_maintenance toneMint
class node_api,node_claude_extension toneRose
class node_diagnostics,node_report_relay,node_updater,node_version,node_package_detection,node_bug_triage toneIndigo
```

## Components

### Desktop experience

- [Desktop shell](https://github.com/harsh-91/statement-importer/blob/main/desktop.py): `desktop.py`
- [Web application](https://github.com/harsh-91/statement-importer/blob/main/app.py): `app.py`
- [Storage setup](https://github.com/harsh-91/statement-importer/blob/main/templates/setup.html): `templates/setup.html`
- [Import screens](https://github.com/harsh-91/statement-importer/blob/main/templates/imports.html): `templates/imports.html`

### Statement processing

- [Import workflow](https://github.com/harsh-91/statement-importer/blob/main/app.py): `app.py`
- [Statement parsers](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/parsers.py): `statement_importer/parsers.py`
- [Custom mapping](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/mapping.py): `statement_importer/mapping.py`

### Data and safety

- [Transaction database](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/database.py): `statement_importer/database.py`
- [Connection settings](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/config.py): `statement_importer/config.py`
- [Managed PostgreSQL](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/local_postgres.py): `statement_importer/local_postgres.py`
- [Reporting and access](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/access.py): `statement_importer/access.py`
- [Database safety](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/maintenance.py): `statement_importer/maintenance.py`

### Local integrations

- [REST and MCP](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/api.py): `statement_importer/api.py`
- [Claude extension](https://github.com/harsh-91/statement-importer/blob/main/claude-desktop/server/index.js): `claude-desktop/server/index.js`

### Operations

- [Diagnostics](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/diagnostics.py): `statement_importer/diagnostics.py`
- [Report relay](https://github.com/harsh-91/statement-importer/blob/main/report-relay/src/index.js): `report-relay/src/index.js`
- [Legacy and beta updates](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/updater.py): `statement_importer/updater.py`
- [Version metadata](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/version.py): `statement_importer/version.py`
- [Package detection](https://github.com/harsh-91/statement-importer/blob/main/statement_importer/windows_package.py): `statement_importer/windows_package.py`

### Other components

- **Desktop user**
- **GitHub triage**

## Connections

- Desktop user → Desktop shell: launches (evidence: `README.md`)
- Desktop shell → Web application: serves locally (evidence: `desktop.py`)
- Desktop user → Web application: uses (evidence: `README.md`)
- Web application → Storage setup: renders (evidence: `README.md`)
- Web application → Import screens: renders (evidence: `README.md`)
- Web application → Connection settings: configures (evidence: `app.py`)
- Web application → Managed PostgreSQL: sets up storage (evidence: `app.py`)
- Web application → Import workflow: routes imports (evidence: `app.py`)
- Import workflow → Statement parsers: parses files (evidence: `app.py`)
- Import workflow → Custom mapping: supports mapped files (evidence: `README.md`)
- Import workflow → Transaction database: records imports (evidence: `app.py`)
- Transaction database → Connection settings: loads connection (evidence: `statement_importer/database.py`)
- Transaction database → Statement parsers: uses fingerprints (evidence: `statement_importer/database.py`)
- Custom mapping → Statement parsers: uses parsing (evidence: `statement_importer/mapping.py`)
- Custom mapping → Connection settings: loads settings (evidence: `statement_importer/mapping.py`)
- Managed PostgreSQL → Connection settings: uses configuration (evidence: `statement_importer/local_postgres.py`)
- Managed PostgreSQL → Transaction database: prepares schema (evidence: `statement_importer/local_postgres.py`)
- Web application → Database safety: offers safety tools (evidence: `README.md`)
- Database safety → Connection settings: loads connection (evidence: `statement_importer/maintenance.py`)
- Database safety → Managed PostgreSQL: uses PostgreSQL tools (evidence: `statement_importer/maintenance.py`)
- Web application → REST and MCP: registers services (evidence: `app.py`)
- REST and MCP → Reporting and access: authenticates and queries (evidence: `statement_importer/api.py`)
- REST and MCP → Transaction database: serves transaction data (evidence: `README.md`)
- Claude extension → REST and MCP: forwards MCP requests (evidence: `README.md`)
- Web application → Diagnostics: offers diagnostics (evidence: `app.py`)
- Diagnostics → Connection settings: checks configuration (evidence: `statement_importer/diagnostics.py`)
- Diagnostics → Transaction database: checks database (evidence: `statement_importer/diagnostics.py`)
- Diagnostics → Managed PostgreSQL: checks local server (evidence: `statement_importer/diagnostics.py`)
- Diagnostics → Report relay: submits reports (evidence: `README.md`)
- Report relay → GitHub triage: forwards reports (evidence: `README.md`)
- Web application → Legacy and beta updates: offers updates (evidence: `README.md`)
- Legacy and beta updates → Version metadata: compares versions (evidence: `statement_importer/updater.py`)
- Web application → Package detection: checks package type (evidence: `app.py`)
- Desktop shell → Managed PostgreSQL: starts managed server (evidence: `desktop.py`)
