# ekkolearnai/hermes-web-ui architecture

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

- Interactive diagram: https://gitdiagram.com/ekkolearnai/hermes-web-ui
- Repository: https://github.com/ekkolearnai/hermes-web-ui

## Overview

1. **Overall shape**
   - This is a two-tier monorepo: a **Vue 3 SPA frontend** in `packages/client` and a **Koa-based BFF/server** in `packages/server`.
   - The BFF is the main integration boundary between the browser and the local Hermes Agent ecosystem.

2. **Primary runtime flow**
   - **Browser → BFF (:8648) → Hermes Gateway (:8642)** is the core request path.
   - The frontend never talks directly to Hermes services; it calls the BFF through typed API wrappers under `packages/client/src/api`.
   - The BFF then proxies, rewrites paths, streams SSE responses, and performs local system operations when needed.

3. **Frontend application boundary**
   - The client is organized around a standard SPA stack: `main.ts`, router, Pinia stores, i18n, theme/styles, and feature views.
   - Most Hermes-specific UI is namespaced under `packages/client/src/components/hermes`, `views/hermes`, and `stores/hermes`, which is a clear architectural boundary for agent-related features.

4. **Frontend feature domains**
   - The UI is split into distinct panels/views for **Chat, Jobs, Models, Profiles, Skills, Usage, Logs, Memory, Settings, Terminal, and Channels**.
   - Shared layout controls like profile/model/language selectors sit in `components/layout`, while reusable chat rendering and message components live under `components/hermes/chat`.

5. **Client data access pattern**
   - The client uses a typed API layer in `packages/client/src/api/client.ts` plus feature modules for chat, sessions, logs, profiles, jobs, config, skills, and system.
   - Pinia stores in `packages/client/src/stores/hermes` act as the stateful middle layer between API calls and the views.
   - This makes the UI stateful by feature, but the authoritative state lives on the backend and in Hermes files.

6. **BFF responsibilities**
   - The server is not a generic REST backend; it is an orchestration layer that integrates Hermes CLI, Hermes Gateway, local config files, log files, file upload, and terminal sessions.
   - It also serves the built frontend assets and exposes the API surface used by the SPA.

7. **Local Hermes integration**
   - Server services under `packages/server/src/services` wrap Hermes-specific operations:
     - `hermes.ts` and `hermes-cli.ts` for agent/gateway/CLI interactions
     - `hermes-profile.ts` for profile management
     - `auth.ts` for credential/auth-related logic
   - These services are the bridge from web UI actions to the local Hermes installation and user environment.

8. **Persistent configuration and state**
   - The system reads and writes to files under `~/.hermes/`, especially:
     - `config.yaml` for channel behavior and gateway configuration
     - `auth.json` for provider credential pools and model discovery
     - `.env` for channel credentials
   - The README indicates the BFF may auto-fill missing config, back up modified config, and start/repair the gateway on startup.

9. **Platform/channel management**
   - `packages/server/src/routes/hermes` contains routes for channel/config/profiles/sessions/logs/filesystem/terminal/proxy/weixin.
   - This is where platform integrations such as Telegram, Discord, Slack, WhatsApp, Matrix, Feishu, WeChat, and WeCom are managed.
   - WeChat login is special: it involves QR-based browser login and an external Tencent iLink API path.

10. **Real-time and interactive channels**
    - Chat uses **SSE streaming** for live agent responses and async runs.
    - The terminal feature uses **node-pty** on the server and a WebSocket stream to the browser for PTY input/output and resize events.
    - These are the two main bidirectional interactive subsystems in the architecture.

11. **Analytics, logs, and operational views**
    - Usage analytics, logs, and system/status pages are driven by backend data sources rather than client-only computation.
    - Logs are read from local files and parsed for structured display; usage metrics are aggregated for charts and cost/token summaries.
    - The UI therefore acts as an operational console for Hermes rather than just a chat surface.

12. **File and extension handling**
    - The BFF also exposes upload handling, filesystem access, webhook endpoints, and a proxy layer for Hermes-related external calls.
    - This suggests the server is the central policy and access point for all side effects: file IO, credentials, session control, and external service integration.

13. **Packaging and entrypoints**
    - `bin/hermes-web-ui.mjs` is the CLI entry, with `scripts/setup.sh` supporting bootstrap/installation.
    - The app is designed to be installed and run locally as a desktop-like web dashboard, not deployed as a typical remote SaaS backend.

14. **Diagram takeaway**
    - The key boxes to draw are:
      - Browser SPA
      - Local BFF server
      - Hermes Gateway / Hermes CLI
      - Local Hermes config/auth files
      - External provider APIs and WeChat/Tencent integration
    - The most important arrows are: SPA API calls to BFF, BFF proxy/streaming to Hermes Gateway, and BFF read/write access to local Hermes state and terminal processes.

