# pekkamc/finam architecture

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

- Interactive diagram: https://gitdiagram.com/pekkamc/finam
- Repository: https://github.com/pekkamc/finam

## Overview

Finam is a Flet-based financial learning and management app. The principal workflow is entering the app, resolving a route to a feature page, and using that feature to manage financial information persisted locally; the README also describes lessons, receipt scanning, analytics, and AI insights. The sampled app and database excerpts support startup and local persistence, while several feature implementations were not sampled, so their internal call relationships are omitted. Optional AI wiring is not identifiable from the available evidence.

Main entry points: [`src/app.py`](https://github.com/pekkamc/finam/blob/master/src/app.py) (Route Dispatcher), [`src/database.py`](https://github.com/pekkamc/finam/blob/master/src/database.py) (SQLite Persistence), [`src/pages/common/financial_chart/components.py`](https://github.com/pekkamc/finam/blob/master/src/pages/common/financial_chart/components.py) (Financial Charts), [`src/pages/savings`](https://github.com/pekkamc/finam/tree/master/src/pages/savings) (Savings Goals)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["App Runtime"]
  node_app["Route Dispatcher<br/>[app.py]"]
  node_database[("SQLite Persistence<br/>[database.py]")]
  node_logger["Application Logging<br/>[logger.py]"]
end

subgraph group_money["Money Management"]
  node_category["Category Setup"]
  node_spending["Spending Tracker"]
  node_savings["Savings Goals"]
  node_scanner["Purchase Scanner"]
end

subgraph group_learning["Learning and Insights"]
  node_starter["Getting Started"]
  node_home["Home Dashboard"]
  node_lessons["Interactive Lessons"]
  node_analysis["Spending Analysis"]
end

subgraph group_shared["Shared UI and State"]
  node_accounts["User Accounts<br/>[accounts.py]"]
  node_usage_cache["Usage Cache<br/>[usage_cache.py]"]
  node_chart["Financial Charts<br/>[components.py]"]
  node_user_management["User Management<br/>[view.py]"]
  node_settings["App Settings"]
  node_keyboard["Entry Keyboard<br/>[components.py]"]
  node_shared_dialogs["Shared Dialogs"]
  node_categories_data["Category Defaults<br/>[data.py]"]
end

node_user(("App User"))
node_ai{{"Google Generative AI"}}

node_user -->|"opens"| node_app
node_app -->|"initializes"| node_database
node_app -->|"routes to"| node_starter
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_category
node_app -->|"routes to"| node_scanner
node_app -->|"routes to"| node_savings
node_app -->|"routes to"| node_spending
node_app -->|"routes to"| node_settings
node_app -->|"routes to"| node_user_management
node_app -->|"routes to"| node_lessons
node_app -->|"logs errors"| node_logger
node_accounts -->|"uses account data"| node_database
node_usage_cache -->|"uses stored data"| node_database
node_chart -->|"queries chart data"| node_database
node_chart -->|"gets currency"| node_accounts
node_savings -->|"uses entry UI"| node_keyboard
node_scanner -.->|"tracks purchases"| node_spending
node_analysis -.->|"visualizes analytics"| node_chart
node_categories_data -.->|"supplies defaults"| node_category
node_user -.->|"requests insights"| node_ai
node_app -.->|"offers analysis"| node_analysis
node_app -.->|"offers analysis dialogs"| node_shared_dialogs

click node_app "https://github.com/pekkamc/finam/blob/master/src/app.py"
click node_database "https://github.com/pekkamc/finam/blob/master/src/database.py"
click node_logger "https://github.com/pekkamc/finam/blob/master/src/logger.py"
click node_accounts "https://github.com/pekkamc/finam/blob/master/src/pages/common/logic/accounts.py"
click node_usage_cache "https://github.com/pekkamc/finam/blob/master/src/pages/common/logic/usage_cache.py"
click node_starter "https://github.com/pekkamc/finam/tree/master/src/pages/starter"
click node_home "https://github.com/pekkamc/finam/tree/master/src/pages/home"
click node_lessons "https://github.com/pekkamc/finam/tree/master/src/pages/help"
click node_category "https://github.com/pekkamc/finam/tree/master/src/pages/category_selection"
click node_spending "https://github.com/pekkamc/finam/tree/master/src/pages/spending"
click node_savings "https://github.com/pekkamc/finam/tree/master/src/pages/savings"
click node_scanner "https://github.com/pekkamc/finam/tree/master/src/pages/purchase_scanner"
click node_analysis "https://github.com/pekkamc/finam/blob/master/src/pages/common/spending_analysis.py"
click node_chart "https://github.com/pekkamc/finam/blob/master/src/pages/common/financial_chart/components.py"
click node_user_management "https://github.com/pekkamc/finam/blob/master/src/pages/user_management/view.py"
click node_settings "https://github.com/pekkamc/finam/tree/master/src/pages/settings"
click node_keyboard "https://github.com/pekkamc/finam/blob/master/src/pages/common/keyboard_container/components.py"
click node_shared_dialogs "https://github.com/pekkamc/finam/blob/master/src/pages/common/spending_analysis_dialogs.py"
click node_categories_data "https://github.com/pekkamc/finam/blob/master/src/utils/data.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_app,node_database,node_logger,node_user toneBlue
class node_category,node_spending,node_savings,node_scanner toneAmber
class node_starter,node_home,node_lessons,node_analysis toneMint
class node_accounts,node_usage_cache,node_chart,node_user_management,node_settings,node_keyboard,node_shared_dialogs,node_categories_data toneRose
class node_ai toneIndigo
```

## Components

### App Runtime

- [Route Dispatcher](https://github.com/pekkamc/finam/blob/master/src/app.py): `src/app.py`
- [SQLite Persistence](https://github.com/pekkamc/finam/blob/master/src/database.py): `src/database.py`
- [Application Logging](https://github.com/pekkamc/finam/blob/master/src/logger.py): `src/logger.py`

### Money Management

- [Category Setup](https://github.com/pekkamc/finam/tree/master/src/pages/category_selection): `src/pages/category_selection`
- [Spending Tracker](https://github.com/pekkamc/finam/tree/master/src/pages/spending): `src/pages/spending`
- [Savings Goals](https://github.com/pekkamc/finam/tree/master/src/pages/savings): `src/pages/savings`
- [Purchase Scanner](https://github.com/pekkamc/finam/tree/master/src/pages/purchase_scanner): `src/pages/purchase_scanner`

### Learning and Insights

- [Getting Started](https://github.com/pekkamc/finam/tree/master/src/pages/starter): `src/pages/starter`
- [Home Dashboard](https://github.com/pekkamc/finam/tree/master/src/pages/home): `src/pages/home`
- [Interactive Lessons](https://github.com/pekkamc/finam/tree/master/src/pages/help): `src/pages/help`
- [Spending Analysis](https://github.com/pekkamc/finam/blob/master/src/pages/common/spending_analysis.py): `src/pages/common/spending_analysis.py`

### Shared UI and State

- [User Accounts](https://github.com/pekkamc/finam/blob/master/src/pages/common/logic/accounts.py): `src/pages/common/logic/accounts.py`
- [Usage Cache](https://github.com/pekkamc/finam/blob/master/src/pages/common/logic/usage_cache.py): `src/pages/common/logic/usage_cache.py`
- [Financial Charts](https://github.com/pekkamc/finam/blob/master/src/pages/common/financial_chart/components.py): `src/pages/common/financial_chart/components.py`
- [User Management](https://github.com/pekkamc/finam/blob/master/src/pages/user_management/view.py): `src/pages/user_management/view.py`
- [App Settings](https://github.com/pekkamc/finam/tree/master/src/pages/settings): `src/pages/settings`
- [Entry Keyboard](https://github.com/pekkamc/finam/blob/master/src/pages/common/keyboard_container/components.py): `src/pages/common/keyboard_container/components.py`
- [Shared Dialogs](https://github.com/pekkamc/finam/blob/master/src/pages/common/spending_analysis_dialogs.py): `src/pages/common/spending_analysis_dialogs.py`
- [Category Defaults](https://github.com/pekkamc/finam/blob/master/src/utils/data.py): `src/utils/data.py`

### Other components

- **App User**
- **Google Generative AI**

## Connections

- App User → Route Dispatcher: opens
- Route Dispatcher → SQLite Persistence: initializes (evidence: `src/app.py`)
- Route Dispatcher → Getting Started: routes to (evidence: `src/app.py`)
- Route Dispatcher → Home Dashboard: routes to (evidence: `src/app.py`)
- Route Dispatcher → Category Setup: routes to (evidence: `src/app.py`)
- Route Dispatcher → Purchase Scanner: routes to (evidence: `src/app.py`)
- Route Dispatcher → Savings Goals: routes to (evidence: `src/app.py`)
- Route Dispatcher → Spending Tracker: routes to (evidence: `src/app.py`)
- Route Dispatcher → App Settings: routes to (evidence: `src/app.py`)
- Route Dispatcher → User Management: routes to (evidence: `src/app.py`)
- Route Dispatcher → Interactive Lessons: routes to (evidence: `src/app.py`)
- Route Dispatcher → Application Logging: logs errors (evidence: `src/app.py`)
- User Accounts → SQLite Persistence: uses account data (evidence: `src/pages/common/logic/accounts.py`)
- Usage Cache → SQLite Persistence: uses stored data (evidence: `src/pages/common/logic/usage_cache.py`)
- Financial Charts → SQLite Persistence: queries chart data
- Financial Charts → User Accounts: gets currency (evidence: `src/pages/common/financial_chart/components.py`)
- Savings Goals → Entry Keyboard: uses entry UI (evidence: `src/pages/savings/components.py`)
- Purchase Scanner → Spending Tracker: tracks purchases (evidence: `README.md`)
- Spending Analysis → Financial Charts: visualizes analytics (evidence: `README.md`)
- Category Defaults → Category Setup: supplies defaults
- App User → Google Generative AI: requests insights (evidence: `README.md`)
- Route Dispatcher → Spending Analysis: offers analysis (evidence: `README.md`)
- Route Dispatcher → Shared Dialogs: offers analysis dialogs (evidence: `README.md`)
