# egoist/mygo architecture

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

- Interactive diagram: https://gitdiagram.com/egoist/mygo
- Repository: https://github.com/egoist/mygo

## Overview

MyGo is a Go framework for building cross-platform desktop apps with either webview-based pages or a Go-native UI. The principal workflow is app startup, creation of a window, presentation through one of those interface paths, and access to desktop APIs; web pages can call Go through typed IPC. The README also documents shipping tools and signed auto-updates. Platform backends, rendering, and several product capabilities are represented at subsystem level where their implementation was not sampled.

Main entry points: [`app.go`](https://github.com/egoist/mygo/blob/main/app.go) (Application Lifecycle), [`internal/platform/platform.go`](https://github.com/egoist/mygo/blob/main/internal/platform/platform.go) (Platform Abstraction), [`window.go`](https://github.com/egoist/mygo/blob/main/window.go) (Window API), [`ipc.go`](https://github.com/egoist/mygo/blob/main/ipc.go) (Typed Go IPC)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["App Runtime"]
  node_app["Application Lifecycle<br/>[app.go]"]
  node_window["Window API<br/>[window.go]"]
  node_ipc["Typed Go IPC<br/>[ipc.go]"]
  node_tsgen["TypeScript Generation<br/>[generate.go]"]
end

subgraph group_interfaces["App Interfaces"]
  node_web["Web Frontend<br/>[index.ts]"]
  node_webview["Webview Surface<br/>[surface.go]"]
  node_ui["Native UI Toolkit<br/>[runtime.go]"]
end

subgraph group_rendering["UI Rendering"]
  node_gpu["GPU Rendering<br/>[raster.go]"]
  node_scene["Scene Composition<br/>[scene.go]"]
  node_text["Text Layout<br/>[engine.go]"]
end

subgraph group_platform["Platform Services"]
  node_platform["Platform Abstraction<br/>[platform.go]"]
  node_darwin["macOS Backend<br/>[app.go]"]
  node_linux["Linux Backend<br/>[app.go]"]
  node_windows["Windows Backend<br/>[app.go]"]
  node_desktop["Desktop APIs<br/>[app.go]"]
  node_drag["Drag And Drop<br/>[drag.go]"]
end

subgraph group_shipping["Shipping And Extensions"]
  node_cli["Build And Packaging"]
  node_updater["Signed Auto-Updates<br/>[updater.go]"]
  node_plugins["App Plugins"]
end

node_developer(("App Developer"))
node_user(("Desktop User"))

node_developer -->|"creates app"| node_app
node_app -->|"opens windows"| node_window
node_window -->|"shows web page"| node_webview
node_window -->|"hosts native UI"| node_ui
node_web -->|"calls Go services"| node_ipc
node_ipc -->|"generates client"| node_tsgen
node_ui -->|"draws with GPU"| node_gpu
node_gpu -->|"reads scene"| node_scene
node_text -->|"supplies glyphs"| node_scene
node_app -->|"uses platform layer"| node_platform
node_platform -.->|"selects backend"| node_darwin
node_platform -.->|"selects backend"| node_linux
node_platform -.->|"selects backend"| node_windows
node_app -->|"exposes APIs"| node_desktop
node_platform -->|"provides drag support"| node_drag
node_developer -->|"builds packages"| node_cli
node_app -->|"offers auto-updates"| node_updater
node_developer -.->|"adds capabilities"| node_plugins
node_user -->|"launches app"| node_app

click node_app "https://github.com/egoist/mygo/blob/main/app.go"
click node_window "https://github.com/egoist/mygo/blob/main/window.go"
click node_ipc "https://github.com/egoist/mygo/blob/main/ipc.go"
click node_tsgen "https://github.com/egoist/mygo/blob/main/internal/tsgen/generate.go"
click node_web "https://github.com/egoist/mygo/blob/main/packages/runtime/src/index.ts"
click node_webview "https://github.com/egoist/mygo/blob/main/internal/web/surface.go"
click node_ui "https://github.com/egoist/mygo/blob/main/ui/runtime.go"
click node_gpu "https://github.com/egoist/mygo/blob/main/internal/raster/raster.go"
click node_scene "https://github.com/egoist/mygo/blob/main/internal/scene/scene.go"
click node_text "https://github.com/egoist/mygo/blob/main/internal/text/engine.go"
click node_platform "https://github.com/egoist/mygo/blob/main/internal/platform/platform.go"
click node_darwin "https://github.com/egoist/mygo/blob/main/internal/darwin/app.go"
click node_linux "https://github.com/egoist/mygo/blob/main/internal/linux/app.go"
click node_windows "https://github.com/egoist/mygo/blob/main/internal/windows/app.go"
click node_desktop "https://github.com/egoist/mygo/blob/main/app.go"
click node_drag "https://github.com/egoist/mygo/blob/main/internal/platform/drag.go"
click node_cli "https://github.com/egoist/mygo/tree/main/cmd/mygo"
click node_updater "https://github.com/egoist/mygo/blob/main/plugins/updater/updater.go"
click node_plugins "https://github.com/egoist/mygo/tree/main/plugins"

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_window,node_ipc,node_tsgen,node_user toneBlue
class node_web,node_webview,node_ui toneAmber
class node_gpu,node_scene,node_text toneMint
class node_platform,node_darwin,node_linux,node_windows,node_desktop,node_drag toneRose
class node_cli,node_updater,node_plugins,node_developer toneIndigo
```

## Components

### App Runtime

- [Application Lifecycle](https://github.com/egoist/mygo/blob/main/app.go): `app.go`
- [Window API](https://github.com/egoist/mygo/blob/main/window.go): `window.go`
- [Typed Go IPC](https://github.com/egoist/mygo/blob/main/ipc.go): `ipc.go`
- [TypeScript Generation](https://github.com/egoist/mygo/blob/main/internal/tsgen/generate.go): `internal/tsgen/generate.go`

### App Interfaces

- [Web Frontend](https://github.com/egoist/mygo/blob/main/packages/runtime/src/index.ts): `packages/runtime/src/index.ts`
- [Webview Surface](https://github.com/egoist/mygo/blob/main/internal/web/surface.go): `internal/web/surface.go`
- [Native UI Toolkit](https://github.com/egoist/mygo/blob/main/ui/runtime.go): `ui/runtime.go`

### UI Rendering

- [GPU Rendering](https://github.com/egoist/mygo/blob/main/internal/raster/raster.go): `internal/raster/raster.go`
- [Scene Composition](https://github.com/egoist/mygo/blob/main/internal/scene/scene.go): `internal/scene/scene.go`
- [Text Layout](https://github.com/egoist/mygo/blob/main/internal/text/engine.go): `internal/text/engine.go`

### Platform Services

- [Platform Abstraction](https://github.com/egoist/mygo/blob/main/internal/platform/platform.go): `internal/platform/platform.go`
- [macOS Backend](https://github.com/egoist/mygo/blob/main/internal/darwin/app.go): `internal/darwin/app.go`
- [Linux Backend](https://github.com/egoist/mygo/blob/main/internal/linux/app.go): `internal/linux/app.go`
- [Windows Backend](https://github.com/egoist/mygo/blob/main/internal/windows/app.go): `internal/windows/app.go`
- [Desktop APIs](https://github.com/egoist/mygo/blob/main/app.go): `app.go`
- [Drag And Drop](https://github.com/egoist/mygo/blob/main/internal/platform/drag.go): `internal/platform/drag.go`

### Shipping And Extensions

- [Build And Packaging](https://github.com/egoist/mygo/tree/main/cmd/mygo): `cmd/mygo`
- [Signed Auto-Updates](https://github.com/egoist/mygo/blob/main/plugins/updater/updater.go): `plugins/updater/updater.go`
- [App Plugins](https://github.com/egoist/mygo/tree/main/plugins): `plugins`

### Other components

- **App Developer**
- **Desktop User**

## Connections

- App Developer → Application Lifecycle: creates app (evidence: `README.md`)
- Application Lifecycle → Window API: opens windows (evidence: `README.md`)
- Window API → Webview Surface: shows web page (evidence: `README.md`)
- Window API → Native UI Toolkit: hosts native UI (evidence: `README.md`)
- Web Frontend → Typed Go IPC: calls Go services (evidence: `README.md`)
- Typed Go IPC → TypeScript Generation: generates client (evidence: `README.md`)
- Native UI Toolkit → GPU Rendering: draws with GPU (evidence: `README.md`)
- GPU Rendering → Scene Composition: reads scene (evidence: `internal/raster/raster.go`)
- Text Layout → Scene Composition: supplies glyphs (evidence: `internal/text/engine.go`)
- Application Lifecycle → Platform Abstraction: uses platform layer (evidence: `app.go`)
- Platform Abstraction → macOS Backend: selects backend
- Platform Abstraction → Linux Backend: selects backend
- Platform Abstraction → Windows Backend: selects backend
- Application Lifecycle → Desktop APIs: exposes APIs (evidence: `README.md`)
- Platform Abstraction → Drag And Drop: provides drag support (evidence: `internal/platform/drag.go`)
- App Developer → Build And Packaging: builds packages (evidence: `README.md`)
- Application Lifecycle → Signed Auto-Updates: offers auto-updates (evidence: `README.md`)
- App Developer → App Plugins: adds capabilities
- Desktop User → Application Lifecycle: launches app (evidence: `README.md`)
