# lensnteam/liant architecture

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

- Interactive diagram: https://gitdiagram.com/lensnteam/liant
- Repository: https://github.com/lensnteam/liant

## Overview

LianT is a Telegram bot management system with self-hosted service support, desktop and Android client surfaces, and a download website. Its central runtime workflow is the service command dispatcher starting a daemon that manages bot subprocesses; bot processes connect through local WebSockets, while the daemon provides the public proxy boundary. Bot runtime exchanges messages and media with Telegram and connected clients. The desktop launcher provisions Python and starts the client. The README is high-level, and several source excerpts are partial, so uncertain wiring—especially between client surfaces and service APIs—is omitted.

Main entry points: [`service/botruntime/main.go`](https://github.com/lensnteam/liant/blob/main/service/botruntime/main.go) (Bot runtime), [`service/main.go`](https://github.com/lensnteam/liant/blob/main/service/main.go) (Command dispatch), [`manager/desktop/launcher/cmd/main.go`](https://github.com/lensnteam/liant/blob/main/manager/desktop/launcher/cmd/main.go) (Desktop launcher), [`service/service/manager.go`](https://github.com/lensnteam/liant/blob/main/service/service/manager.go) (Process manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Bot service"]
  node_dispatch["Command dispatch<br/>[main.go]"]
  node_configuration["Configuration<br/>[config.go]"]
  node_service_commands["Service commands<br/>[command.go]"]
  node_daemon["Bot daemon<br/>[daemon.go]"]
  node_process_manager["Process manager<br/>[manager.go]"]
  node_bot_runtime["Bot runtime<br/>[main.go]"]
  node_websocket["WebSocket server<br/>[wss.go]"]
  node_proxy["WSS proxy<br/>[wssproxy.go]"]
  node_crypto["Key encryption<br/>[chacha.go]"]
  node_bot_store[("Bot token store<br/>[main.go]")]
end

subgraph group_client["Client applications"]
  node_desktop_launcher["Desktop launcher<br/>[main.go]"]
  node_runtime_manager["Runtime locator<br/>[manager.go]"]
  node_runtime_provisioner["Runtime provisioner<br/>[updater.go]"]
  node_desktop_client["Desktop client<br/>[main.py]"]
  node_android_splash["Android client<br/>[SplashActivity.kt]"]
end

subgraph group_website["Download website"]
  node_website_pages["Website pages<br/>[page.tsx]"]
  node_download_views["Download views<br/>[page.tsx]"]
  node_download_data["Release data<br/>[downloads.ts]"]
  node_github_data["GitHub data<br/>[github.ts]"]
end

subgraph group_integration["External systems"]
  node_telegram["Telegram API"]
end

node_operator(("Operator"))
node_visitor(("Website visitor"))

node_operator -->|"runs commands"| node_dispatch
node_dispatch -->|"dispatches config"| node_configuration
node_dispatch -->|"dispatches service"| node_service_commands
node_dispatch -->|"starts daemon"| node_daemon
node_service_commands -->|"starts daemon"| node_daemon
node_daemon -->|"manages bots"| node_process_manager
node_process_manager -->|"starts subprocess"| node_bot_runtime
node_process_manager -->|"routes connections"| node_proxy
node_bot_runtime -->|"reads token"| node_bot_store
node_bot_runtime -->|"decrypts token"| node_crypto
node_bot_runtime -->|"polls and sends"| node_telegram
node_bot_runtime -->|"exchanges messages"| node_websocket
node_websocket -->|"serves local WSS"| node_proxy
node_desktop_launcher -->|"locates runtime"| node_runtime_manager
node_desktop_launcher -->|"provisions runtime"| node_runtime_provisioner
node_desktop_launcher -->|"starts client"| node_desktop_client
node_operator -->|"launches client"| node_desktop_launcher
node_operator -->|"opens app"| node_android_splash
node_visitor -->|"browses"| node_website_pages
node_website_pages -->|"links downloads"| node_download_views
node_download_views -->|"reads releases"| node_download_data
node_download_views -.->|"loads GitHub data"| node_github_data

click node_dispatch "https://github.com/lensnteam/liant/blob/main/service/main.go"
click node_configuration "https://github.com/lensnteam/liant/blob/main/service/config/config.go"
click node_service_commands "https://github.com/lensnteam/liant/blob/main/service/service/command.go"
click node_daemon "https://github.com/lensnteam/liant/blob/main/service/service/daemon.go"
click node_process_manager "https://github.com/lensnteam/liant/blob/main/service/service/manager.go"
click node_bot_runtime "https://github.com/lensnteam/liant/blob/main/service/botruntime/main.go"
click node_websocket "https://github.com/lensnteam/liant/blob/main/service/wss/wss.go"
click node_proxy "https://github.com/lensnteam/liant/blob/main/service/service/wssproxy.go"
click node_crypto "https://github.com/lensnteam/liant/blob/main/service/crypto/chacha.go"
click node_bot_store "https://github.com/lensnteam/liant/blob/main/service/botruntime/main.go"
click node_desktop_launcher "https://github.com/lensnteam/liant/blob/main/manager/desktop/launcher/cmd/main.go"
click node_runtime_manager "https://github.com/lensnteam/liant/blob/main/manager/desktop/launcher/runtime/manager.go"
click node_runtime_provisioner "https://github.com/lensnteam/liant/blob/main/manager/desktop/launcher/updater/updater.go"
click node_desktop_client "https://github.com/lensnteam/liant/blob/main/manager/desktop/client/src/main.py"
click node_android_splash "https://github.com/lensnteam/liant/blob/main/manager/android/app/src/main/kotlin/com/lensnteam/liant/SplashActivity.kt"
click node_website_pages "https://github.com/lensnteam/liant/blob/main/pages/src/app/page.tsx"
click node_download_views "https://github.com/lensnteam/liant/blob/main/pages/src/app/manager/page.tsx"
click node_download_data "https://github.com/lensnteam/liant/blob/main/pages/src/data/downloads.ts"
click node_github_data "https://github.com/lensnteam/liant/blob/main/pages/src/data/github.ts"

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_dispatch,node_configuration,node_service_commands,node_daemon,node_process_manager,node_bot_runtime,node_websocket,node_proxy,node_crypto,node_bot_store toneBlue
class node_desktop_launcher,node_runtime_manager,node_runtime_provisioner,node_desktop_client,node_android_splash toneAmber
class node_website_pages,node_download_views,node_download_data,node_github_data toneMint
class node_telegram toneRose
class node_operator,node_visitor toneIndigo
```

## Components

### Bot service

- [Command dispatch](https://github.com/lensnteam/liant/blob/main/service/main.go): `service/main.go`
- [Configuration](https://github.com/lensnteam/liant/blob/main/service/config/config.go): `service/config/config.go`
- [Service commands](https://github.com/lensnteam/liant/blob/main/service/service/command.go): `service/service/command.go`
- [Bot daemon](https://github.com/lensnteam/liant/blob/main/service/service/daemon.go): `service/service/daemon.go`
- [Process manager](https://github.com/lensnteam/liant/blob/main/service/service/manager.go): `service/service/manager.go`
- [Bot runtime](https://github.com/lensnteam/liant/blob/main/service/botruntime/main.go): `service/botruntime/main.go`
- [WebSocket server](https://github.com/lensnteam/liant/blob/main/service/wss/wss.go): `service/wss/wss.go`
- [WSS proxy](https://github.com/lensnteam/liant/blob/main/service/service/wssproxy.go): `service/service/wssproxy.go`
- [Key encryption](https://github.com/lensnteam/liant/blob/main/service/crypto/chacha.go): `service/crypto/chacha.go`
- [Bot token store](https://github.com/lensnteam/liant/blob/main/service/botruntime/main.go): `service/botruntime/main.go`

### Client applications

- [Desktop launcher](https://github.com/lensnteam/liant/blob/main/manager/desktop/launcher/cmd/main.go): `manager/desktop/launcher/cmd/main.go`
- [Runtime locator](https://github.com/lensnteam/liant/blob/main/manager/desktop/launcher/runtime/manager.go): `manager/desktop/launcher/runtime/manager.go`
- [Runtime provisioner](https://github.com/lensnteam/liant/blob/main/manager/desktop/launcher/updater/updater.go): `manager/desktop/launcher/updater/updater.go`
- [Desktop client](https://github.com/lensnteam/liant/blob/main/manager/desktop/client/src/main.py): `manager/desktop/client/src/main.py`
- [Android client](https://github.com/lensnteam/liant/blob/main/manager/android/app/src/main/kotlin/com/lensnteam/liant/SplashActivity.kt): `manager/android/app/src/main/kotlin/com/lensnteam/liant/SplashActivity.kt`

### Download website

- [Website pages](https://github.com/lensnteam/liant/blob/main/pages/src/app/page.tsx): `pages/src/app/page.tsx`
- [Download views](https://github.com/lensnteam/liant/blob/main/pages/src/app/manager/page.tsx): `pages/src/app/manager/page.tsx`
- [Release data](https://github.com/lensnteam/liant/blob/main/pages/src/data/downloads.ts): `pages/src/data/downloads.ts`
- [GitHub data](https://github.com/lensnteam/liant/blob/main/pages/src/data/github.ts): `pages/src/data/github.ts`

### External systems

- **Telegram API**

### Other components

- **Operator**
- **Website visitor**

## Connections

- Operator → Command dispatch: runs commands
- Command dispatch → Configuration: dispatches config
- Command dispatch → Service commands: dispatches service
- Command dispatch → Bot daemon: starts daemon
- Service commands → Bot daemon: starts daemon
- Bot daemon → Process manager: manages bots
- Process manager → Bot runtime: starts subprocess
- Process manager → WSS proxy: routes connections
- Bot runtime → Bot token store: reads token
- Bot runtime → Key encryption: decrypts token
- Bot runtime → Telegram API: polls and sends
- Bot runtime → WebSocket server: exchanges messages
- WebSocket server → WSS proxy: serves local WSS
- Desktop launcher → Runtime locator: locates runtime
- Desktop launcher → Runtime provisioner: provisions runtime
- Desktop launcher → Desktop client: starts client
- Operator → Desktop launcher: launches client
- Operator → Android client: opens app
- Website visitor → Website pages: browses
- Website pages → Download views: links downloads
- Download views → Release data: reads releases
- Download views → GitHub data: loads GitHub data
