# schoolweiqi/go-interfaces architecture

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

- Interactive diagram: https://gitdiagram.com/schoolweiqi/go-interfaces
- Repository: https://github.com/schoolweiqi/go-interfaces

## Overview

Go Interfaces is a browser-based Go application centered on OGS automatch, with a local rules-aware board and optional bot, network-room, and collaborative-review modes. The principal workflow is player → OGS authentication and matchmaking → opponent found → official OGS game screen; the README says local-board synchronization is not yet complete. The graph also preserves local play, analysis visuals, game variations, and SGF capabilities represented by core modules. Connections are limited to shown calls or README statements; unsampled module relationships are omitted.

Main entry points: [`ui.js`](https://github.com/schoolweiqi/go-interfaces/blob/main/ui.js) (UI controller), [`ogs.js`](https://github.com/schoolweiqi/go-interfaces/blob/main/ogs.js) (OGS client), [`cloudflare-worker/src/index.js`](https://github.com/schoolweiqi/go-interfaces/blob/main/cloudflare-worker/src/index.js) (Room service), [`gnugo-worker.js`](https://github.com/schoolweiqi/go-interfaces/blob/main/gnugo-worker.js) (Engine worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ogs["OGS matchmaking"]
  node_ogs_client["OGS client<br/>[ogs.js]"]
end

subgraph group_play["Board and play"]
  node_ui["UI controller<br/>[ui.js]"]
  node_rules["Go rules and state<br/>[game.js]"]
  node_render["Board rendering<br/>[board.js]"]
  node_bot_engine["GNU Go engine<br/>[gnugo.js]"]
  node_bot_worker["Engine worker<br/>[gnugo-worker.js]"]
  node_game_tree["Variation tree<br/>[tree.js]"]
  node_sgf["SGF handling<br/>[sgf.js]"]
end

subgraph group_analysis["Analysis tools"]
  node_faces["Group faces and links<br/>[faces.js]"]
  node_influence["Influence visualization<br/>[influence.js]"]
end

subgraph group_shared["Shared games"]
  node_app["Room orchestration<br/>[app.js]"]
  node_review["Collaborative review<br/>[review.js]"]
  node_worker["Room service<br/>[index.js]"]
  node_room_store[("Durable room state<br/>[index.js]")]
end

node_player(("Player"))
node_ogs_service["OGS"]
node_official_game["Official game screen"]

node_player -->|"authenticates and matches"| node_ogs_client
node_ogs_client -->|"requests OAuth and matchmaking"| node_ogs_service
node_ogs_client -->|"redirects after match"| node_official_game
node_player -->|"uses local board"| node_ui
node_ui -->|"plays and restores moves"| node_rules
node_ui -->|"navigates variations"| node_game_tree
node_ui -->|"requests bot moves"| node_bot_worker
node_bot_worker -->|"calls WebAssembly engine"| node_bot_engine
node_ui -.->|"exports game records"| node_sgf
node_player -.->|"enables group visuals"| node_faces
node_player -.->|"enables influence view"| node_influence
node_player -->|"creates or joins room"| node_app
node_app -->|"sends room requests and WebSocket"| node_worker
node_worker -->|"reads and writes state"| node_room_store
node_player -->|"creates or joins review"| node_review
node_review -->|"sends review requests and WebSocket"| node_worker
node_render -.->|"renders board state"| node_rules

click node_ogs_client "https://github.com/schoolweiqi/go-interfaces/blob/main/ogs.js"
click node_ui "https://github.com/schoolweiqi/go-interfaces/blob/main/ui.js"
click node_rules "https://github.com/schoolweiqi/go-interfaces/blob/main/game.js"
click node_render "https://github.com/schoolweiqi/go-interfaces/blob/main/board.js"
click node_bot_engine "https://github.com/schoolweiqi/go-interfaces/blob/main/gnugo.js"
click node_bot_worker "https://github.com/schoolweiqi/go-interfaces/blob/main/gnugo-worker.js"
click node_game_tree "https://github.com/schoolweiqi/go-interfaces/blob/main/tree.js"
click node_sgf "https://github.com/schoolweiqi/go-interfaces/blob/main/sgf.js"
click node_faces "https://github.com/schoolweiqi/go-interfaces/blob/main/faces.js"
click node_influence "https://github.com/schoolweiqi/go-interfaces/blob/main/influence.js"
click node_app "https://github.com/schoolweiqi/go-interfaces/blob/main/app.js"
click node_review "https://github.com/schoolweiqi/go-interfaces/blob/main/review.js"
click node_worker "https://github.com/schoolweiqi/go-interfaces/blob/main/cloudflare-worker/src/index.js"
click node_room_store "https://github.com/schoolweiqi/go-interfaces/blob/main/cloudflare-worker/src/index.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_ogs_client,node_official_game toneBlue
class node_ui,node_rules,node_render,node_bot_engine,node_bot_worker,node_game_tree,node_sgf toneAmber
class node_faces,node_influence toneMint
class node_app,node_review,node_worker,node_room_store toneRose
class node_player,node_ogs_service toneIndigo
```

## Components

### OGS matchmaking

- [OGS client](https://github.com/schoolweiqi/go-interfaces/blob/main/ogs.js): `ogs.js`

### Board and play

- [UI controller](https://github.com/schoolweiqi/go-interfaces/blob/main/ui.js): `ui.js`
- [Go rules and state](https://github.com/schoolweiqi/go-interfaces/blob/main/game.js): `game.js`
- [Board rendering](https://github.com/schoolweiqi/go-interfaces/blob/main/board.js): `board.js`
- [GNU Go engine](https://github.com/schoolweiqi/go-interfaces/blob/main/gnugo.js): `gnugo.js`
- [Engine worker](https://github.com/schoolweiqi/go-interfaces/blob/main/gnugo-worker.js): `gnugo-worker.js`
- [Variation tree](https://github.com/schoolweiqi/go-interfaces/blob/main/tree.js): `tree.js`
- [SGF handling](https://github.com/schoolweiqi/go-interfaces/blob/main/sgf.js): `sgf.js`

### Analysis tools

- [Group faces and links](https://github.com/schoolweiqi/go-interfaces/blob/main/faces.js): `faces.js`
- [Influence visualization](https://github.com/schoolweiqi/go-interfaces/blob/main/influence.js): `influence.js`

### Shared games

- [Room orchestration](https://github.com/schoolweiqi/go-interfaces/blob/main/app.js): `app.js`
- [Collaborative review](https://github.com/schoolweiqi/go-interfaces/blob/main/review.js): `review.js`
- [Room service](https://github.com/schoolweiqi/go-interfaces/blob/main/cloudflare-worker/src/index.js): `cloudflare-worker/src/index.js`
- [Durable room state](https://github.com/schoolweiqi/go-interfaces/blob/main/cloudflare-worker/src/index.js): `cloudflare-worker/src/index.js`

### Other components

- **Player**
- **OGS**
- **Official game screen**

## Connections

- Player → OGS client: authenticates and matches (evidence: `README.txt`)
- OGS client → OGS: requests OAuth and matchmaking (evidence: `ogs.js`)
- OGS client → Official game screen: redirects after match (evidence: `README.txt`)
- Player → UI controller: uses local board (evidence: `README.txt`)
- UI controller → Go rules and state: plays and restores moves (evidence: `ui.js`)
- UI controller → Variation tree: navigates variations (evidence: `ui.js`)
- UI controller → Engine worker: requests bot moves (evidence: `ui.js`)
- Engine worker → GNU Go engine: calls WebAssembly engine (evidence: `gnugo-worker.js`)
- UI controller → SGF handling: exports game records
- Player → Group faces and links: enables group visuals
- Player → Influence visualization: enables influence view
- Player → Room orchestration: creates or joins room (evidence: `app.js`)
- Room orchestration → Room service: sends room requests and WebSocket (evidence: `app.js`)
- Room service → Durable room state: reads and writes state (evidence: `cloudflare-worker/src/index.js`)
- Player → Collaborative review: creates or joins review (evidence: `review.js`)
- Collaborative review → Room service: sends review requests and WebSocket (evidence: `review.js`)
- Board rendering → Go rules and state: renders board state
