# tddworks/claudebar architecture

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

- Interactive diagram: https://gitdiagram.com/tddworks/claudebar
- Repository: https://github.com/tddworks/claudebar

## Overview

ClaudeBar is a macOS menu-bar dashboard for AI coding quotas. Users enable providers; provider definitions collect usage, which the app presents with reset countdowns and alerts. The repository also supports daily usage, multi-account logins, extensions, themes, notch and Touch Bar displays, session hooks, and Notify! device publishing. The graph uses documented capabilities and indexed source references; several UI-to-domain runtime calls are not shown in the excerpts, so those links are marked unverified rather than asserted as inspected.

Main entry points: [`Sources/Domain/Monitor/QuotaMonitor.swift`](https://github.com/tddworks/claudebar/blob/main/Sources/Domain/Monitor/QuotaMonitor.swift) (Quota monitor), [`Sources/App/Views/SettingsWindow/SettingsWindowView.swift`](https://github.com/tddworks/claudebar/blob/main/Sources/App/Views/SettingsWindow/SettingsWindowView.swift) (Settings UI), [`Modules/Providers/Sources/Provider.swift`](https://github.com/tddworks/claudebar/blob/main/Modules/Providers/Sources/Provider.swift) (Provider runtime), [`Sources/App/Views/MenuContentView.swift`](https://github.com/tddworks/claudebar/blob/main/Sources/App/Views/MenuContentView.swift) (Menu-bar UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_menu["Menu-bar UI"]
  node_settingsui["Settings UI"]
  node_notch["Notch display"]
  node_touchbar["Touch Bar"]
  node_themes["Theme system"]
end

subgraph group_provider["Provider collection"]
  node_providerui["Provider lineup<br/>[Providers.swift]"]
  node_providermodel["Provider runtime<br/>[Provider.swift]"]
  node_accounts["Provider accounts"]
  node_probes["Provider probes"]
  node_datasource["Data-source factory<br/>[DataSources.swift]"]
  node_fetch["Fetch and map"]
  node_ai_services["AI provider services"]
end

subgraph group_domain["Usage and monitoring"]
  node_quota["Quota model<br/>[UsageQuota.swift]"]
  node_monitor["Quota monitor<br/>[QuotaMonitor.swift]"]
  node_daily["Daily usage"]
end

subgraph group_integrations["Optional integrations"]
  node_extensions["Extensions"]
  node_hooks["Session hooks"]
  node_notify["Notify publishing"]
  node_gateway["Notify! service"]
end

subgraph group_infra["Persistence and transport"]
  node_settings[("Settings storage")]
end

node_user(("Mac user"))

node_user -->|"views quotas"| node_menu
node_user -->|"configures providers"| node_settingsui
node_menu -.->|"reads quotas"| node_monitor
node_monitor -.->|"refreshes providers"| node_providerui
node_providerui -->|"creates providers"| node_providermodel
node_providermodel -->|"creates data sources"| node_datasource
node_datasource -->|"selects fetchers"| node_fetch
node_probes -.->|"queries usage"| node_ai_services
node_providermodel -.->|"collects provider data"| node_probes
node_providermodel -->|"supports logins"| node_accounts
node_accounts -.->|"persists account settings"| node_settings
node_fetch -.->|"maps usage"| node_quota
node_monitor -.->|"evaluates status"| node_quota
node_settingsui -.->|"reads and writes"| node_settings
node_settings -.->|"provides preferences"| node_settingsui
node_menu -.->|"uses appearance"| node_themes
node_monitor -.->|"shows activity"| node_notch
node_monitor -.->|"shows gauges"| node_touchbar
node_monitor -.->|"presents daily usage"| node_daily
node_settingsui -.->|"configures extensions"| node_extensions
node_settingsui -.->|"configures hooks"| node_hooks
node_monitor -.->|"publishes quota state"| node_notify
node_notify -->|"sends updates"| node_gateway

click node_menu "https://github.com/tddworks/claudebar/blob/main/Sources/App/Views/MenuContentView.swift"
click node_settingsui "https://github.com/tddworks/claudebar/blob/main/Sources/App/Views/SettingsWindow/SettingsWindowView.swift"
click node_notch "https://github.com/tddworks/claudebar/blob/main/Sources/App/Notch/NotchWindowController.swift"
click node_touchbar "https://github.com/tddworks/claudebar/blob/main/Sources/App/Views/TouchBar/TouchBarQuotaView.swift"
click node_themes "https://github.com/tddworks/claudebar/blob/main/Sources/App/Theme/ThemeRegistry.swift"
click node_providerui "https://github.com/tddworks/claudebar/blob/main/Modules/Providers/Sources/Providers.swift"
click node_providermodel "https://github.com/tddworks/claudebar/blob/main/Modules/Providers/Sources/Provider.swift"
click node_accounts "https://github.com/tddworks/claudebar/blob/main/Modules/Providers/Sources/ProviderAccount.swift"
click node_probes "https://github.com/tddworks/claudebar/tree/main/Sources/Infrastructure"
click node_datasource "https://github.com/tddworks/claudebar/blob/main/Modules/DataSources/Sources/DataSources.swift"
click node_fetch "https://github.com/tddworks/claudebar/tree/main/Modules/DataSources/Sources/Internal"
click node_quota "https://github.com/tddworks/claudebar/blob/main/Modules/Quotas/Sources/UsageQuota.swift"
click node_monitor "https://github.com/tddworks/claudebar/blob/main/Sources/Domain/Monitor/QuotaMonitor.swift"
click node_daily "https://github.com/tddworks/claudebar/blob/main/Sources/Infrastructure/Claude/ClaudeDailyUsageAnalyzer.swift"
click node_extensions "https://github.com/tddworks/claudebar/tree/main/Sources/Infrastructure/Extension"
click node_hooks "https://github.com/tddworks/claudebar/blob/main/Sources/Infrastructure/Hooks/HookHTTPServer.swift"
click node_notify "https://github.com/tddworks/claudebar/blob/main/Sources/Infrastructure/Notify/NotifyGatewayClient.swift"
click node_settings "https://github.com/tddworks/claudebar/blob/main/Sources/Infrastructure/Storage/JSONSettingsRepository.swift"

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_menu,node_settingsui,node_notch,node_touchbar,node_themes,node_user toneBlue
class node_providerui,node_providermodel,node_accounts,node_probes,node_datasource,node_fetch,node_ai_services toneAmber
class node_quota,node_monitor,node_daily toneMint
class node_extensions,node_hooks,node_notify,node_gateway toneRose
class node_settings toneIndigo
```

## Components

### App experience

- [Menu-bar UI](https://github.com/tddworks/claudebar/blob/main/Sources/App/Views/MenuContentView.swift): `Sources/App/Views/MenuContentView.swift`
- [Settings UI](https://github.com/tddworks/claudebar/blob/main/Sources/App/Views/SettingsWindow/SettingsWindowView.swift): `Sources/App/Views/SettingsWindow/SettingsWindowView.swift`
- [Notch display](https://github.com/tddworks/claudebar/blob/main/Sources/App/Notch/NotchWindowController.swift): `Sources/App/Notch/NotchWindowController.swift`
- [Touch Bar](https://github.com/tddworks/claudebar/blob/main/Sources/App/Views/TouchBar/TouchBarQuotaView.swift): `Sources/App/Views/TouchBar/TouchBarQuotaView.swift`
- [Theme system](https://github.com/tddworks/claudebar/blob/main/Sources/App/Theme/ThemeRegistry.swift): `Sources/App/Theme/ThemeRegistry.swift`

### Provider collection

- [Provider lineup](https://github.com/tddworks/claudebar/blob/main/Modules/Providers/Sources/Providers.swift): `Modules/Providers/Sources/Providers.swift`
- [Provider runtime](https://github.com/tddworks/claudebar/blob/main/Modules/Providers/Sources/Provider.swift): `Modules/Providers/Sources/Provider.swift`
- [Provider accounts](https://github.com/tddworks/claudebar/blob/main/Modules/Providers/Sources/ProviderAccount.swift): `Modules/Providers/Sources/ProviderAccount.swift`
- [Provider probes](https://github.com/tddworks/claudebar/tree/main/Sources/Infrastructure): `Sources/Infrastructure`
- [Data-source factory](https://github.com/tddworks/claudebar/blob/main/Modules/DataSources/Sources/DataSources.swift): `Modules/DataSources/Sources/DataSources.swift`
- [Fetch and map](https://github.com/tddworks/claudebar/tree/main/Modules/DataSources/Sources/Internal): `Modules/DataSources/Sources/Internal`
- **AI provider services**

### Usage and monitoring

- [Quota model](https://github.com/tddworks/claudebar/blob/main/Modules/Quotas/Sources/UsageQuota.swift): `Modules/Quotas/Sources/UsageQuota.swift`
- [Quota monitor](https://github.com/tddworks/claudebar/blob/main/Sources/Domain/Monitor/QuotaMonitor.swift): `Sources/Domain/Monitor/QuotaMonitor.swift`
- [Daily usage](https://github.com/tddworks/claudebar/blob/main/Sources/Infrastructure/Claude/ClaudeDailyUsageAnalyzer.swift): `Sources/Infrastructure/Claude/ClaudeDailyUsageAnalyzer.swift`

### Optional integrations

- [Extensions](https://github.com/tddworks/claudebar/tree/main/Sources/Infrastructure/Extension): `Sources/Infrastructure/Extension`
- [Session hooks](https://github.com/tddworks/claudebar/blob/main/Sources/Infrastructure/Hooks/HookHTTPServer.swift): `Sources/Infrastructure/Hooks/HookHTTPServer.swift`
- [Notify publishing](https://github.com/tddworks/claudebar/blob/main/Sources/Infrastructure/Notify/NotifyGatewayClient.swift): `Sources/Infrastructure/Notify/NotifyGatewayClient.swift`
- **Notify! service**

### Persistence and transport

- [Settings storage](https://github.com/tddworks/claudebar/blob/main/Sources/Infrastructure/Storage/JSONSettingsRepository.swift): `Sources/Infrastructure/Storage/JSONSettingsRepository.swift`

### Other components

- **Mac user**

## Connections

- Mac user → Menu-bar UI: views quotas (evidence: `README.md`)
- Mac user → Settings UI: configures providers (evidence: `README.md`)
- Menu-bar UI → Quota monitor: reads quotas
- Quota monitor → Provider lineup: refreshes providers
- Provider lineup → Provider runtime: creates providers (evidence: `Modules/Providers/Sources/Providers.swift`)
- Provider runtime → Data-source factory: creates data sources (evidence: `Modules/Providers/Sources/Providers.swift`)
- Data-source factory → Fetch and map: selects fetchers (evidence: `Modules/DataSources/Sources/DataSources.swift`)
- Provider probes → AI provider services: queries usage
- Provider runtime → Provider probes: collects provider data
- Provider runtime → Provider accounts: supports logins (evidence: `Modules/Providers/Sources/Provider.swift`)
- Provider accounts → Settings storage: persists account settings
- Fetch and map → Quota model: maps usage
- Quota monitor → Quota model: evaluates status
- Settings UI → Settings storage: reads and writes
- Settings storage → Settings UI: provides preferences
- Menu-bar UI → Theme system: uses appearance
- Quota monitor → Notch display: shows activity
- Quota monitor → Touch Bar: shows gauges
- Quota monitor → Daily usage: presents daily usage
- Settings UI → Extensions: configures extensions
- Settings UI → Session hooks: configures hooks
- Quota monitor → Notify publishing: publishes quota state
- Notify publishing → Notify! service: sends updates (evidence: `Sources/Infrastructure/Notify/NotifyGatewayClient.swift`)
