# otabek-dev365/ascy architecture

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

- Interactive diagram: https://gitdiagram.com/otabek-dev365/ascy
- Repository: https://github.com/otabek-dev365/ascy

## Overview

Ascy is a Linux terminal emulator with a Tauri/Rust backend and a TypeScript webview. The main workflow is user input through tabs and panes into xterm.js and a PTY shell, with shell output returned to the terminal; settings and session restoration support that workflow. A separate arcade workflow loads games into a sandboxed worker, renders their text-grid frames, and routes validated sound requests to native audio. The graph includes documented features whose implementation was not sampled; those links rely on README evidence rather than inspection of unsampled code.

Main entry points: [`src/arcade/arcade.ts`](https://github.com/otabek-dev365/ascy/blob/main/src/arcade/arcade.ts) (Arcade Host), [`src/main.ts`](https://github.com/otabek-dev365/ascy/blob/main/src/main.ts) (Terminal UI), [`src/settings.ts`](https://github.com/otabek-dev365/ascy/blob/main/src/settings.ts) (Settings I/O), [`src/arcade/worker.ts`](https://github.com/otabek-dev365/ascy/blob/main/src/arcade/worker.ts) (Sandbox Worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_terminal["Terminal Workflow"]
  node_frontend["Terminal UI<br/>[main.ts]"]
  node_terminalview["xterm Pane<br/>[main.ts]"]
end

subgraph group_preferences["Appearance and Preferences"]
  node_settings["Settings I/O<br/>[settings.ts]"]
  node_themes["Theme Registry<br/>[theme.ts]"]
  node_keymap["Key Bindings<br/>[keys.ts]"]
  node_matrix["Matrix Rain<br/>[matrix.ts]"]
end

subgraph group_arcade["Arcade Runtime"]
  node_arcadehost["Arcade Host<br/>[arcade.ts]"]
  node_hub["Game Hub<br/>[hub.js]"]
  node_worker["Sandbox Worker<br/>[worker.ts]"]
  node_snake["Built-in Snake<br/>[main.js]"]
  node_renderer["Grid Renderer<br/>[render.ts]"]
  node_soundcheck["Sound Validation<br/>[sound.ts]"]
  node_arcadeaudio["Arcade Audio Bridge<br/>[audio.ts]"]
end

subgraph group_native["Tauri Services"]
  node_pty["PTY Sessions<br/>[lib.rs]"]
  node_session["Session Restore<br/>[lib.rs]"]
  node_gamefiles["Game Files<br/>[lib.rs]"]
  node_nativeaudio["Native Audio<br/>[audio.rs]"]
end

node_user(("User"))
node_shell["Shell Process"]

node_user -->|"uses"| node_frontend
node_frontend -->|"manages panes"| node_terminalview
node_terminalview -->|"starts shell"| node_pty
node_pty -->|"spawns"| node_shell
node_shell -->|"streams output"| node_terminalview
node_frontend -->|"restores sessions"| node_session
node_frontend -->|"loads and saves"| node_settings
node_settings -->|"resolves themes"| node_themes
node_frontend -->|"builds keymap"| node_keymap
node_frontend -->|"controls rain"| node_matrix
node_user -->|"opens arcade"| node_arcadehost
node_arcadehost -->|"loads hub"| node_hub
node_arcadehost -->|"runs game code"| node_worker
node_arcadehost -->|"loads built-in"| node_snake
node_arcadehost -->|"lists and reads"| node_gamefiles
node_worker -->|"sends frames"| node_renderer
node_arcadehost -->|"draws frames"| node_renderer
node_arcadehost -->|"validates sounds"| node_soundcheck
node_arcadehost -->|"plays requests"| node_arcadeaudio
node_arcadeaudio -->|"sends audio ops"| node_nativeaudio

click node_frontend "https://github.com/otabek-dev365/ascy/blob/main/src/main.ts"
click node_terminalview "https://github.com/otabek-dev365/ascy/blob/main/src/main.ts"
click node_pty "https://github.com/otabek-dev365/ascy/blob/main/src-tauri/src/lib.rs"
click node_session "https://github.com/otabek-dev365/ascy/blob/main/src-tauri/src/lib.rs"
click node_settings "https://github.com/otabek-dev365/ascy/blob/main/src/settings.ts"
click node_themes "https://github.com/otabek-dev365/ascy/blob/main/src/theme.ts"
click node_keymap "https://github.com/otabek-dev365/ascy/blob/main/src/keys.ts"
click node_matrix "https://github.com/otabek-dev365/ascy/blob/main/src/matrix.ts"
click node_arcadehost "https://github.com/otabek-dev365/ascy/blob/main/src/arcade/arcade.ts"
click node_hub "https://github.com/otabek-dev365/ascy/blob/main/src/arcade/hub.js"
click node_worker "https://github.com/otabek-dev365/ascy/blob/main/src/arcade/worker.ts"
click node_snake "https://github.com/otabek-dev365/ascy/blob/main/src/arcade/games/snake/main.js"
click node_renderer "https://github.com/otabek-dev365/ascy/blob/main/src/arcade/render.ts"
click node_gamefiles "https://github.com/otabek-dev365/ascy/blob/main/src-tauri/src/lib.rs"
click node_soundcheck "https://github.com/otabek-dev365/ascy/blob/main/src/arcade/sound.ts"
click node_arcadeaudio "https://github.com/otabek-dev365/ascy/blob/main/src/arcade/audio.ts"
click node_nativeaudio "https://github.com/otabek-dev365/ascy/blob/main/src-tauri/src/audio.rs"

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_frontend,node_terminalview,node_user toneBlue
class node_settings,node_themes,node_keymap,node_matrix toneAmber
class node_arcadehost,node_hub,node_worker,node_snake,node_renderer,node_soundcheck,node_arcadeaudio toneMint
class node_pty,node_session,node_gamefiles,node_nativeaudio toneRose
class node_shell toneIndigo
```

## Components

### Terminal Workflow

- [Terminal UI](https://github.com/otabek-dev365/ascy/blob/main/src/main.ts): `src/main.ts`
- [xterm Pane](https://github.com/otabek-dev365/ascy/blob/main/src/main.ts): `src/main.ts`

### Appearance and Preferences

- [Settings I/O](https://github.com/otabek-dev365/ascy/blob/main/src/settings.ts): `src/settings.ts`
- [Theme Registry](https://github.com/otabek-dev365/ascy/blob/main/src/theme.ts): `src/theme.ts`
- [Key Bindings](https://github.com/otabek-dev365/ascy/blob/main/src/keys.ts): `src/keys.ts`
- [Matrix Rain](https://github.com/otabek-dev365/ascy/blob/main/src/matrix.ts): `src/matrix.ts`

### Arcade Runtime

- [Arcade Host](https://github.com/otabek-dev365/ascy/blob/main/src/arcade/arcade.ts): `src/arcade/arcade.ts`
- [Game Hub](https://github.com/otabek-dev365/ascy/blob/main/src/arcade/hub.js): `src/arcade/hub.js`
- [Sandbox Worker](https://github.com/otabek-dev365/ascy/blob/main/src/arcade/worker.ts): `src/arcade/worker.ts`
- [Built-in Snake](https://github.com/otabek-dev365/ascy/blob/main/src/arcade/games/snake/main.js): `src/arcade/games/snake/main.js`
- [Grid Renderer](https://github.com/otabek-dev365/ascy/blob/main/src/arcade/render.ts): `src/arcade/render.ts`
- [Sound Validation](https://github.com/otabek-dev365/ascy/blob/main/src/arcade/sound.ts): `src/arcade/sound.ts`
- [Arcade Audio Bridge](https://github.com/otabek-dev365/ascy/blob/main/src/arcade/audio.ts): `src/arcade/audio.ts`

### Tauri Services

- [PTY Sessions](https://github.com/otabek-dev365/ascy/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Session Restore](https://github.com/otabek-dev365/ascy/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Game Files](https://github.com/otabek-dev365/ascy/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Native Audio](https://github.com/otabek-dev365/ascy/blob/main/src-tauri/src/audio.rs): `src-tauri/src/audio.rs`

### Other components

- **User**
- **Shell Process**

## Connections

- User → Terminal UI: uses (evidence: `README.md`)
- Terminal UI → xterm Pane: manages panes (evidence: `README.md`)
- xterm Pane → PTY Sessions: starts shell (evidence: `src/main.ts`)
- PTY Sessions → Shell Process: spawns (evidence: `src-tauri/src/lib.rs`)
- Shell Process → xterm Pane: streams output (evidence: `README.md`)
- Terminal UI → Session Restore: restores sessions (evidence: `src/main.ts`)
- Terminal UI → Settings I/O: loads and saves (evidence: `src/main.ts`)
- Settings I/O → Theme Registry: resolves themes (evidence: `src/settings.ts`)
- Terminal UI → Key Bindings: builds keymap (evidence: `src/main.ts`)
- Terminal UI → Matrix Rain: controls rain (evidence: `README.md`)
- User → Arcade Host: opens arcade (evidence: `README.md`)
- Arcade Host → Game Hub: loads hub (evidence: `src/arcade/arcade.ts`)
- Arcade Host → Sandbox Worker: runs game code (evidence: `src/arcade/arcade.ts`)
- Arcade Host → Built-in Snake: loads built-in (evidence: `src/arcade/arcade.ts`)
- Arcade Host → Game Files: lists and reads (evidence: `src/arcade/arcade.ts`)
- Sandbox Worker → Grid Renderer: sends frames (evidence: `src/arcade/arcade.ts`)
- Arcade Host → Grid Renderer: draws frames (evidence: `src/arcade/arcade.ts`)
- Arcade Host → Sound Validation: validates sounds
- Arcade Host → Arcade Audio Bridge: plays requests (evidence: `src/arcade/arcade.ts`)
- Arcade Audio Bridge → Native Audio: sends audio ops (evidence: `src/arcade/audio.ts`)
