# aritranexx/airdiary architecture

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

- Interactive diagram: https://gitdiagram.com/aritranexx/airdiary
- Repository: https://github.com/aritranexx/airdiary

## Overview

AirDiary is a local-first Flutter app for pairing offline devices and recording their proximity-based location history. Its main workflow is: register a peer by QR or manual ID, discover its BLE beacon, match it against local registrations, throttle and resolve location, then save and display logs with map deep-links. The README documents these capabilities, but the Dart implementation was not excerpted; relationships among those components are therefore shown as documented rather than source-verified. Native runner code is platform hosting, not product logic.

Main entry points: [`lib/services/scanner_service.dart`](https://github.com/aritranexx/airdiary/blob/main/lib/services/scanner_service.dart) (BLE scanner), [`lib/views/pair_view.dart`](https://github.com/aritranexx/airdiary/blob/main/lib/views/pair_view.dart) (QR and ID pairing), [`lib/views/dashboard_view.dart`](https://github.com/aritranexx/airdiary/blob/main/lib/views/dashboard_view.dart) (Status dashboard), [`lib/services/storage_service.dart`](https://github.com/aritranexx/airdiary/blob/main/lib/services/storage_service.dart) (Hive storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pairing["Peer pairing"]
  node_pair["QR and ID pairing<br/>[pair_view.dart]"]
end

subgraph group_tracking["Beacon tracking"]
  node_broadcaster["BLE broadcaster"]
  node_scanner["BLE scanner"]
  node_gps["Location resolution"]
end

subgraph group_localdata["Local diary"]
  node_devices["Tracked devices"]
  node_logs["Location logs<br/>[location_log.dart]"]
  node_storage[("Hive storage")]
end

subgraph group_dashboard["Diary dashboard"]
  node_dashboard["Status dashboard"]
  node_maps["Native map app"]
end

subgraph group_platform["Platform hosting"]
  node_app["Flutter app bootstrap<br/>[main.dart]"]
  node_ioshost["iOS Flutter host<br/>[AppDelegate.swift]"]
  node_macoshost["macOS Flutter host"]
  node_winhost["Windows Flutter host<br/>[flutter_window.cpp]"]
  node_winwindow["Win32 window<br/>[win32_window.cpp]"]
end

node_owner(("Device owner"))
node_target(("Tracked peer"))

node_owner -->|"pairs peer"| node_pair
node_pair -->|"registers peer"| node_devices
node_target -->|"broadcasts identity"| node_broadcaster
node_broadcaster -->|"advertises beacon"| node_scanner
node_scanner -->|"matches identity"| node_devices
node_scanner -->|"resolves position"| node_gps
node_scanner -->|"records location"| node_logs
node_pair -->|"saves registration"| node_storage
node_scanner -->|"commits logs"| node_storage
node_dashboard -->|"reads diary"| node_storage
node_owner -->|"views status"| node_dashboard
node_dashboard -->|"opens location"| node_maps
node_ioshost -->|"hosts Flutter"| node_app
node_macoshost -->|"hosts Flutter"| node_app
node_winhost -->|"extends window"| node_winwindow
node_winhost -->|"hosts Flutter"| node_app

click node_pair "https://github.com/aritranexx/airdiary/blob/main/lib/views/pair_view.dart"
click node_devices "https://github.com/aritranexx/airdiary/blob/main/lib/models/tracked_device.dart"
click node_broadcaster "https://github.com/aritranexx/airdiary/blob/main/lib/services/broadcaster_service.dart"
click node_scanner "https://github.com/aritranexx/airdiary/blob/main/lib/services/scanner_service.dart"
click node_gps "https://github.com/aritranexx/airdiary/blob/main/lib/services/scanner_service.dart"
click node_logs "https://github.com/aritranexx/airdiary/blob/main/lib/models/location_log.dart"
click node_storage "https://github.com/aritranexx/airdiary/blob/main/lib/services/storage_service.dart"
click node_dashboard "https://github.com/aritranexx/airdiary/blob/main/lib/views/dashboard_view.dart"
click node_app "https://github.com/aritranexx/airdiary/blob/main/lib/main.dart"
click node_ioshost "https://github.com/aritranexx/airdiary/blob/main/ios/Runner/AppDelegate.swift"
click node_macoshost "https://github.com/aritranexx/airdiary/blob/main/macos/Runner/MainFlutterWindow.swift"
click node_winhost "https://github.com/aritranexx/airdiary/blob/main/windows/runner/flutter_window.cpp"
click node_winwindow "https://github.com/aritranexx/airdiary/blob/main/windows/runner/win32_window.cpp"

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_pair toneBlue
class node_broadcaster,node_scanner,node_gps toneAmber
class node_devices,node_logs,node_storage toneMint
class node_dashboard,node_maps toneRose
class node_app,node_ioshost,node_macoshost,node_winhost,node_winwindow,node_owner,node_target toneIndigo
```

## Components

### Peer pairing

- [QR and ID pairing](https://github.com/aritranexx/airdiary/blob/main/lib/views/pair_view.dart): `lib/views/pair_view.dart`

### Beacon tracking

- [BLE broadcaster](https://github.com/aritranexx/airdiary/blob/main/lib/services/broadcaster_service.dart): `lib/services/broadcaster_service.dart`
- [BLE scanner](https://github.com/aritranexx/airdiary/blob/main/lib/services/scanner_service.dart): `lib/services/scanner_service.dart`
- [Location resolution](https://github.com/aritranexx/airdiary/blob/main/lib/services/scanner_service.dart): `lib/services/scanner_service.dart`

### Local diary

- [Tracked devices](https://github.com/aritranexx/airdiary/blob/main/lib/models/tracked_device.dart): `lib/models/tracked_device.dart`
- [Location logs](https://github.com/aritranexx/airdiary/blob/main/lib/models/location_log.dart): `lib/models/location_log.dart`
- [Hive storage](https://github.com/aritranexx/airdiary/blob/main/lib/services/storage_service.dart): `lib/services/storage_service.dart`

### Diary dashboard

- [Status dashboard](https://github.com/aritranexx/airdiary/blob/main/lib/views/dashboard_view.dart): `lib/views/dashboard_view.dart`
- **Native map app**

### Platform hosting

- [Flutter app bootstrap](https://github.com/aritranexx/airdiary/blob/main/lib/main.dart): `lib/main.dart`
- [iOS Flutter host](https://github.com/aritranexx/airdiary/blob/main/ios/Runner/AppDelegate.swift): `ios/Runner/AppDelegate.swift`
- [macOS Flutter host](https://github.com/aritranexx/airdiary/blob/main/macos/Runner/MainFlutterWindow.swift): `macos/Runner/MainFlutterWindow.swift`
- [Windows Flutter host](https://github.com/aritranexx/airdiary/blob/main/windows/runner/flutter_window.cpp): `windows/runner/flutter_window.cpp`
- [Win32 window](https://github.com/aritranexx/airdiary/blob/main/windows/runner/win32_window.cpp): `windows/runner/win32_window.cpp`

### Other components

- **Device owner**
- **Tracked peer**

## Connections

- Device owner → QR and ID pairing: pairs peer (evidence: `README.md`)
- QR and ID pairing → Tracked devices: registers peer (evidence: `README.md`)
- Tracked peer → BLE broadcaster: broadcasts identity (evidence: `README.md`)
- BLE broadcaster → BLE scanner: advertises beacon (evidence: `README.md`)
- BLE scanner → Tracked devices: matches identity (evidence: `README.md`)
- BLE scanner → Location resolution: resolves position (evidence: `README.md`)
- BLE scanner → Location logs: records location (evidence: `README.md`)
- QR and ID pairing → Hive storage: saves registration (evidence: `README.md`)
- BLE scanner → Hive storage: commits logs (evidence: `README.md`)
- Status dashboard → Hive storage: reads diary (evidence: `README.md`)
- Device owner → Status dashboard: views status (evidence: `README.md`)
- Status dashboard → Native map app: opens location (evidence: `README.md`)
- iOS Flutter host → Flutter app bootstrap: hosts Flutter (evidence: `ios/Runner/AppDelegate.swift`)
- macOS Flutter host → Flutter app bootstrap: hosts Flutter (evidence: `macos/Runner/MainFlutterWindow.swift`)
- Windows Flutter host → Win32 window: extends window (evidence: `windows/runner/flutter_window.cpp`)
- Windows Flutter host → Flutter app bootstrap: hosts Flutter (evidence: `windows/runner/flutter_window.cpp`)
