# ithobbies/expensetracker architecture

> Architecture diagram of the GitHub repository ithobbies/expensetracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ithobbies/expensetracker
- Repository: https://github.com/ithobbies/expensetracker

## Overview

##### Project type and purpose
- ExpenseTracker is a desktop full-stack (single-machine) application
- Written in Python, uses PySide6 for GUI, stores data locally in SQLite

##### File structure
Top-level files and directories:
- connection.py   – data-access layer (opens/closes SQLite, executes queries)
- main.py         – application entrypoint, initializes GUI, wires signals/slots
- new_transaction.py + new_transaction.ui – “Add new expense” dialog logic + UI description
- ui_main.py + ui_main.ui               – main window GUI logic + UI description
- README.md                              – high-level description and screenshot

Patterns:
- Separation between UI (generated from .ui files) and application logic in .py files
- A simple MVC/MVP-style layering: UI <→ Logic <→ Data

##### README for additional insights
- Confirms PySide6 for GUI, SQLite for persistence
- No external services or microservices – all components live in one process

##### General guidance
- UI windows (Main Window and Dialog) together, link them to their controller modules

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers and Components
    subgraph "Application Logic Layer"
        MAIN["Application Bootstrap\n(main.py)"]:::logic
    end

    subgraph "UI Layer"
        MW_UI["Main Window UI"]:::frontend
        MW_CTRL["Main Window Controller"]:::frontend
        NT_UI["New Transaction UI"]:::frontend
        NT_CTRL["New Transaction Controller"]:::frontend
    end

    subgraph "Data Access Layer"
        CONN["SQLite Connection\n(connection.py)"]:::data
    end

    subgraph "Resource Manager"
        RES_PY["Qt Resources\n(res.py)"]:::resource
        QRC["Resource Definition\n(res-rs.qrc)"]:::resource
        ICONS["Icons Directory"]:::resource
    end

    subgraph "Persistence Store"
        DB["SQLite Database File"]:::db
    end

    %% Interactions
    MAIN -->|"initialize UI"| MW_CTRL
    MAIN -->|"open DB connection"| CONN
    MAIN -->|"load resources"| RES_PY

    RES_PY -->|"compiled from"| QRC
    RES_PY -->|"loads icons"| ICONS

    MW_UI -->|"user event"| MW_CTRL
    NT_UI -->|"user event"| NT_CTRL

    MW_CTRL -->|"execute query"| CONN
    NT_CTRL -->|"execute query"| CONN

    CONN -->|"reads/writes data"| DB

    MW_CTRL -->|"refresh UI"| MW_UI
    NT_CTRL -->|"refresh UI"| MW_UI

    %% Click Events
    click MW_UI "https://github.com/ithobbies/expensetracker/blob/main/ui_main.ui"
    click MW_CTRL "https://github.com/ithobbies/expensetracker/blob/main/ui_main.py"
    click NT_UI "https://github.com/ithobbies/expensetracker/blob/main/new_transaction.ui"
    click NT_CTRL "https://github.com/ithobbies/expensetracker/blob/main/new_transaction.py"
    click MAIN "https://github.com/ithobbies/expensetracker/blob/main/main.py"
    click CONN "https://github.com/ithobbies/expensetracker/blob/main/connection.py"
    click RES_PY "https://github.com/ithobbies/expensetracker/blob/main/res.py"
    click QRC "https://github.com/ithobbies/expensetracker/blob/main/res-rs.qrc"
    click ICONS "https://github.com/ithobbies/expensetracker/tree/main/icons/"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#5B9BD5,stroke-width:2px
    classDef logic fill:#DFF2D8,stroke:#92D050,stroke-width:2px
    classDef data fill:#FFE4B2,stroke:#ED7D31,stroke-width:2px
    classDef resource fill:#E0E0E0,stroke:#808080,stroke-width:2px
    classDef db fill:#FFF0F0,stroke:#C00000,stroke-width:2px
```