Main entry points: [`packages/server/src/routes/hermes/index.ts`](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/index.ts) (Hermes routes), [`packages/client/src/main.ts`](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/main.ts) (App shell), [`packages/client/src/views/hermes/ChatView.vue`](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/views/hermes/ChatView.vue) (Feature views), [`packages/server/src/routes/hermes/proxy.ts`](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/proxy.ts) (Proxy layer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client SPA"]
  node_client_main["App shell<br/>vue spa entry<br/>[main.ts]"]
  node_client_router["Router<br/>spa routing<br/>[index.ts]"]
  node_client_api["API layer<br/>typed client api<br/>[client.ts]"]
  node_client_store["State stores<br/>pinia stores<br/>[chat.ts]"]
  node_client_views["Feature views<br/>spa views<br/>[ChatView.vue]"]
  node_client_chat["Chat UI<br/>chat components<br/>[ChatPanel.vue]"]
  node_client_layout["Layout controls<br/>shell widgets<br/>[AppSidebar.vue]"]
  node_client_i18n["i18n/theme<br/>ui support<br/>[index.ts]"]
end

subgraph group_server["BFF Server"]
  node_server_entry["Server entry<br/>koa app entry<br/>[index.ts]"]
  node_server_routes["Hermes routes<br/>api routes<br/>[index.ts]"]
  node_server_config_routes["Config & profiles<br/>route modules<br/>[config.ts]"]
  node_server_runtime_routes["Sessions & terminal<br/>interactive routes<br/>[sessions.ts]"]
  node_server_proxy["Proxy layer<br/>stream proxy<br/>[proxy.ts]"]
  node_server_files["File access<br/>local io routes<br/>[filesystem.ts]"]
  node_server_services["Hermes services<br/>integration services<br/>[hermes.ts]"]
  node_server_auth["Auth service<br/>credential service<br/>[auth.ts]"]
end

subgraph group_runtime["Local Runtime"]
  node_runtime_gateway[("Gateway")]
  node_runtime_cli["CLI"]
  node_runtime_state["Hermes files<br/>local state"]
  node_runtime_terminal["PTY session<br/>local process"]
  node_runtime_external{{"Providers<br/>external apis"}}
end

node_client_main -->|"loads"| node_client_router
node_client_main -->|"uses"| node_client_layout
node_client_main -->|"configures"| node_client_i18n
node_client_router -->|"navigates"| node_client_views
node_client_views -->|"reads state"| node_client_store
node_client_store -->|"calls"| node_client_api
node_client_views -->|"renders"| node_client_chat
node_client_api -->|"requests"| node_server_routes
node_server_entry -->|"mounts"| node_server_routes
node_server_routes -->|"delegates"| node_server_config_routes
node_server_routes -->|"delegates"| node_server_runtime_routes
node_server_routes -->|"streams"| node_server_proxy
node_server_routes -->|"side effects"| node_server_files
node_server_config_routes -->|"uses"| node_server_services
node_server_runtime_routes -->|"controls"| node_runtime_terminal
node_server_proxy -->|"forwards to"| node_runtime_gateway
node_server_services -->|"invokes"| node_runtime_cli
node_server_services -->|"reads/writes"| node_runtime_state
node_server_auth -->|"reads/writes"| node_runtime_state
node_server_auth -->|"authenticates"| node_runtime_external
node_server_proxy -->|"connects"| node_runtime_external

click node_client_main "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/main.ts"
click node_client_router "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/router/index.ts"
click node_client_api "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/api/client.ts"
click node_client_store "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/stores/hermes/chat.ts"
click node_client_views "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/views/hermes/ChatView.vue"
click node_client_chat "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/components/hermes/chat/ChatPanel.vue"
click node_client_layout "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/components/layout/AppSidebar.vue"
click node_client_i18n "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/i18n/index.ts"
click node_server_entry "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/index.ts"
click node_server_routes "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/index.ts"
click node_server_config_routes "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/config.ts"
click node_server_runtime_routes "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/sessions.ts"
click node_server_proxy "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/proxy.ts"
click node_server_files "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/filesystem.ts"
click node_server_services "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/services/hermes.ts"
click node_server_auth "https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/services/auth.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_client_main,node_client_router,node_client_api,node_client_store,node_client_views,node_client_chat,node_client_layout,node_client_i18n toneBlue
class node_server_entry,node_server_routes,node_server_config_routes,node_server_runtime_routes,node_server_proxy,node_server_files,node_server_services,node_server_auth toneAmber
class node_runtime_gateway,node_runtime_cli,node_runtime_state,node_runtime_terminal,node_runtime_external toneMint
```

## Components

### Client SPA

Vue 3 frontend and feature state

- [App shell](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/main.ts): vue spa entry · Bootstraps the frontend app, router, i18n, theme, and layout. · `packages/client/src/main.ts`
- [Router](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/router/index.ts): spa routing · Routes the SPA into login and Hermes feature views. · `packages/client/src/router/index.ts`
- [API layer](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/api/client.ts): typed client api · Typed wrappers for browser requests into Hermes feature endpoints. · `packages/client/src/api/client.ts`
- [State stores](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/stores/hermes/chat.ts): pinia stores · Feature state for chat, jobs, models, profiles, settings, and usage. · `packages/client/src/stores/hermes/chat.ts`
- [Feature views](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/views/hermes/ChatView.vue): spa views · Main operational screens for chat, jobs, models, profiles, logs, memory, settings, terminal, channels, and usage. · `packages/client/src/views/hermes/ChatView.vue`
- [Chat UI](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/components/hermes/chat/ChatPanel.vue): chat components · Message list, input, and rendering components for live agent conversations. · `packages/client/src/components/hermes/chat/ChatPanel.vue`
- [Layout controls](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/components/layout/AppSidebar.vue): shell widgets · Sidebar and global selectors for language, profile, and model context. · `packages/client/src/components/layout/AppSidebar.vue`
- [i18n/theme](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/client/src/i18n/index.ts): ui support · Localization and visual styling for the application shell. · `packages/client/src/i18n/index.ts`

### BFF Server

Koa orchestration layer and integrations

- [Server entry](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/index.ts): koa app entry · Starts the local BFF server and serves the built frontend. · `packages/server/src/index.ts`
- [Hermes routes](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/index.ts): api routes · Main API surface for config, profiles, sessions, logs, filesystem, terminal, proxy, and Weixin. · `packages/server/src/routes/hermes/index.ts`
- [Config & profiles](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/config.ts): route modules · Reads and updates Hermes configuration and profile state. · `packages/server/src/routes/hermes/config.ts`
- [Sessions & terminal](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/sessions.ts): interactive routes · Handles chat/session control and PTY-backed terminal streaming. · `packages/server/src/routes/hermes/sessions.ts`
- [Proxy layer](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/proxy.ts): stream proxy · Rewrites and streams requests between the SPA and Hermes Gateway. · `packages/server/src/routes/hermes/proxy.ts`
- [File access](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/routes/hermes/filesystem.ts): local io routes · Filesystem, logs, upload, and webhook side effects managed by the BFF. · `packages/server/src/routes/hermes/filesystem.ts`
- [Hermes services](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/services/hermes.ts): integration services · Service layer for Hermes CLI, gateway, profile, and auth operations. · `packages/server/src/services/hermes.ts`
- [Auth service](https://github.com/ekkolearnai/hermes-web-ui/blob/main/packages/server/src/services/auth.ts): credential service · Credential and provider authentication logic used by channel and model setup. · `packages/server/src/services/auth.ts`

### Local Runtime

Hermes gateway, CLI, files, terminals, and external services

- **Gateway**: hermes gateway · Local Hermes gateway that receives proxied API and streaming calls.
- **CLI**: hermes cli · Local Hermes command-line integration used for setup and control.
- **Hermes files**: local state · Configuration and auth state under ~/.hermes such as config.yaml, auth.json, and .env.
- **PTY session**: local process · Interactive terminal processes streamed to the browser over WebSocket.
- **Providers**: external apis · Provider APIs and channel platforms including Telegram, Discord, Slack, WhatsApp, Matrix, Feishu, WeChat, WeCom, and Tencent iLink.

## Connections

- App shell → Router: loads · The app shell mounts the router and view hierarchy.
- App shell → Layout controls: uses · Global shell controls are composed into the SPA frame.
- App shell → i18n/theme: configures · Localization and theme are initialized during startup.
- Router → Feature views: navigates · Routes dispatch into Hermes feature screens.
- Feature views → State stores: reads state · Views consume Pinia state for each feature domain.
- State stores → API layer: calls · Stores mediate all feature API access.
- Feature views → Chat UI: renders · Chat views assemble message and input components.
- API layer → Hermes routes: requests · Browser calls are sent to the BFF API surface.
- Server entry → Hermes routes: mounts · The server entry wires the Hermes route tree into the Koa app.
- Hermes routes → Config & profiles: delegates · Config and profile endpoints are handled by dedicated route modules.
- Hermes routes → Sessions & terminal: delegates · Session and terminal interactions are handled by interactive route modules.
- Hermes routes → Proxy layer: streams · Proxy routes forward and rewrite requests to the local gateway.
- Hermes routes → File access: side effects · File, log, upload, and webhook endpoints access local resources.
- Config & profiles → Hermes services: uses · Route handlers rely on Hermes service wrappers.
- Sessions & terminal → PTY session: controls · The terminal route manages PTY-backed browser sessions.
- Proxy layer → Gateway: forwards to · Proxied chat and async traffic reaches the Hermes Gateway.
- Hermes services → CLI: invokes · Hermes services shell out or coordinate with the local CLI.
- Hermes services → Hermes files: reads/writes · Services manage config, auth, and profile state on disk.
- Auth service → Hermes files: reads/writes · Credential pools and model metadata are stored locally.
- Auth service → Providers: authenticates · Provider credentials are validated against external APIs and platforms.
- Proxy layer → Providers: connects · Gateway traffic ultimately reaches provider and channel integrations.
