# anlingyi/xechat-idea architecture

> Architecture diagram of the GitHub repository anlingyi/xechat-idea, 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/anlingyi/xechat-idea
- Repository: https://github.com/anlingyi/xechat-idea

## Overview

XEChat-Idea is an IntelliJ chat plugin paired with a Netty server and shared protocol models. A user connects from the plugin, logs in, then sends chat, game-room, command, or tool requests; the server handles requests and returns responses for the plugin to dispatch to UI handlers. The README also documents online games, weather, reading, and browsing. The graph preserves these product branches; several are represented at their enclosing source directories because their implementation was not sampled, so their internal wiring is intentionally omitted.

Main entry points: [`xechat-server/src/main/java/cn/xeblog/server/action/handler`](https://github.com/anlingyi/xechat-idea/tree/main/xechat-server/src/main/java/cn/xeblog/server/action/handler) (Action Handlers), [`xechat-plugin/src/main/java/cn/xeblog/plugin/handler/XEChatClientHandler.java`](https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/handler/XEChatClientHandler.java) (Client Handler), [`xechat-server/src/main/java/cn/xeblog/server/handler/RequestHandler.java`](https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/handler/RequestHandler.java) (Request Handling), [`xechat-plugin/src/main/java/cn/xeblog/plugin/client/XEChatClient.java`](https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/client/XEChatClient.java) (Chat Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["IDE Plugin"]
  node_client["Chat Client<br/>[XEChatClient.java]"]
  node_client_handler["Client Handler"]
  node_response_handler["Response Dispatch"]
  node_actions["User Actions"]
  node_chat_ui["Chat UI<br/>[MainWindow.java]"]
  node_persistence["Plugin State"]
end

subgraph group_server["Chat Server"]
  node_server["Chat Server<br/>[XEChatServer.java]"]
  node_server_channels["Network Channels"]
  node_request_handler["Request Handling"]
  node_action_handlers["Action Handlers"]
  node_user_cache["Online Users<br/>[UserCache.java]"]
  node_room_cache["Game Rooms<br/>[GameRoomCache.java]"]
  node_history["Response History"]
end

subgraph group_shared["Shared Protocol"]
  node_protocol["Messages &amp; DTOs"]
end

subgraph group_features["Product Features"]
  node_games["Games &amp; Rooms"]
  node_game_protocol["Game Messages"]
  node_weather["Weather Lookup"]
  node_reading["Reading Tool"]
  node_browser["Embedded Browser"]
  node_react["Server Reactions"]
end

node_user(("IDE User"))

node_user -->|"uses"| node_chat_ui
node_client -->|"configures"| node_client_handler
node_client_handler -->|"WebSocket traffic"| node_server_channels
node_server -->|"starts"| node_server_channels
node_server_channels -->|"dispatches requests"| node_request_handler
node_request_handler -->|"routes actions"| node_action_handlers
node_client_handler -->|"dispatches responses"| node_response_handler
node_response_handler -->|"updates UI"| node_chat_ui
node_actions -->|"sends requests"| node_client
node_client_handler -->|"exchanges messages"| node_protocol
node_request_handler -->|"reads messages"| node_protocol
node_action_handlers -->|"builds responses"| node_protocol
node_action_handlers -->|"tracks users"| node_user_cache
node_action_handlers -->|"manages rooms"| node_room_cache
node_action_handlers -->|"records responses"| node_history
node_actions -->|"starts play"| node_games
node_games -->|"sends room requests"| node_game_protocol
node_action_handlers -->|"handles weather requests"| node_weather
node_user -->|"uses"| node_reading
node_user -->|"uses"| node_browser
node_user -->|"requests reactions"| node_react
node_persistence -->|"restores state"| node_client

click node_client "https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/client/XEChatClient.java"
click node_client_handler "https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/handler/XEChatClientHandler.java"
click node_response_handler "https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/handler/ResponseHandler.java"
click node_actions "https://github.com/anlingyi/xechat-idea/tree/main/xechat-plugin/src/main/java/cn/xeblog/plugin/action"
click node_chat_ui "https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/ui/MainWindow.java"
click node_persistence "https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/persistence/PersistenceService.java"
click node_server "https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/XEChatServer.java"
click node_server_channels "https://github.com/anlingyi/xechat-idea/tree/main/xechat-server/src/main/java/cn/xeblog/server/handler"
click node_request_handler "https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/handler/RequestHandler.java"
click node_action_handlers "https://github.com/anlingyi/xechat-idea/tree/main/xechat-server/src/main/java/cn/xeblog/server/action/handler"
click node_user_cache "https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/cache/UserCache.java"
click node_room_cache "https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/cache/GameRoomCache.java"
click node_history "https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/service/DefaultResponseHistoryService.java"
click node_protocol "https://github.com/anlingyi/xechat-idea/tree/main/xechat-commons/src/main/java/cn/xeblog/commons/entity"
click node_games "https://github.com/anlingyi/xechat-idea/tree/main/xechat-plugin/src/main/java/cn/xeblog/plugin/game"
click node_game_protocol "https://github.com/anlingyi/xechat-idea/tree/main/xechat-commons/src/main/java/cn/xeblog/commons/entity/game"
click node_weather "https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/service/WeatherService.java"
click node_reading "https://github.com/anlingyi/xechat-idea/tree/main/xechat-plugin/src/main/java/cn/xeblog/plugin/tools/read"
click node_browser "https://github.com/anlingyi/xechat-idea/tree/main/xechat-plugin/src/main/java/cn/xeblog/plugin/tools/browser"
click node_react "https://github.com/anlingyi/xechat-idea/tree/main/xechat-server/src/main/java/cn/xeblog/server/action/handler/react"

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,node_client_handler,node_response_handler,node_actions,node_chat_ui,node_persistence,node_user toneBlue
class node_server,node_server_channels,node_request_handler,node_action_handlers,node_user_cache,node_room_cache,node_history toneAmber
class node_protocol toneMint
class node_games,node_game_protocol,node_weather,node_reading,node_browser,node_react toneRose
```

## Components

### IDE Plugin

- [Chat Client](https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/client/XEChatClient.java): `xechat-plugin/src/main/java/cn/xeblog/plugin/client/XEChatClient.java`
- [Client Handler](https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/handler/XEChatClientHandler.java): `xechat-plugin/src/main/java/cn/xeblog/plugin/handler/XEChatClientHandler.java`
- [Response Dispatch](https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/handler/ResponseHandler.java): `xechat-plugin/src/main/java/cn/xeblog/plugin/handler/ResponseHandler.java`
- [User Actions](https://github.com/anlingyi/xechat-idea/tree/main/xechat-plugin/src/main/java/cn/xeblog/plugin/action): `xechat-plugin/src/main/java/cn/xeblog/plugin/action`
- [Chat UI](https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/ui/MainWindow.java): `xechat-plugin/src/main/java/cn/xeblog/plugin/ui/MainWindow.java`
- [Plugin State](https://github.com/anlingyi/xechat-idea/blob/main/xechat-plugin/src/main/java/cn/xeblog/plugin/persistence/PersistenceService.java): `xechat-plugin/src/main/java/cn/xeblog/plugin/persistence/PersistenceService.java`

### Chat Server

- [Chat Server](https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/XEChatServer.java): `xechat-server/src/main/java/cn/xeblog/server/XEChatServer.java`
- [Network Channels](https://github.com/anlingyi/xechat-idea/tree/main/xechat-server/src/main/java/cn/xeblog/server/handler): `xechat-server/src/main/java/cn/xeblog/server/handler`
- [Request Handling](https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/handler/RequestHandler.java): `xechat-server/src/main/java/cn/xeblog/server/handler/RequestHandler.java`
- [Action Handlers](https://github.com/anlingyi/xechat-idea/tree/main/xechat-server/src/main/java/cn/xeblog/server/action/handler): `xechat-server/src/main/java/cn/xeblog/server/action/handler`
- [Online Users](https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/cache/UserCache.java): `xechat-server/src/main/java/cn/xeblog/server/cache/UserCache.java`
- [Game Rooms](https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/cache/GameRoomCache.java): `xechat-server/src/main/java/cn/xeblog/server/cache/GameRoomCache.java`
- [Response History](https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/service/DefaultResponseHistoryService.java): `xechat-server/src/main/java/cn/xeblog/server/service/DefaultResponseHistoryService.java`

### Shared Protocol

- [Messages & DTOs](https://github.com/anlingyi/xechat-idea/tree/main/xechat-commons/src/main/java/cn/xeblog/commons/entity): `xechat-commons/src/main/java/cn/xeblog/commons/entity`

### Product Features

- [Games & Rooms](https://github.com/anlingyi/xechat-idea/tree/main/xechat-plugin/src/main/java/cn/xeblog/plugin/game): `xechat-plugin/src/main/java/cn/xeblog/plugin/game`
- [Game Messages](https://github.com/anlingyi/xechat-idea/tree/main/xechat-commons/src/main/java/cn/xeblog/commons/entity/game): `xechat-commons/src/main/java/cn/xeblog/commons/entity/game`
- [Weather Lookup](https://github.com/anlingyi/xechat-idea/blob/main/xechat-server/src/main/java/cn/xeblog/server/service/WeatherService.java): `xechat-server/src/main/java/cn/xeblog/server/service/WeatherService.java`
- [Reading Tool](https://github.com/anlingyi/xechat-idea/tree/main/xechat-plugin/src/main/java/cn/xeblog/plugin/tools/read): `xechat-plugin/src/main/java/cn/xeblog/plugin/tools/read`
- [Embedded Browser](https://github.com/anlingyi/xechat-idea/tree/main/xechat-plugin/src/main/java/cn/xeblog/plugin/tools/browser): `xechat-plugin/src/main/java/cn/xeblog/plugin/tools/browser`
- [Server Reactions](https://github.com/anlingyi/xechat-idea/tree/main/xechat-server/src/main/java/cn/xeblog/server/action/handler/react): `xechat-server/src/main/java/cn/xeblog/server/action/handler/react`

### Other components

- **IDE User**

## Connections

- IDE User → Chat UI: uses
- Chat Client → Client Handler: configures
- Client Handler → Network Channels: WebSocket traffic
- Chat Server → Network Channels: starts
- Network Channels → Request Handling: dispatches requests
- Request Handling → Action Handlers: routes actions
- Client Handler → Response Dispatch: dispatches responses
- Response Dispatch → Chat UI: updates UI
- User Actions → Chat Client: sends requests
- Client Handler → Messages & DTOs: exchanges messages
- Request Handling → Messages & DTOs: reads messages
- Action Handlers → Messages & DTOs: builds responses
- Action Handlers → Online Users: tracks users
- Action Handlers → Game Rooms: manages rooms
- Action Handlers → Response History: records responses
- User Actions → Games & Rooms: starts play
- Games & Rooms → Game Messages: sends room requests
- Action Handlers → Weather Lookup: handles weather requests
- IDE User → Reading Tool: uses
- IDE User → Embedded Browser: uses
- IDE User → Server Reactions: requests reactions
- Plugin State → Chat Client: restores state
