# jshmillvc/late-sh architecture

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

- Interactive diagram: https://gitdiagram.com/jshmillvc/late-sh
- Repository: https://github.com/jshmillvc/late-sh

## Overview

late.sh is a terminal-first social clubhouse reached primarily over SSH, with a browser frontend and companion CLI. The main workflow is an SSH user connecting to the server, using the terminal app to reach chat, news, profiles, games, and shared activity, while domain services use shared core models and PostgreSQL. Audio streams through Icecast/Liquidsoap and can be played or visualized locally by the CLI; the web app provides landing, connect, and paired-client experiences. README capabilities guide unsampled areas; wiring is shown only where documented or evident in sampled entry points.

Main entry points: [`late-ssh/src/app/mod.rs`](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/mod.rs) (Terminal UI), [`late-cli/src/main.rs`](https://github.com/jshmillvc/late-sh/blob/main/late-cli/src/main.rs) (Companion CLI), [`late-web/src/pages/mod.rs`](https://github.com/jshmillvc/late-sh/blob/main/late-web/src/pages/mod.rs) (Web pages), [`late-ssh/src/app/chat/svc.rs`](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/chat/svc.rs) (Domain services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access clients"]
  node_ssh_server["SSH server<br/>[main.rs]"]
  node_web_app["Web frontend<br/>[lib.rs]"]
  node_web_pages["Web pages<br/>[mod.rs]"]
  node_companion_cli["Companion CLI<br/>[main.rs]"]
  node_paired_sessions["Paired sessions<br/>[session.rs]"]
  node_browser_pairing["Browser pairing<br/>[mod.rs]"]
  node_stream_page["Stream page<br/>[stream.rs]"]
end

subgraph group_terminal["Terminal app"]
  node_terminal_ui["Terminal UI<br/>[mod.rs]"]
  node_dashboard["Dashboard<br/>[mod.rs]"]
  node_chat["Chat<br/>[mod.rs]"]
  node_news["News feed<br/>[mod.rs]"]
  node_notifications["Notifications<br/>[mod.rs]"]
  node_profile["Profiles<br/>[mod.rs]"]
  node_games["Arcade games<br/>[mod.rs]"]
  node_bonsai["Bonsai<br/>[mod.rs]"]
  node_ai_bots["Chat bots<br/>[mod.rs]"]
end

subgraph group_domain["Shared domain"]
  node_domain_services["Domain services<br/>[svc.rs]"]
  node_core_models["Shared models<br/>[mod.rs]"]
  node_postgres[("PostgreSQL<br/>[db.rs]")]
end

subgraph group_audio["Audio system"]
  node_audio_runtime["Audio runtime<br/>[audio.rs]"]
  node_icecast["Icecast stream<br/>[icecast.rs]"]
  node_liquidsoap["Liquidsoap"]
end

node_ssh_user(("SSH user"))
node_web_user(("Browser user"))
node_cli_user(("CLI user"))

node_ssh_user -->|"connects via SSH"| node_ssh_server
node_ssh_server -->|"starts sessions"| node_terminal_ui
node_terminal_ui -->|"renders"| node_dashboard
node_terminal_ui -->|"renders"| node_chat
node_terminal_ui -->|"renders"| node_news
node_terminal_ui -->|"renders"| node_notifications
node_terminal_ui -->|"renders"| node_profile
node_terminal_ui -->|"renders"| node_games
node_terminal_ui -->|"renders"| node_bonsai
node_terminal_ui -->|"hosts"| node_ai_bots
node_chat -->|"calls"| node_domain_services
node_domain_services -->|"reads and writes"| node_postgres
node_domain_services -->|"uses"| node_core_models
node_ai_bots -->|"reads and writes"| node_postgres
node_web_user -->|"visits"| node_web_app
node_web_app -->|"routes"| node_web_pages
node_web_pages -->|"serves connect flow"| node_browser_pairing
node_web_pages -->|"serves stream page"| node_stream_page
node_cli_user -->|"runs"| node_companion_cli
node_companion_cli -->|"fetches audio"| node_icecast
node_companion_cli -->|"sends paired controls"| node_paired_sessions
node_paired_sessions -->|"delivers controls"| node_companion_cli
node_audio_runtime -->|"streams audio"| node_icecast
node_liquidsoap -.->|"provides stream"| node_icecast
node_browser_pairing -.->|"pairs client"| node_paired_sessions

click node_ssh_server "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/main.rs"
click node_terminal_ui "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/mod.rs"
click node_dashboard "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/dashboard/mod.rs"
click node_chat "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/chat/mod.rs"
click node_news "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/chat/news/mod.rs"
click node_notifications "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/chat/notifications/mod.rs"
click node_profile "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/profile/mod.rs"
click node_games "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/games/mod.rs"
click node_bonsai "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/bonsai/mod.rs"
click node_ai_bots "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/ai/mod.rs"
click node_web_app "https://github.com/jshmillvc/late-sh/blob/main/late-web/src/lib.rs"
click node_web_pages "https://github.com/jshmillvc/late-sh/blob/main/late-web/src/pages/mod.rs"
click node_companion_cli "https://github.com/jshmillvc/late-sh/blob/main/late-cli/src/main.rs"
click node_paired_sessions "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/session.rs"
click node_domain_services "https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/chat/svc.rs"
click node_core_models "https://github.com/jshmillvc/late-sh/blob/main/late-core/src/models/mod.rs"
click node_postgres "https://github.com/jshmillvc/late-sh/blob/main/late-core/src/db.rs"
click node_audio_runtime "https://github.com/jshmillvc/late-sh/blob/main/late-core/src/audio.rs"
click node_icecast "https://github.com/jshmillvc/late-sh/blob/main/late-core/src/icecast.rs"
click node_browser_pairing "https://github.com/jshmillvc/late-sh/blob/main/late-web/src/pages/connect/mod.rs"
click node_stream_page "https://github.com/jshmillvc/late-sh/blob/main/late-web/src/pages/stream.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_ssh_server,node_web_app,node_web_pages,node_companion_cli,node_paired_sessions,node_browser_pairing,node_stream_page,node_ssh_user,node_web_user,node_cli_user toneBlue
class node_terminal_ui,node_dashboard,node_chat,node_news,node_notifications,node_profile,node_games,node_bonsai,node_ai_bots toneAmber
class node_domain_services,node_core_models,node_postgres toneMint
class node_audio_runtime,node_icecast,node_liquidsoap toneRose
```

## Components

### Access clients

- [SSH server](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/main.rs): `late-ssh/src/main.rs`
- [Web frontend](https://github.com/jshmillvc/late-sh/blob/main/late-web/src/lib.rs): `late-web/src/lib.rs`
- [Web pages](https://github.com/jshmillvc/late-sh/blob/main/late-web/src/pages/mod.rs): `late-web/src/pages/mod.rs`
- [Companion CLI](https://github.com/jshmillvc/late-sh/blob/main/late-cli/src/main.rs): `late-cli/src/main.rs`
- [Paired sessions](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/session.rs): `late-ssh/src/session.rs`
- [Browser pairing](https://github.com/jshmillvc/late-sh/blob/main/late-web/src/pages/connect/mod.rs): `late-web/src/pages/connect/mod.rs`
- [Stream page](https://github.com/jshmillvc/late-sh/blob/main/late-web/src/pages/stream.rs): `late-web/src/pages/stream.rs`

### Terminal app

- [Terminal UI](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/mod.rs): `late-ssh/src/app/mod.rs`
- [Dashboard](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/dashboard/mod.rs): `late-ssh/src/app/dashboard/mod.rs`
- [Chat](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/chat/mod.rs): `late-ssh/src/app/chat/mod.rs`
- [News feed](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/chat/news/mod.rs): `late-ssh/src/app/chat/news/mod.rs`
- [Notifications](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/chat/notifications/mod.rs): `late-ssh/src/app/chat/notifications/mod.rs`
- [Profiles](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/profile/mod.rs): `late-ssh/src/app/profile/mod.rs`
- [Arcade games](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/games/mod.rs): `late-ssh/src/app/games/mod.rs`
- [Bonsai](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/bonsai/mod.rs): `late-ssh/src/app/bonsai/mod.rs`
- [Chat bots](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/ai/mod.rs): `late-ssh/src/app/ai/mod.rs`

### Shared domain

- [Domain services](https://github.com/jshmillvc/late-sh/blob/main/late-ssh/src/app/chat/svc.rs): `late-ssh/src/app/chat/svc.rs`
- [Shared models](https://github.com/jshmillvc/late-sh/blob/main/late-core/src/models/mod.rs): `late-core/src/models/mod.rs`
- [PostgreSQL](https://github.com/jshmillvc/late-sh/blob/main/late-core/src/db.rs): `late-core/src/db.rs`

### Audio system

- [Audio runtime](https://github.com/jshmillvc/late-sh/blob/main/late-core/src/audio.rs): `late-core/src/audio.rs`
- [Icecast stream](https://github.com/jshmillvc/late-sh/blob/main/late-core/src/icecast.rs): `late-core/src/icecast.rs`
- **Liquidsoap**

### Other components

- **SSH user**
- **Browser user**
- **CLI user**

## Connections

- SSH user → SSH server: connects via SSH
- SSH server → Terminal UI: starts sessions
- Terminal UI → Dashboard: renders
- Terminal UI → Chat: renders
- Terminal UI → News feed: renders
- Terminal UI → Notifications: renders
- Terminal UI → Profiles: renders
- Terminal UI → Arcade games: renders
- Terminal UI → Bonsai: renders
- Terminal UI → Chat bots: hosts
- Chat → Domain services: calls
- Domain services → PostgreSQL: reads and writes
- Domain services → Shared models: uses
- Chat bots → PostgreSQL: reads and writes
- Browser user → Web frontend: visits
- Web frontend → Web pages: routes
- Web pages → Browser pairing: serves connect flow
- Web pages → Stream page: serves stream page
- CLI user → Companion CLI: runs
- Companion CLI → Icecast stream: fetches audio
- Companion CLI → Paired sessions: sends paired controls
- Paired sessions → Companion CLI: delivers controls
- Audio runtime → Icecast stream: streams audio
- Liquidsoap → Icecast stream: provides stream
- Browser pairing → Paired sessions: pairs client
