# ariffurrhmn/personal-finance-manager architecture

> Architecture diagram of the GitHub repository ariffurrhmn/personal-finance-manager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ariffurrhmn/personal-finance-manager
- Repository: https://github.com/ariffurrhmn/personal-finance-manager

## Overview

##### Project Type and Purpose
- This is a monolithic desktop application (“Personal Finance Manager”) written in Python, using Tkinter for the GUI and SQLite for data persistence. Its purpose is to let individual users register/log in, manage accounts, record transactions, set budgets and savings goals, and view financial reports with charts.

##### File Structure Analysis
- Top-level files:
- Complete_app.py – the single entry-point script containing UI setup, business logic, and integration with the database and visualization components
- finance_app.db – the SQLite file storing all tables: User, Account, Category, Transactions, SavingGoal, Budget
- finance_app.log – application log file for debugging and error tracking
- SampleUsers.txt – seed/test credentials
- README.md – project documentation
- There are no sub-directories—this is a classic “all-in-one” desktop application without separate frontend/backend services.

##### Key Architectural Components
a. UI Layer (Tkinter)
- Windows/Screens: Login/Register, Dashboard, Account Management, Transaction Entry, Budget Setup, Savings Goals, Report Viewer
- Navigation Handlers invoke controller functions when buttons/menu items are clicked
b. Application Logic / Controllers
- Authentication Module (hashlib & secrets for password hashing and verification, email verification stubs)
- Account Management Module (create/edit/delete accounts, balance calculations)
- Transaction Module (CRUD operations on Transactions table, category assignment, transfer logic)
- Budget Module (CRUD budgets, spend-vs-limit checks)
- SavingsGoals Module (progress tracking, deadline management)
- Reporting Module (gathers data, calls Matplotlib to render charts, exports data)
- Logging Module (writes to finance_app.log)
c. Data Layer (SQLite)
- Tables: User, Account, Category, Transactions, SavingGoal, Budget
- Data Access Objects (DAOs) or direct sqlite3 calls embedded in Complete_app.py
d. Visualization Component (Matplotlib)
- Chart renderer invoked by Reporting Module to produce bar charts, pie charts, progress indicators
e. External Services (none)
- All data is local. No web services or external APIs.

##### Relationships & Data Flow
- The user’s actions on the Tkinter UI generate events → Controller functions process input → Controller calls Data Layer functions to query/update the SQLite DB → Data Layer returns results → Controller updates UI or passes data to Matplotlib → Matplotlib returns chart object → Controller embeds chart in UI canvas or saves to file → Logging Module writes any errors or info to finance_app.log.

##### Architectural Patterns and Principles
- Layered Architecture: UI, Controllers (business logic), Data Access
- Single-process, synchronous flow
- Separation of concerns between modules (authentication, account, transaction, etc.)
- Use of MVC-like pattern: Tkinter views, controller functions, and model = SQLite tables
- Modular design: distinct feature modules (budget, savings goals, reporting)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Entity
    User["User"]:::external

    %% UI Layer
    subgraph "UI Layer"
        UI["Tkinter UI"]:::frontend
    end

    %% Controller Modules
    subgraph "Application Logic / Controllers"
        Auth["Authentication Module"]:::logic
        Account["Account Management Module"]:::logic
        Transaction["Transaction Module"]:::logic
        Budget["Budget Module"]:::logic
        Goals["Savings Goals Module"]:::logic
        Reporting["Reporting Module"]:::logic
    end

    %% Data Layer
    DataLayer[(SQLite Database)]:::persistence
    DataLayerDetails["User, Account, Category,\nTransactions, SavingGoal, Budget"]:::persistence

    %% Visualization Component
    Visualization["Matplotlib Charts"]:::visualization

    %% Logging Component
    Logging["finance_app.log"]:::logging

    %% Sample/Test Credentials and Documentation
    SampleUsers["SampleUsers.txt"]:::external
    Readme["README.md"]:::external

    %% Relationships
    User -->|"interacts with"| UI
    UI -->|"button/menu events"| Auth
    UI -->|"button/menu events"| Account
    UI -->|"button/menu events"| Transaction
    UI -->|"button/menu events"| Budget
    UI -->|"button/menu events"| Goals
    UI -->|"button/menu events"| Reporting

    Auth -->|"INSERT/SELECT User"| DataLayer
    Account -->|"INSERT/SELECT Account"| DataLayer
    Transaction -->|"INSERT/SELECT Transactions"| DataLayer
    Budget -->|"INSERT/SELECT Budget"| DataLayer
    Goals -->|"INSERT/SELECT SavingGoal"| DataLayer
    Reporting -->|"SELECT Reporting Data"| DataLayer

    Reporting -->|"Render Chart"| Visualization
    Visualization -->|"Chart Object"| Reporting
    Reporting -->|"update UI"| UI

    Auth -->|"Log events"| Logging
    Account -->|"Log events"| Logging
    Transaction -->|"Log events"| Logging
    Budget -->|"Log events"| Logging
    Goals -->|"Log events"| Logging
    Reporting -->|"Log events"| Logging

    SampleUsers -->|"seed data"| Auth
    Readme -.-> UI

    %% Database details grouping
    DataLayer --> DataLayerDetails

    %% Click Events
    click UI "https://github.com/ariffurrhmn/personal-finance-manager/blob/main/Complete_app.py"
    click Auth "https://github.com/ariffurrhmn/personal-finance-manager/blob/main/Complete_app.py"
    click Account "https://github.com/ariffurrhmn/personal-finance-manager/blob/main/Complete_app.py"
    click Transaction "https://github.com/ariffurrhmn/personal-finance-manager/blob/main/Complete_app.py"
    click Budget "https://github.com/ariffurrhmn/personal-finance-manager/blob/main/Complete_app.py"
    click Goals "https://github.com/ariffurrhmn/personal-finance-manager/blob/main/Complete_app.py"
    click Reporting "https://github.com/ariffurrhmn/personal-finance-manager/blob/main/Complete_app.py"
    click DataLayer "https://github.com/ariffurrhmn/personal-finance-manager/blob/main/finance_app.db"
    click SampleUsers "https://github.com/ariffurrhmn/personal-finance-manager/blob/main/SampleUsers.txt"
    click Readme "https://github.com/ariffurrhmn/personal-finance-manager/blob/main/README.md"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#333,stroke-width:1px
    classDef logic fill:#ABEBC6,stroke:#333,stroke-width:1px
    classDef persistence fill:#F9E79F,stroke:#333,stroke-width:1px
    classDef visualization fill:#F5B041,stroke:#333,stroke-width:1px
    classDef logging fill:#D5DBDB,stroke:#333,stroke-width:1px
    classDef external fill:#E8E8E8,stroke:#333,stroke-width:1px
```
