# alexprofmutua/ach architecture

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

- Interactive diagram: https://gitdiagram.com/alexprofmutua/ach
- Repository: https://github.com/alexprofmutua/ach

## Overview

ACH is an offline study-time tracker with macOS and Windows editions. The principal workflow is to choose a course and timer mode, start and control a session, then stop to save it; users can review history, trends, goals, and semester totals, and manage portable backups. On macOS, TimerService centralizes session state and persistence, while the desktop timer is a companion surface. The graph includes both platform branches and the documented reporting, goals, and backup capabilities. Windows renderer wiring and some unsampled implementation details are not shown, so those relationships are left unverified.

Main entry points: [`Sources/ACHCore/TimerService.swift`](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/TimerService.swift) (Session Service), [`Sources/ACHApp/MainView.swift`](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/MainView.swift) (Main Navigation), [`Windows/app/main.cjs`](https://github.com/alexprofmutua/ach/blob/main/Windows/app/main.cjs) (Electron Main), [`Sources/ACHApp/DashboardView.swift`](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/DashboardView.swift) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mac_ui["macOS Interface"]
  node_app["App Lifecycle<br/>[ACHApp.swift]"]
  node_main_view["Main Navigation<br/>[MainView.swift]"]
  node_dashboard["Dashboard"]
  node_goals["Goals View<br/>[GoalsView.swift]"]
  node_history["Session History<br/>[SessionsView.swift]"]
  node_semester["Semester Selector"]
  node_settings["Settings<br/>[SettingsView.swift]"]
  node_desktop_timer["Desktop Timer"]
end

subgraph group_core["Study Domain"]
  node_timer["Session Service<br/>[TimerService.swift]"]
  node_models["Study Records<br/>[Models.swift]"]
  node_reporting["Reports and Goals"]
  node_widget_prefs["Timer Preferences"]
end

subgraph group_persistence["Local Data"]
  node_sqlite[("SQLite Database<br/>[SQLiteStore.swift]")]
end

subgraph group_windows["Windows Edition"]
  node_win_main["Electron Main<br/>[main.cjs]"]
  node_win_study["Study Service<br/>[study.cjs]"]
  node_win_store[("JSON Store<br/>[store.cjs]")]
  node_win_geometry["Widget Placement"]
  node_win_ui["Main Window UI<br/>[ui.js]"]
  node_win_widget["Widget UI<br/>[widget.js]"]
  node_win_visuals["UI Visuals<br/>[visuals.js]"]
end

node_user(("Student"))

node_user -->|"uses"| node_main_view
node_main_view -->|"shows"| node_dashboard
node_main_view -->|"shows"| node_goals
node_main_view -->|"shows"| node_history
node_main_view -->|"shows"| node_semester
node_main_view -->|"shows"| node_settings
node_app -->|"opens"| node_main_view
node_app -->|"initializes"| node_timer
node_main_view -->|"controls"| node_timer
node_dashboard -->|"reads totals"| node_timer
node_dashboard -->|"uses"| node_reporting
node_goals -->|"reads goals"| node_timer
node_goals -->|"uses"| node_reporting
node_history -->|"reads sessions"| node_timer
node_semester -->|"selects semester"| node_timer
node_settings -->|"updates settings"| node_timer
node_settings -->|"configures"| node_desktop_timer
node_desktop_timer -->|"observes"| node_timer
node_desktop_timer -->|"reads preferences"| node_widget_prefs
node_timer -->|"persists state"| node_sqlite
node_timer -->|"evaluates progress"| node_reporting
node_timer -->|"updates records"| node_models
node_win_main -->|"dispatches actions"| node_win_study
node_win_main -->|"uses storage"| node_win_store
node_win_main -->|"positions widget"| node_win_geometry
node_win_main -.->|"serves window"| node_win_ui
node_win_main -.->|"serves window"| node_win_widget
node_win_ui -.->|"uses visuals"| node_win_visuals

click node_app "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/ACHApp.swift"
click node_main_view "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/MainView.swift"
click node_dashboard "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/DashboardView.swift"
click node_goals "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/GoalsView.swift"
click node_history "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/SessionsView.swift"
click node_semester "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/SemesterSidebar.swift"
click node_settings "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/SettingsView.swift"
click node_desktop_timer "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/DesktopTimerController.swift"
click node_timer "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/TimerService.swift"
click node_models "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/Models.swift"
click node_reporting "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/ReportingEngine.swift"
click node_widget_prefs "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/WidgetPreferences.swift"
click node_sqlite "https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/SQLiteStore.swift"
click node_win_main "https://github.com/alexprofmutua/ach/blob/main/Windows/app/main.cjs"
click node_win_study "https://github.com/alexprofmutua/ach/blob/main/Windows/app/study.cjs"
click node_win_store "https://github.com/alexprofmutua/ach/blob/main/Windows/app/store.cjs"
click node_win_geometry "https://github.com/alexprofmutua/ach/blob/main/Windows/app/widget-geometry.cjs"
click node_win_ui "https://github.com/alexprofmutua/ach/blob/main/Windows/app/ui.js"
click node_win_widget "https://github.com/alexprofmutua/ach/blob/main/Windows/app/widget.js"
click node_win_visuals "https://github.com/alexprofmutua/ach/blob/main/Windows/app/visuals.js"

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_main_view,node_dashboard,node_goals,node_history,node_semester,node_settings,node_desktop_timer toneBlue
class node_timer,node_models,node_reporting,node_widget_prefs toneAmber
class node_sqlite toneMint
class node_win_main,node_win_study,node_win_store,node_win_geometry,node_win_ui,node_win_widget,node_win_visuals toneRose
class node_user toneIndigo
```

## Components

### macOS Interface

- [App Lifecycle](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/ACHApp.swift): `Sources/ACHApp/ACHApp.swift`
- [Main Navigation](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/MainView.swift): `Sources/ACHApp/MainView.swift`
- [Dashboard](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/DashboardView.swift): `Sources/ACHApp/DashboardView.swift`
- [Goals View](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/GoalsView.swift): `Sources/ACHApp/GoalsView.swift`
- [Session History](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/SessionsView.swift): `Sources/ACHApp/SessionsView.swift`
- [Semester Selector](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/SemesterSidebar.swift): `Sources/ACHApp/SemesterSidebar.swift`
- [Settings](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/SettingsView.swift): `Sources/ACHApp/SettingsView.swift`
- [Desktop Timer](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHApp/DesktopTimerController.swift): `Sources/ACHApp/DesktopTimerController.swift`

### Study Domain

- [Session Service](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/TimerService.swift): `Sources/ACHCore/TimerService.swift`
- [Study Records](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/Models.swift): `Sources/ACHCore/Models.swift`
- [Reports and Goals](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/ReportingEngine.swift): `Sources/ACHCore/ReportingEngine.swift`
- [Timer Preferences](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/WidgetPreferences.swift): `Sources/ACHCore/WidgetPreferences.swift`

### Local Data

- [SQLite Database](https://github.com/alexprofmutua/ach/blob/main/Sources/ACHCore/SQLiteStore.swift): `Sources/ACHCore/SQLiteStore.swift`

### Windows Edition

- [Electron Main](https://github.com/alexprofmutua/ach/blob/main/Windows/app/main.cjs): `Windows/app/main.cjs`
- [Study Service](https://github.com/alexprofmutua/ach/blob/main/Windows/app/study.cjs): `Windows/app/study.cjs`
- [JSON Store](https://github.com/alexprofmutua/ach/blob/main/Windows/app/store.cjs): `Windows/app/store.cjs`
- [Widget Placement](https://github.com/alexprofmutua/ach/blob/main/Windows/app/widget-geometry.cjs): `Windows/app/widget-geometry.cjs`
- [Main Window UI](https://github.com/alexprofmutua/ach/blob/main/Windows/app/ui.js): `Windows/app/ui.js`
- [Widget UI](https://github.com/alexprofmutua/ach/blob/main/Windows/app/widget.js): `Windows/app/widget.js`
- [UI Visuals](https://github.com/alexprofmutua/ach/blob/main/Windows/app/visuals.js): `Windows/app/visuals.js`

### Other components

- **Student**

## Connections

- Student → Main Navigation: uses (evidence: `README.md`)
- Main Navigation → Dashboard: shows (evidence: `Sources/ACHApp/MainView.swift`)
- Main Navigation → Goals View: shows (evidence: `Sources/ACHApp/MainView.swift`)
- Main Navigation → Session History: shows (evidence: `Sources/ACHApp/MainView.swift`)
- Main Navigation → Semester Selector: shows (evidence: `Sources/ACHApp/MainView.swift`)
- Main Navigation → Settings: shows (evidence: `Sources/ACHApp/MainView.swift`)
- App Lifecycle → Main Navigation: opens (evidence: `Sources/ACHApp/ACHApp.swift`)
- App Lifecycle → Session Service: initializes (evidence: `Sources/ACHApp/ACHApp.swift`)
- Main Navigation → Session Service: controls (evidence: `Sources/ACHApp/MainView.swift`)
- Dashboard → Session Service: reads totals (evidence: `Sources/ACHApp/DashboardView.swift`)
- Dashboard → Reports and Goals: uses (evidence: `Sources/ACHApp/DashboardView.swift`)
- Goals View → Session Service: reads goals (evidence: `Sources/ACHApp/GoalsView.swift`)
- Goals View → Reports and Goals: uses (evidence: `Sources/ACHApp/GoalsView.swift`)
- Session History → Session Service: reads sessions (evidence: `Sources/ACHApp/SessionsView.swift`)
- Semester Selector → Session Service: selects semester (evidence: `Sources/ACHApp/SemesterSidebar.swift`)
- Settings → Session Service: updates settings (evidence: `Sources/ACHApp/SettingsView.swift`)
- Settings → Desktop Timer: configures (evidence: `Sources/ACHApp/SettingsView.swift`)
- Desktop Timer → Session Service: observes (evidence: `Sources/ACHApp/DesktopTimerController.swift`)
- Desktop Timer → Timer Preferences: reads preferences (evidence: `Sources/ACHApp/DesktopTimerController.swift`)
- Session Service → SQLite Database: persists state (evidence: `Sources/ACHCore/TimerService.swift`)
- Session Service → Reports and Goals: evaluates progress (evidence: `Sources/ACHCore/TimerService.swift`)
- Session Service → Study Records: updates records (evidence: `Sources/ACHCore/TimerService.swift`)
- Electron Main → Study Service: dispatches actions (evidence: `Windows/app/main.cjs`)
- Electron Main → JSON Store: uses storage (evidence: `Windows/app/main.cjs`)
- Electron Main → Widget Placement: positions widget (evidence: `Windows/app/main.cjs`)
- Electron Main → Main Window UI: serves window
- Electron Main → Widget UI: serves window
- Main Window UI → UI Visuals: uses visuals
