# arturafriansyah/cheatsheet architecture

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

- Interactive diagram: https://gitdiagram.com/arturafriansyah/cheatsheet
- Repository: https://github.com/arturafriansyah/cheatsheet

## Overview

This is a macOS SwiftUI cheatsheet app: users search and browse saved command notes, select a command, optionally fill placeholders, then copy the result. The single 112 KB source file combines UI, app state, persistence, highlighting, and system integrations; the excerpts show storage writes, note actions, placeholder UI, keyboard monitoring, and login-item registration, but not enough surrounding code to establish all call paths. The map keeps these responsibilities distinct without assuming unsupported connections.

Main entry points: [`main.swift`](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift) (Note actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Cheatsheet interaction"]
  node_app["SwiftUI app<br/>[main.swift]"]
  node_browse["Search and browse<br/>[main.swift]"]
  node_note_actions["Note actions<br/>[main.swift]"]
  node_editor["Note editor<br/>[main.swift]"]
  node_settings["Settings<br/>[main.swift]"]
end

subgraph group_content["Content and presentation"]
  node_store[("Cheatsheet store<br/>[main.swift]")]
  node_defaults["Sample cheatsheets<br/>[main.swift]"]
  node_placeholders["Placeholder completion<br/>[main.swift]"]
  node_highlight["Code highlighting<br/>[main.swift]"]
  node_localization["Localization<br/>[main.swift]"]
end

subgraph group_platform["macOS services"]
  node_clipboard["System clipboard"]
  node_hotkey["Keyboard monitor<br/>[main.swift]"]
  node_login["Login item service"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -.->|"presents"| node_browse
node_browse -.->|"selects notes"| node_note_actions
node_note_actions -.->|"updates notes"| node_store
node_editor -.->|"edits notes"| node_store
node_defaults -.->|"seeds content"| node_store
node_note_actions -.->|"fills values"| node_placeholders
node_note_actions -.->|"formats code"| node_highlight
node_note_actions -.->|"copies command"| node_clipboard
node_app -->|"monitors keys"| node_hotkey
node_settings -->|"registers app"| node_login
node_app -.->|"uses labels"| node_localization

click node_app "https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift"
click node_browse "https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift"
click node_note_actions "https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift"
click node_editor "https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift"
click node_settings "https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift"
click node_store "https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift"
click node_defaults "https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift"
click node_placeholders "https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift"
click node_highlight "https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift"
click node_localization "https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift"
click node_hotkey "https://github.com/arturafriansyah/cheatsheet/blob/main/main.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_app,node_browse,node_note_actions,node_editor,node_settings,node_user toneBlue
class node_store,node_defaults,node_placeholders,node_highlight,node_localization toneAmber
class node_clipboard,node_hotkey,node_login toneMint
```

## Components

### Cheatsheet interaction

- [SwiftUI app](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`
- [Search and browse](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`
- [Note actions](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`
- [Note editor](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`
- [Settings](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`

### Content and presentation

- [Cheatsheet store](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`
- [Sample cheatsheets](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`
- [Placeholder completion](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`
- [Code highlighting](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`
- [Localization](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`

### macOS services

- **System clipboard**
- [Keyboard monitor](https://github.com/arturafriansyah/cheatsheet/blob/main/main.swift): `main.swift`
- **Login item service**

### Other components

- **User**

## Connections

- User → SwiftUI app: uses
- SwiftUI app → Search and browse: presents (evidence: `main.swift`)
- Search and browse → Note actions: selects notes (evidence: `main.swift`)
- Note actions → Cheatsheet store: updates notes (evidence: `main.swift`)
- Note editor → Cheatsheet store: edits notes (evidence: `main.swift`)
- Sample cheatsheets → Cheatsheet store: seeds content (evidence: `main.swift`)
- Note actions → Placeholder completion: fills values (evidence: `main.swift`)
- Note actions → Code highlighting: formats code (evidence: `main.swift`)
- Note actions → System clipboard: copies command
- SwiftUI app → Keyboard monitor: monitors keys (evidence: `main.swift`)
- Settings → Login item service: registers app (evidence: `main.swift`)
- SwiftUI app → Localization: uses labels (evidence: `main.swift`)
