# kssemy/deskbuddy-pet architecture

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

- Interactive diagram: https://gitdiagram.com/kssemy/deskbuddy-pet
- Repository: https://github.com/kssemy/deskbuddy-pet

## Overview

DeskBuddy is an Electron desktop pet and shared-work companion for Windows and macOS. Users interact with the character to manage tasks, settings, wardrobe, and work-time records; the main process owns window behavior, local persistence, optional Supabase friend sync, and update flows. The graph includes README-documented UI capabilities whose renderer files are present in the tree, but their source was not sampled, so those links are omitted. Edges use only relationships visible in the excerpts or README.

Main entry points: [`main.js`](https://github.com/kssemy/deskbuddy-pet/blob/main/main.js) (Electron main), [`preload.js`](https://github.com/kssemy/deskbuddy-pet/blob/main/preload.js) (IPC bridge), [`pet.html`](https://github.com/kssemy/deskbuddy-pet/blob/main/pet.html) (Pet and task UI), [`panel.html`](https://github.com/kssemy/deskbuddy-pet/blob/main/panel.html) (Settings UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_main["Electron main<br/>[main.js]"]
  node_bridge["IPC bridge<br/>[preload.js]"]
  node_petui["Pet and task UI<br/>[pet.html]"]
  node_settingsui["Settings UI<br/>[panel.html]"]
  node_chatui["Speech UI<br/>[other.html]"]
  node_desktopgeom["Display geometry<br/>[desktop.js]"]
  node_motion["Character motion<br/>[motion.js]"]
end

subgraph group_personal["Personal workspace"]
  node_historyui["History UI<br/>[history.html]"]
  node_wardrobeui["Wardrobe UI<br/>[wardrobe.html]"]
  node_worktime["Work-time status<br/>[worktime.js]"]
  node_history["Monthly history<br/>[history.js]"]
  node_image["Image bounds<br/>[image-bounds.js]"]
end

subgraph group_social["Friend presence"]
  node_meeting["Meet reactions<br/>[meeting.js]"]
  node_friends["Friend sync<br/>[main.js]"]
  node_realtime["Realtime events<br/>[release-events.js]"]
  node_supabase[("Supabase backend")]
end

subgraph group_updates["Update lifecycle"]
  node_updatecheck["Release checking<br/>[main.js]"]
  node_download["Verified download<br/>[update-download.js]"]
  node_github["GitHub releases"]
end

node_user(("User"))

node_user -->|"uses"| node_petui
node_user -->|"configures"| node_settingsui
node_user -->|"reviews"| node_historyui
node_user -->|"manages"| node_wardrobeui
node_petui -.->|"invokes IPC"| node_bridge
node_settingsui -.->|"invokes IPC"| node_bridge
node_historyui -.->|"requests history"| node_bridge
node_wardrobeui -.->|"invokes IPC"| node_bridge
node_bridge -->|"dispatches IPC"| node_main
node_main -->|"computes status"| node_worktime
node_main -->|"computes records"| node_history
node_main -->|"processes images"| node_image
node_main -->|"uses geometry"| node_desktopgeom
node_main -->|"uses motion"| node_motion
node_main -->|"checks proximity"| node_meeting
node_main -->|"manages presence"| node_friends
node_main -->|"registers events"| node_realtime
node_friends -->|"syncs presence"| node_supabase
node_main -->|"checks releases"| node_updatecheck
node_updatecheck -->|"queries latest"| node_github
node_main -->|"downloads asset"| node_download
node_download -->|"fetches release file"| node_github

click node_main "https://github.com/kssemy/deskbuddy-pet/blob/main/main.js"
click node_bridge "https://github.com/kssemy/deskbuddy-pet/blob/main/preload.js"
click node_petui "https://github.com/kssemy/deskbuddy-pet/blob/main/pet.html"
click node_settingsui "https://github.com/kssemy/deskbuddy-pet/blob/main/panel.html"
click node_chatui "https://github.com/kssemy/deskbuddy-pet/blob/main/other.html"
click node_historyui "https://github.com/kssemy/deskbuddy-pet/blob/main/history.html"
click node_wardrobeui "https://github.com/kssemy/deskbuddy-pet/blob/main/wardrobe.html"
click node_worktime "https://github.com/kssemy/deskbuddy-pet/blob/main/worktime.js"
click node_history "https://github.com/kssemy/deskbuddy-pet/blob/main/history.js"
click node_image "https://github.com/kssemy/deskbuddy-pet/blob/main/image-bounds.js"
click node_desktopgeom "https://github.com/kssemy/deskbuddy-pet/blob/main/desktop.js"
click node_motion "https://github.com/kssemy/deskbuddy-pet/blob/main/motion.js"
click node_meeting "https://github.com/kssemy/deskbuddy-pet/blob/main/meeting.js"
click node_friends "https://github.com/kssemy/deskbuddy-pet/blob/main/main.js"
click node_realtime "https://github.com/kssemy/deskbuddy-pet/blob/main/release-events.js"
click node_updatecheck "https://github.com/kssemy/deskbuddy-pet/blob/main/main.js"
click node_download "https://github.com/kssemy/deskbuddy-pet/blob/main/update-download.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_main,node_bridge,node_petui,node_settingsui,node_chatui,node_desktopgeom,node_motion,node_user toneBlue
class node_historyui,node_wardrobeui,node_worktime,node_history,node_image toneAmber
class node_meeting,node_friends,node_realtime,node_supabase toneMint
class node_updatecheck,node_download,node_github toneRose
```

## Components

### Desktop experience

- [Electron main](https://github.com/kssemy/deskbuddy-pet/blob/main/main.js): `main.js`
- [IPC bridge](https://github.com/kssemy/deskbuddy-pet/blob/main/preload.js): `preload.js`
- [Pet and task UI](https://github.com/kssemy/deskbuddy-pet/blob/main/pet.html): `pet.html`
- [Settings UI](https://github.com/kssemy/deskbuddy-pet/blob/main/panel.html): `panel.html`
- [Speech UI](https://github.com/kssemy/deskbuddy-pet/blob/main/other.html): `other.html`
- [Display geometry](https://github.com/kssemy/deskbuddy-pet/blob/main/desktop.js): `desktop.js`
- [Character motion](https://github.com/kssemy/deskbuddy-pet/blob/main/motion.js): `motion.js`

### Personal workspace

- [History UI](https://github.com/kssemy/deskbuddy-pet/blob/main/history.html): `history.html`
- [Wardrobe UI](https://github.com/kssemy/deskbuddy-pet/blob/main/wardrobe.html): `wardrobe.html`
- [Work-time status](https://github.com/kssemy/deskbuddy-pet/blob/main/worktime.js): `worktime.js`
- [Monthly history](https://github.com/kssemy/deskbuddy-pet/blob/main/history.js): `history.js`
- [Image bounds](https://github.com/kssemy/deskbuddy-pet/blob/main/image-bounds.js): `image-bounds.js`

### Friend presence

- [Meet reactions](https://github.com/kssemy/deskbuddy-pet/blob/main/meeting.js): `meeting.js`
- [Friend sync](https://github.com/kssemy/deskbuddy-pet/blob/main/main.js): `main.js`
- [Realtime events](https://github.com/kssemy/deskbuddy-pet/blob/main/release-events.js): `release-events.js`
- **Supabase backend**

### Update lifecycle

- [Release checking](https://github.com/kssemy/deskbuddy-pet/blob/main/main.js): `main.js`
- [Verified download](https://github.com/kssemy/deskbuddy-pet/blob/main/update-download.js): `update-download.js`
- **GitHub releases**

### Other components

- **User**

## Connections

- User → Pet and task UI: uses (evidence: `README.md`)
- User → Settings UI: configures (evidence: `README.md`)
- User → History UI: reviews (evidence: `README.md`)
- User → Wardrobe UI: manages (evidence: `README.md`)
- Pet and task UI → IPC bridge: invokes IPC
- Settings UI → IPC bridge: invokes IPC
- History UI → IPC bridge: requests history
- Wardrobe UI → IPC bridge: invokes IPC
- IPC bridge → Electron main: dispatches IPC (evidence: `preload.js`)
- Electron main → Work-time status: computes status (evidence: `main.js`)
- Electron main → Monthly history: computes records (evidence: `main.js`)
- Electron main → Image bounds: processes images (evidence: `main.js`)
- Electron main → Display geometry: uses geometry (evidence: `main.js`)
- Electron main → Character motion: uses motion (evidence: `main.js`)
- Electron main → Meet reactions: checks proximity (evidence: `main.js`)
- Electron main → Friend sync: manages presence (evidence: `main.js`)
- Electron main → Realtime events: registers events (evidence: `main.js`)
- Friend sync → Supabase backend: syncs presence (evidence: `README.md`)
- Electron main → Release checking: checks releases (evidence: `main.js`)
- Release checking → GitHub releases: queries latest (evidence: `main.js`)
- Electron main → Verified download: downloads asset (evidence: `main.js`)
- Verified download → GitHub releases: fetches release file (evidence: `update-download.js`)
