# dopalab/cuelark-desktop architecture

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

- Interactive diagram: https://gitdiagram.com/dopalab/cuelark-desktop
- Repository: https://github.com/dopalab/cuelark-desktop

## Overview

CueLark is a local-first Windows flashcard reminder app. Users create or import decks in Card Studio; the desktop host runs a floating reminder that presents cards, records reviews, and schedules the next appearance. The graph separates the native host, studio and deck workflows, and reminder runtime. README-described capabilities such as card types, themes, and scheduling are retained; unsampled wiring is omitted where its caller is not evidenced.

Main entry points: [`App.xaml.cs`](https://github.com/dopalab/cuelark-desktop/blob/main/App.xaml.cs) (Desktop app), [`web/content/content.js`](https://github.com/dopalab/cuelark-desktop/blob/main/web/content/content.js) (Card review), [`OverlayWindow.xaml.cs`](https://github.com/dopalab/cuelark-desktop/blob/main/OverlayWindow.xaml.cs) (Overlay window), [`web/studio.js`](https://github.com/dopalab/cuelark-desktop/blob/main/web/studio.js) (Deck editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Windows host"]
  node_app["Desktop app<br/>[App.xaml.cs]"]
  node_preferences["Desktop preferences"]
  node_studio_window["Studio window<br/>[MainWindow.xaml.cs]"]
  node_overlay_window["Overlay window"]
end

subgraph group_studio["Card Studio"]
  node_studio_ui["Deck editor<br/>[studio.js]"]
  node_import_tools["Import and prompts<br/>[data.js]"]
  node_appearance_schedule["Appearance and schedule<br/>[studio.js]"]
  node_desktop_controls["Desktop controls<br/>[studio.js]"]
end

subgraph group_reminders["Reminder runtime"]
  node_card_runtime["Card review<br/>[content.js]"]
  node_review_schedule["Review scheduling<br/>[content.js]"]
  node_overlay_bridge["Overlay bridge<br/>[desktop-overlay.js]"]
end

subgraph group_state["Local state"]
  node_platform["Desktop platform adapter<br/>[platform.js]"]
  node_data_model["Deck and state model<br/>[data.js]"]
  node_browser_state[("WebView local state<br/>[platform.js]")]
end

node_learner(("Learner"))

node_learner -->|"launches"| node_app
node_app -->|"loads preferences"| node_preferences
node_app -->|"creates window"| node_studio_window
node_app -->|"creates window"| node_overlay_window
node_learner -->|"edits decks"| node_studio_ui
node_studio_ui -->|"initializes state"| node_data_model
node_studio_ui -->|"saves decks"| node_browser_state
node_learner -->|"imports cards"| node_import_tools
node_learner -->|"customizes reminders"| node_appearance_schedule
node_learner -->|"sets Windows options"| node_desktop_controls
node_desktop_controls -->|"sends desktop commands"| node_app
node_app -->|"dispatches card request"| node_overlay_window
node_overlay_window -->|"loads overlay page"| node_overlay_bridge
node_overlay_bridge -->|"tracks visibility and gestures"| node_card_runtime
node_card_runtime -->|"loads review state"| node_data_model
node_card_runtime -->|"reads and updates state"| node_browser_state
node_card_runtime -->|"records review"| node_review_schedule
node_platform -->|"stores local data"| node_browser_state
node_studio_window -->|"hosts Studio"| node_studio_ui
node_overlay_window -->|"hosts desktop adapter"| node_platform
node_app -->|"saves options"| node_preferences

click node_app "https://github.com/dopalab/cuelark-desktop/blob/main/App.xaml.cs"
click node_preferences "https://github.com/dopalab/cuelark-desktop/blob/main/DesktopPreferences.cs"
click node_studio_window "https://github.com/dopalab/cuelark-desktop/blob/main/MainWindow.xaml.cs"
click node_overlay_window "https://github.com/dopalab/cuelark-desktop/blob/main/OverlayWindow.xaml.cs"
click node_studio_ui "https://github.com/dopalab/cuelark-desktop/blob/main/web/studio.js"
click node_import_tools "https://github.com/dopalab/cuelark-desktop/blob/main/web/shared/data.js"
click node_appearance_schedule "https://github.com/dopalab/cuelark-desktop/blob/main/web/studio.js"
click node_desktop_controls "https://github.com/dopalab/cuelark-desktop/blob/main/web/studio.js"
click node_card_runtime "https://github.com/dopalab/cuelark-desktop/blob/main/web/content/content.js"
click node_review_schedule "https://github.com/dopalab/cuelark-desktop/blob/main/web/content/content.js"
click node_overlay_bridge "https://github.com/dopalab/cuelark-desktop/blob/main/web/desktop-overlay.js"
click node_platform "https://github.com/dopalab/cuelark-desktop/blob/main/web/platform.js"
click node_data_model "https://github.com/dopalab/cuelark-desktop/blob/main/web/shared/data.js"
click node_browser_state "https://github.com/dopalab/cuelark-desktop/blob/main/web/platform.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_preferences,node_studio_window,node_overlay_window toneBlue
class node_studio_ui,node_import_tools,node_appearance_schedule,node_desktop_controls toneAmber
class node_card_runtime,node_review_schedule,node_overlay_bridge toneMint
class node_platform,node_data_model,node_browser_state toneRose
class node_learner toneIndigo
```

## Components

### Windows host

- [Desktop app](https://github.com/dopalab/cuelark-desktop/blob/main/App.xaml.cs): `App.xaml.cs`
- [Desktop preferences](https://github.com/dopalab/cuelark-desktop/blob/main/DesktopPreferences.cs): `DesktopPreferences.cs`
- [Studio window](https://github.com/dopalab/cuelark-desktop/blob/main/MainWindow.xaml.cs): `MainWindow.xaml.cs`
- [Overlay window](https://github.com/dopalab/cuelark-desktop/blob/main/OverlayWindow.xaml.cs): `OverlayWindow.xaml.cs`

### Card Studio

- [Deck editor](https://github.com/dopalab/cuelark-desktop/blob/main/web/studio.js): `web/studio.js`
- [Import and prompts](https://github.com/dopalab/cuelark-desktop/blob/main/web/shared/data.js): `web/shared/data.js`
- [Appearance and schedule](https://github.com/dopalab/cuelark-desktop/blob/main/web/studio.js): `web/studio.js`
- [Desktop controls](https://github.com/dopalab/cuelark-desktop/blob/main/web/studio.js): `web/studio.js`

### Reminder runtime

- [Card review](https://github.com/dopalab/cuelark-desktop/blob/main/web/content/content.js): `web/content/content.js`
- [Review scheduling](https://github.com/dopalab/cuelark-desktop/blob/main/web/content/content.js): `web/content/content.js`
- [Overlay bridge](https://github.com/dopalab/cuelark-desktop/blob/main/web/desktop-overlay.js): `web/desktop-overlay.js`

### Local state

- [Desktop platform adapter](https://github.com/dopalab/cuelark-desktop/blob/main/web/platform.js): `web/platform.js`
- [Deck and state model](https://github.com/dopalab/cuelark-desktop/blob/main/web/shared/data.js): `web/shared/data.js`
- [WebView local state](https://github.com/dopalab/cuelark-desktop/blob/main/web/platform.js): `web/platform.js`

### Other components

- **Learner**

## Connections

- Learner → Desktop app: launches (evidence: `README.md`)
- Desktop app → Desktop preferences: loads preferences (evidence: `App.xaml.cs`)
- Desktop app → Studio window: creates window (evidence: `App.xaml.cs`)
- Desktop app → Overlay window: creates window (evidence: `App.xaml.cs`)
- Learner → Deck editor: edits decks (evidence: `README.md`)
- Deck editor → Deck and state model: initializes state (evidence: `web/studio.js`)
- Deck editor → WebView local state: saves decks (evidence: `web/studio.js`)
- Learner → Import and prompts: imports cards (evidence: `README.md`)
- Learner → Appearance and schedule: customizes reminders (evidence: `README.md`)
- Learner → Desktop controls: sets Windows options (evidence: `web/studio.js`)
- Desktop controls → Desktop app: sends desktop commands
- Desktop app → Overlay window: dispatches card request (evidence: `App.xaml.cs`)
- Overlay window → Overlay bridge: loads overlay page (evidence: `OverlayWindow.xaml.cs`)
- Overlay bridge → Card review: tracks visibility and gestures (evidence: `web/desktop-overlay.js`)
- Card review → Deck and state model: loads review state (evidence: `web/content/content.js`)
- Card review → WebView local state: reads and updates state (evidence: `web/content/content.js`)
- Card review → Review scheduling: records review (evidence: `web/content/content.js`)
- Desktop platform adapter → WebView local state: stores local data (evidence: `web/platform.js`)
- Studio window → Deck editor: hosts Studio (evidence: `MainWindow.xaml.cs`)
- Overlay window → Desktop platform adapter: hosts desktop adapter (evidence: `OverlayWindow.xaml.cs`)
- Desktop app → Desktop preferences: saves options (evidence: `App.xaml.cs`)
