# tgyt-dev/board architecture

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

- Interactive diagram: https://gitdiagram.com/tgyt-dev/board
- Repository: https://github.com/tgyt-dev/board

## Overview

This is an SSH-accessed terminal message board built with Go, Wish, and Bubble Tea. An SSH user enters through the server, receives a per-session terminal UI, sets a username if needed, then browses posts and replies or composes content; the UI uses database helpers to persist and reload board state. SQLite stores users, messages, and likes. The repository also starts a small HTTP file server for the web directory. The excerpts show the main session and post flows; the like-handler connection is not shown, so it is marked unverified.

Main entry points: [`main.go`](https://github.com/tgyt-dev/board/blob/main/main.go) (Terminal board UI), [`db.go`](https://github.com/tgyt-dev/board/blob/main/db.go) (Board data helpers), [`web.go`](https://github.com/tgyt-dev/board/blob/main/web.go) (Static file server), [`web/index.html`](https://github.com/tgyt-dev/board/blob/main/web/index.html) (Web assets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and UI"]
  node_ssh_server["SSH server<br/>[main.go]"]
  node_terminal_ui["Terminal board UI<br/>[main.go]"]
  node_static_server["Static file server<br/>[web.go]"]
  node_web_assets["Web assets<br/>[index.html]"]
end

subgraph group_board["Board workflow"]
  node_identity["SSH key identity<br/>[main.go]"]
  node_username_setup["Username setup<br/>[main.go]"]
  node_post_reply_flow["Posts and replies<br/>[main.go]"]
  node_like_flow["Like toggling<br/>[main.go]"]
end

subgraph group_persistence["Persistence"]
  node_db_helpers["Board data helpers<br/>[db.go]"]
  node_sqlite[("SQLite database<br/>[db.go]")]
end

node_ssh_user(("SSH user"))
node_web_visitor(("Web visitor"))

node_ssh_user -->|"opens session"| node_ssh_server
node_ssh_server -->|"starts session UI"| node_terminal_ui
node_terminal_ui -->|"hashes public key"| node_identity
node_terminal_ui -->|"initializes username"| node_username_setup
node_username_setup -->|"reads and saves username"| node_db_helpers
node_terminal_ui -->|"handles board actions"| node_post_reply_flow
node_post_reply_flow -->|"creates and loads posts"| node_db_helpers
node_terminal_ui -->|"loads replies for display"| node_db_helpers
node_like_flow -.->|"toggles like"| node_db_helpers
node_db_helpers -->|"reads and writes"| node_sqlite
node_ssh_server -->|"opens database"| node_sqlite
node_ssh_server -->|"starts HTTP server"| node_static_server
node_web_visitor -->|"requests files"| node_static_server
node_static_server -->|"serves directory"| node_web_assets

click node_ssh_server "https://github.com/tgyt-dev/board/blob/main/main.go"
click node_terminal_ui "https://github.com/tgyt-dev/board/blob/main/main.go"
click node_static_server "https://github.com/tgyt-dev/board/blob/main/web.go"
click node_web_assets "https://github.com/tgyt-dev/board/blob/main/web/index.html"
click node_identity "https://github.com/tgyt-dev/board/blob/main/main.go"
click node_username_setup "https://github.com/tgyt-dev/board/blob/main/main.go"
click node_post_reply_flow "https://github.com/tgyt-dev/board/blob/main/main.go"
click node_like_flow "https://github.com/tgyt-dev/board/blob/main/main.go"
click node_db_helpers "https://github.com/tgyt-dev/board/blob/main/db.go"
click node_sqlite "https://github.com/tgyt-dev/board/blob/main/db.go"

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_ssh_server,node_terminal_ui,node_static_server,node_web_assets,node_ssh_user toneBlue
class node_identity,node_username_setup,node_post_reply_flow,node_like_flow toneAmber
class node_db_helpers,node_sqlite toneMint
class node_web_visitor toneIndigo
```

## Components

### Access and UI

- [SSH server](https://github.com/tgyt-dev/board/blob/main/main.go): `main.go`
- [Terminal board UI](https://github.com/tgyt-dev/board/blob/main/main.go): `main.go`
- [Static file server](https://github.com/tgyt-dev/board/blob/main/web.go): `web.go`
- [Web assets](https://github.com/tgyt-dev/board/blob/main/web/index.html): `web/index.html`

### Board workflow

- [SSH key identity](https://github.com/tgyt-dev/board/blob/main/main.go): `main.go`
- [Username setup](https://github.com/tgyt-dev/board/blob/main/main.go): `main.go`
- [Posts and replies](https://github.com/tgyt-dev/board/blob/main/main.go): `main.go`
- [Like toggling](https://github.com/tgyt-dev/board/blob/main/main.go): `main.go`

### Persistence

- [Board data helpers](https://github.com/tgyt-dev/board/blob/main/db.go): `db.go`
- [SQLite database](https://github.com/tgyt-dev/board/blob/main/db.go): `db.go`

### Other components

- **SSH user**
- **Web visitor**

## Connections

- SSH user → SSH server: opens session (evidence: `README.md`)
- SSH server → Terminal board UI: starts session UI (evidence: `main.go`)
- Terminal board UI → SSH key identity: hashes public key (evidence: `main.go`)
- Terminal board UI → Username setup: initializes username (evidence: `main.go`)
- Username setup → Board data helpers: reads and saves username (evidence: `main.go`)
- Terminal board UI → Posts and replies: handles board actions (evidence: `main.go`)
- Posts and replies → Board data helpers: creates and loads posts (evidence: `main.go`)
- Terminal board UI → Board data helpers: loads replies for display (evidence: `main.go`)
- Like toggling → Board data helpers: toggles like
- Board data helpers → SQLite database: reads and writes (evidence: `db.go`)
- SSH server → SQLite database: opens database (evidence: `main.go`)
- SSH server → Static file server: starts HTTP server (evidence: `main.go`)
- Web visitor → Static file server: requests files (evidence: `web.go`)
- Static file server → Web assets: serves directory (evidence: `web.go`)
