# bleviet/time-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/bleviet/time-tracker
- Repository: https://github.com/bleviet/time-tracker

## Overview

Time Tracker is a desktop app for recording work across tasks, then reviewing and reporting that time. The main workflow runs from the tray/widget through task selection and timer services into persistent entries; users can review and edit history, manage leave, and generate monthly or accounting reports. Other documented branches include lock-aware pause/resume, settings, backups, German holidays, and localization. Edges reflect README statements and shown source references/calls; unsampled wiring is omitted rather than inferred.

Main entry points: [`app/infra/repository.py`](https://github.com/bleviet/time-tracker/blob/main/app/infra/repository.py) (Data repositories), [`app/ui/tray_icon.py`](https://github.com/bleviet/time-tracker/blob/main/app/ui/tray_icon.py) (System tray), [`app/ui/main_window.py`](https://github.com/bleviet/time-tracker/blob/main/app/ui/main_window.py) (Task widget), [`app/ui/history_window.py`](https://github.com/bleviet/time-tracker/blob/main/app/ui/history_window.py) (History window)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Desktop interaction"]
  node_application["Application startup<br/>[main.py]"]
  node_tray["System tray<br/>[tray_icon.py]"]
  node_widget["Task widget<br/>[main_window.py]"]
  node_dialogs["Task dialogs<br/>[task_dialogs.py]"]
  node_history["History window<br/>[history_window.py]"]
  node_settings["Settings<br/>[settings_dialog.py]"]
end

subgraph group_tracking["Time tracking"]
  node_timer["Timer service<br/>[timer_service.py]"]
  node_domain["Tracking models<br/>[models.py]"]
end

subgraph group_persistence["Data and preferences"]
  node_repository["Data repositories<br/>[repository.py]"]
  node_database[("SQLite database<br/>[db.py]")]
  node_configuration["Configuration<br/>[config.py]"]
  node_backup["Backup service<br/>[backup_service.py]"]
end

subgraph group_reporting["Calendar and reporting"]
  node_calendar["Holiday calendar"]
  node_report_ui["Report window<br/>[report_window.py]"]
  node_report_config["Report configuration"]
  node_accounting_report["Accounting CSV"]
  node_excel_report["Excel reports"]
  node_report_service["General reports<br/>[report_service.py]"]
end

subgraph group_platform["Platform support"]
  node_os_hooks["OS lock monitors<br/>[factory.py]"]
  node_translations["English and German<br/>[translations.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_tray
node_user -->|"enters tasks"| node_widget
node_application -.->|"starts"| node_tray
node_tray -->|"shows"| node_widget
node_tray -->|"opens"| node_history
node_tray -->|"opens"| node_settings
node_tray -->|"schedules"| node_backup
node_tray -->|"initializes"| node_os_hooks
node_widget -->|"starts tasks"| node_timer
node_widget -->|"receives ticks"| node_timer
node_widget -->|"looks up tasks"| node_repository
node_history -->|"reads and edits"| node_repository
node_history -->|"opens"| node_dialogs
node_history -->|"opens"| node_report_ui
node_settings -->|"configures"| node_backup
node_timer -->|"saves entries"| node_repository
node_timer -->|"creates entries"| node_domain
node_repository -->|"queries"| node_database
node_repository -->|"maps models"| node_domain
node_configuration -->|"loads preferences"| node_domain
node_backup -->|"exports and restores"| node_repository
node_report_ui -->|"generates CSV"| node_accounting_report
node_report_ui -->|"generates workbook"| node_excel_report
node_report_ui -->|"uses configuration"| node_report_config
node_report_ui -->|"reads entries"| node_repository
node_accounting_report -->|"reads tracked data"| node_repository
node_accounting_report -->|"uses configuration"| node_report_config
node_excel_report -->|"reads tracked data"| node_repository
node_excel_report -->|"uses working days"| node_calendar
node_report_service -->|"reads tracked data"| node_repository
node_history -->|"shows holiday status"| node_calendar
node_calendar -->|"reads language"| node_translations
node_widget -.->|"localizes interface"| node_translations
node_os_hooks -.->|"pauses on lock"| node_timer

click node_application "https://github.com/bleviet/time-tracker/blob/main/main.py"
click node_tray "https://github.com/bleviet/time-tracker/blob/main/app/ui/tray_icon.py"
click node_widget "https://github.com/bleviet/time-tracker/blob/main/app/ui/main_window.py"
click node_dialogs "https://github.com/bleviet/time-tracker/blob/main/app/ui/task_dialogs.py"
click node_history "https://github.com/bleviet/time-tracker/blob/main/app/ui/history_window.py"
click node_settings "https://github.com/bleviet/time-tracker/blob/main/app/ui/settings_dialog.py"
click node_timer "https://github.com/bleviet/time-tracker/blob/main/app/services/timer_service.py"
click node_domain "https://github.com/bleviet/time-tracker/blob/main/app/domain/models.py"
click node_repository "https://github.com/bleviet/time-tracker/blob/main/app/infra/repository.py"
click node_database "https://github.com/bleviet/time-tracker/blob/main/app/infra/db.py"
click node_configuration "https://github.com/bleviet/time-tracker/blob/main/app/infra/config.py"
click node_backup "https://github.com/bleviet/time-tracker/blob/main/app/services/backup_service.py"
click node_calendar "https://github.com/bleviet/time-tracker/blob/main/app/services/calendar_service.py"
click node_report_ui "https://github.com/bleviet/time-tracker/blob/main/app/ui/report_window.py"
click node_report_config "https://github.com/bleviet/time-tracker/blob/main/app/services/matrix_report_service.py"
click node_accounting_report "https://github.com/bleviet/time-tracker/blob/main/app/services/accounting_matrix_service.py"
click node_excel_report "https://github.com/bleviet/time-tracker/blob/main/app/services/excel_report_service.py"
click node_report_service "https://github.com/bleviet/time-tracker/blob/main/app/services/report_service.py"
click node_os_hooks "https://github.com/bleviet/time-tracker/blob/main/app/infra/os_hooks/factory.py"
click node_translations "https://github.com/bleviet/time-tracker/blob/main/app/i18n/translations.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_application,node_tray,node_widget,node_dialogs,node_history,node_settings,node_user toneBlue
class node_timer,node_domain toneAmber
class node_repository,node_database,node_configuration,node_backup toneMint
class node_calendar,node_report_ui,node_report_config,node_accounting_report,node_excel_report,node_report_service toneRose
class node_os_hooks,node_translations toneIndigo
```

## Components

### Desktop interaction

- [Application startup](https://github.com/bleviet/time-tracker/blob/main/main.py): `main.py`
- [System tray](https://github.com/bleviet/time-tracker/blob/main/app/ui/tray_icon.py): `app/ui/tray_icon.py`
- [Task widget](https://github.com/bleviet/time-tracker/blob/main/app/ui/main_window.py): `app/ui/main_window.py`
- [Task dialogs](https://github.com/bleviet/time-tracker/blob/main/app/ui/task_dialogs.py): `app/ui/task_dialogs.py`
- [History window](https://github.com/bleviet/time-tracker/blob/main/app/ui/history_window.py): `app/ui/history_window.py`
- [Settings](https://github.com/bleviet/time-tracker/blob/main/app/ui/settings_dialog.py): `app/ui/settings_dialog.py`

### Time tracking

- [Timer service](https://github.com/bleviet/time-tracker/blob/main/app/services/timer_service.py): `app/services/timer_service.py`
- [Tracking models](https://github.com/bleviet/time-tracker/blob/main/app/domain/models.py): `app/domain/models.py`

### Data and preferences

- [Data repositories](https://github.com/bleviet/time-tracker/blob/main/app/infra/repository.py): `app/infra/repository.py`
- [SQLite database](https://github.com/bleviet/time-tracker/blob/main/app/infra/db.py): `app/infra/db.py`
- [Configuration](https://github.com/bleviet/time-tracker/blob/main/app/infra/config.py): `app/infra/config.py`
- [Backup service](https://github.com/bleviet/time-tracker/blob/main/app/services/backup_service.py): `app/services/backup_service.py`

### Calendar and reporting

- [Holiday calendar](https://github.com/bleviet/time-tracker/blob/main/app/services/calendar_service.py): `app/services/calendar_service.py`
- [Report window](https://github.com/bleviet/time-tracker/blob/main/app/ui/report_window.py): `app/ui/report_window.py`
- [Report configuration](https://github.com/bleviet/time-tracker/blob/main/app/services/matrix_report_service.py): `app/services/matrix_report_service.py`
- [Accounting CSV](https://github.com/bleviet/time-tracker/blob/main/app/services/accounting_matrix_service.py): `app/services/accounting_matrix_service.py`
- [Excel reports](https://github.com/bleviet/time-tracker/blob/main/app/services/excel_report_service.py): `app/services/excel_report_service.py`
- [General reports](https://github.com/bleviet/time-tracker/blob/main/app/services/report_service.py): `app/services/report_service.py`

### Platform support

- [OS lock monitors](https://github.com/bleviet/time-tracker/blob/main/app/infra/os_hooks/factory.py): `app/infra/os_hooks/factory.py`
- [English and German](https://github.com/bleviet/time-tracker/blob/main/app/i18n/translations.py): `app/i18n/translations.py`

### Other components

- **User**

## Connections

- User → System tray: uses (evidence: `README.md`)
- User → Task widget: enters tasks (evidence: `README.md`)
- Application startup → System tray: starts
- System tray → Task widget: shows (evidence: `app/ui/tray_icon.py`)
- System tray → History window: opens (evidence: `app/ui/tray_icon.py`)
- System tray → Settings: opens (evidence: `app/ui/tray_icon.py`)
- System tray → Backup service: schedules (evidence: `app/ui/tray_icon.py`)
- System tray → OS lock monitors: initializes (evidence: `app/ui/tray_icon.py`)
- Task widget → Timer service: starts tasks (evidence: `app/ui/main_window.py`)
- Task widget → Timer service: receives ticks (evidence: `app/ui/main_window.py`)
- Task widget → Data repositories: looks up tasks (evidence: `app/ui/main_window.py`)
- History window → Data repositories: reads and edits (evidence: `app/ui/history_window.py`)
- History window → Task dialogs: opens (evidence: `app/ui/history_window.py`)
- History window → Report window: opens (evidence: `app/ui/history_window.py`)
- Settings → Backup service: configures (evidence: `app/ui/settings_dialog.py`)
- Timer service → Data repositories: saves entries (evidence: `app/services/timer_service.py`)
- Timer service → Tracking models: creates entries (evidence: `app/services/timer_service.py`)
- Data repositories → SQLite database: queries (evidence: `app/infra/repository.py`)
- Data repositories → Tracking models: maps models (evidence: `app/infra/repository.py`)
- Configuration → Tracking models: loads preferences (evidence: `app/infra/config.py`)
- Backup service → Data repositories: exports and restores (evidence: `app/services/backup_service.py`)
- Report window → Accounting CSV: generates CSV (evidence: `app/ui/report_window.py`)
- Report window → Excel reports: generates workbook (evidence: `app/ui/report_window.py`)
- Report window → Report configuration: uses configuration (evidence: `app/ui/report_window.py`)
- Report window → Data repositories: reads entries (evidence: `app/ui/report_window.py`)
- Accounting CSV → Data repositories: reads tracked data (evidence: `app/services/accounting_matrix_service.py`)
- Accounting CSV → Report configuration: uses configuration (evidence: `app/services/accounting_matrix_service.py`)
- Excel reports → Data repositories: reads tracked data (evidence: `app/services/excel_report_service.py`)
- Excel reports → Holiday calendar: uses working days (evidence: `app/services/excel_report_service.py`)
- General reports → Data repositories: reads tracked data (evidence: `app/services/report_service.py`)
- History window → Holiday calendar: shows holiday status (evidence: `app/ui/history_window.py`)
- Holiday calendar → English and German: reads language (evidence: `app/services/calendar_service.py`)
- Task widget → English and German: localizes interface
- OS lock monitors → Timer service: pauses on lock
