# pajlada/chatterino2 architecture

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

- Interactive diagram: https://gitdiagram.com/pajlada/chatterino2
- Repository: https://github.com/pajlada/chatterino2

## Overview

Chatterino 2 is a desktop Twitch chat client. The principal workflow is to open a chat view, receive Twitch chat or event data, turn it into messages, and present it to the user; commands and moderation are additional interaction paths. The source index and excerpts show application wiring, command execution, PubSub handling, and window management. Message parsing and rendering links are shown as unverified because their implementation excerpts were not provided.

Main entry points: [`src/Application.cpp`](https://github.com/pajlada/chatterino2/blob/master/src/Application.cpp) (Application), [`src/singletons/WindowManager.cpp`](https://github.com/pajlada/chatterino2/blob/master/src/singletons/WindowManager.cpp) (Window manager), [`src/controllers/commands/CommandController.cpp`](https://github.com/pajlada/chatterino2/blob/master/src/controllers/commands/CommandController.cpp) (Commands), [`src/messages/Message.cpp`](https://github.com/pajlada/chatterino2/blob/master/src/messages/Message.cpp) (Chat messages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_appcore["Application<br/>[Application.cpp]"]
  node_window["Window manager<br/>[WindowManager.cpp]"]
end

subgraph group_chat["Chat Experience"]
  node_channel["Channel state<br/>[Channel.cpp]"]
  node_message_builder["Message builder<br/>[MessageBuilder.cpp]"]
  node_message["Chat messages<br/>[Message.cpp]"]
  node_layout["Message layout<br/>[MessageLayout.cpp]"]
end

subgraph group_twitch["Twitch Integration"]
  node_irc["Twitch IRC<br/>[TwitchIrc.cpp]"]
  node_irc_handler["IRC messages"]
  node_pubsub["Twitch PubSub<br/>[PubSubManager.cpp]"]
  node_eventsub["Twitch EventSub<br/>[Controller.cpp]"]
  node_helix["Helix API<br/>[Helix.cpp]"]
end

subgraph group_features["Client Features"]
  node_accounts["Accounts"]
  node_commands["Commands"]
  node_highlights["Highlights"]
  node_ignores["Ignore rules"]
  node_notifications["Notifications"]
  node_plugins["Lua plugins"]
end

subgraph group_platform["Shared Services"]
  node_network["Network manager<br/>[NetworkManager.cpp]"]
  node_settings["Settings<br/>[Settings.hpp]"]
  node_paths["Application paths<br/>[Paths.hpp]"]
end

node_user(("Chat user"))
node_twitch_service{{"Twitch services"}}

node_user -.->|"opens chat"| node_window
node_appcore -->|"creates"| node_accounts
node_appcore -->|"creates"| node_commands
node_appcore -->|"creates"| node_notifications
node_appcore -->|"creates"| node_highlights
node_appcore -->|"initializes"| node_pubsub
node_appcore -.->|"initializes"| node_eventsub
node_appcore -.->|"manages"| node_window
node_window -->|"reads"| node_settings
node_window -->|"lays out"| node_channel
node_channel -.->|"connects"| node_irc
node_irc -.->|"dispatches"| node_irc_handler
node_irc_handler -.->|"builds"| node_message_builder
node_message_builder -.->|"constructs"| node_message
node_message -.->|"renders"| node_layout
node_commands -->|"uses"| node_accounts
node_commands -->|"executes for"| node_channel
node_highlights -->|"evaluates"| node_message
node_notifications -->|"handles"| node_message
node_notifications -->|"queries"| node_helix
node_plugins -->|"registers commands"| node_commands
node_plugins -->|"uses"| node_network
node_pubsub -->|"tracks account"| node_accounts
node_pubsub -.->|"receives events"| node_twitch_service
node_eventsub -->|"requests subscriptions"| node_helix
node_eventsub -.->|"receives events"| node_twitch_service
node_helix -.->|"uses"| node_network
node_accounts -.->|"persists configuration"| node_settings
node_appcore -.->|"configures services"| node_paths

click node_appcore "https://github.com/pajlada/chatterino2/blob/master/src/Application.cpp"
click node_window "https://github.com/pajlada/chatterino2/blob/master/src/singletons/WindowManager.cpp"
click node_channel "https://github.com/pajlada/chatterino2/blob/master/src/common/Channel.cpp"
click node_irc "https://github.com/pajlada/chatterino2/blob/master/src/providers/twitch/TwitchIrc.cpp"
click node_irc_handler "https://github.com/pajlada/chatterino2/blob/master/src/providers/twitch/IrcMessageHandler.cpp"
click node_message_builder "https://github.com/pajlada/chatterino2/blob/master/src/messages/MessageBuilder.cpp"
click node_message "https://github.com/pajlada/chatterino2/blob/master/src/messages/Message.cpp"
click node_layout "https://github.com/pajlada/chatterino2/blob/master/src/messages/layouts/MessageLayout.cpp"
click node_accounts "https://github.com/pajlada/chatterino2/blob/master/src/controllers/accounts/AccountController.cpp"
click node_commands "https://github.com/pajlada/chatterino2/blob/master/src/controllers/commands/CommandController.cpp"
click node_highlights "https://github.com/pajlada/chatterino2/blob/master/src/controllers/highlights/HighlightController.cpp"
click node_ignores "https://github.com/pajlada/chatterino2/blob/master/src/controllers/ignores/IgnoreController.cpp"
click node_notifications "https://github.com/pajlada/chatterino2/blob/master/src/controllers/notifications/NotificationController.cpp"
click node_plugins "https://github.com/pajlada/chatterino2/blob/master/src/controllers/plugins/PluginController.cpp"
click node_pubsub "https://github.com/pajlada/chatterino2/blob/master/src/providers/twitch/PubSubManager.cpp"
click node_eventsub "https://github.com/pajlada/chatterino2/blob/master/src/providers/twitch/eventsub/Controller.cpp"
click node_helix "https://github.com/pajlada/chatterino2/blob/master/src/providers/twitch/api/Helix.cpp"
click node_network "https://github.com/pajlada/chatterino2/blob/master/src/common/network/NetworkManager.cpp"
click node_settings "https://github.com/pajlada/chatterino2/blob/master/src/singletons/Settings.hpp"
click node_paths "https://github.com/pajlada/chatterino2/blob/master/src/singletons/Paths.hpp"

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_appcore,node_window,node_user toneBlue
class node_channel,node_message_builder,node_message,node_layout toneAmber
class node_irc,node_irc_handler,node_pubsub,node_eventsub,node_helix toneMint
class node_accounts,node_commands,node_highlights,node_ignores,node_notifications,node_plugins toneRose
class node_network,node_settings,node_paths,node_twitch_service toneIndigo
```

## Components

### Application

- [Application](https://github.com/pajlada/chatterino2/blob/master/src/Application.cpp): `src/Application.cpp`
- [Window manager](https://github.com/pajlada/chatterino2/blob/master/src/singletons/WindowManager.cpp): `src/singletons/WindowManager.cpp`

### Chat Experience

- [Channel state](https://github.com/pajlada/chatterino2/blob/master/src/common/Channel.cpp): `src/common/Channel.cpp`
- [Message builder](https://github.com/pajlada/chatterino2/blob/master/src/messages/MessageBuilder.cpp): `src/messages/MessageBuilder.cpp`
- [Chat messages](https://github.com/pajlada/chatterino2/blob/master/src/messages/Message.cpp): `src/messages/Message.cpp`
- [Message layout](https://github.com/pajlada/chatterino2/blob/master/src/messages/layouts/MessageLayout.cpp): `src/messages/layouts/MessageLayout.cpp`

### Twitch Integration

- [Twitch IRC](https://github.com/pajlada/chatterino2/blob/master/src/providers/twitch/TwitchIrc.cpp): `src/providers/twitch/TwitchIrc.cpp`
- [IRC messages](https://github.com/pajlada/chatterino2/blob/master/src/providers/twitch/IrcMessageHandler.cpp): `src/providers/twitch/IrcMessageHandler.cpp`
- [Twitch PubSub](https://github.com/pajlada/chatterino2/blob/master/src/providers/twitch/PubSubManager.cpp): `src/providers/twitch/PubSubManager.cpp`
- [Twitch EventSub](https://github.com/pajlada/chatterino2/blob/master/src/providers/twitch/eventsub/Controller.cpp): `src/providers/twitch/eventsub/Controller.cpp`
- [Helix API](https://github.com/pajlada/chatterino2/blob/master/src/providers/twitch/api/Helix.cpp): `src/providers/twitch/api/Helix.cpp`

### Client Features

- [Accounts](https://github.com/pajlada/chatterino2/blob/master/src/controllers/accounts/AccountController.cpp): `src/controllers/accounts/AccountController.cpp`
- [Commands](https://github.com/pajlada/chatterino2/blob/master/src/controllers/commands/CommandController.cpp): `src/controllers/commands/CommandController.cpp`
- [Highlights](https://github.com/pajlada/chatterino2/blob/master/src/controllers/highlights/HighlightController.cpp): `src/controllers/highlights/HighlightController.cpp`
- [Ignore rules](https://github.com/pajlada/chatterino2/blob/master/src/controllers/ignores/IgnoreController.cpp): `src/controllers/ignores/IgnoreController.cpp`
- [Notifications](https://github.com/pajlada/chatterino2/blob/master/src/controllers/notifications/NotificationController.cpp): `src/controllers/notifications/NotificationController.cpp`
- [Lua plugins](https://github.com/pajlada/chatterino2/blob/master/src/controllers/plugins/PluginController.cpp): `src/controllers/plugins/PluginController.cpp`

### Shared Services

- [Network manager](https://github.com/pajlada/chatterino2/blob/master/src/common/network/NetworkManager.cpp): `src/common/network/NetworkManager.cpp`
- [Settings](https://github.com/pajlada/chatterino2/blob/master/src/singletons/Settings.hpp): `src/singletons/Settings.hpp`
- [Application paths](https://github.com/pajlada/chatterino2/blob/master/src/singletons/Paths.hpp): `src/singletons/Paths.hpp`

### Other components

- **Chat user**
- **Twitch services**

## Connections

- Chat user → Window manager: opens chat (evidence: `README.md`)
- Application → Accounts: creates (evidence: `src/Application.cpp`)
- Application → Commands: creates (evidence: `src/Application.cpp`)
- Application → Notifications: creates (evidence: `src/Application.cpp`)
- Application → Highlights: creates (evidence: `src/Application.cpp`)
- Application → Twitch PubSub: initializes (evidence: `src/Application.cpp`)
- Application → Twitch EventSub: initializes (evidence: `src/Application.cpp`)
- Application → Window manager: manages (evidence: `src/Application.cpp`)
- Window manager → Settings: reads (evidence: `src/singletons/WindowManager.cpp`)
- Window manager → Channel state: lays out (evidence: `src/singletons/WindowManager.cpp`)
- Channel state → Twitch IRC: connects
- Twitch IRC → IRC messages: dispatches
- IRC messages → Message builder: builds
- Message builder → Chat messages: constructs
- Chat messages → Message layout: renders
- Commands → Accounts: uses (evidence: `src/controllers/commands/CommandController.cpp`)
- Commands → Channel state: executes for (evidence: `src/controllers/commands/CommandController.cpp`)
- Highlights → Chat messages: evaluates (evidence: `src/controllers/highlights/HighlightController.cpp`)
- Notifications → Chat messages: handles (evidence: `src/controllers/notifications/NotificationController.cpp`)
- Notifications → Helix API: queries (evidence: `src/controllers/notifications/NotificationController.cpp`)
- Lua plugins → Commands: registers commands (evidence: `src/controllers/plugins/PluginController.cpp`)
- Lua plugins → Network manager: uses (evidence: `src/controllers/plugins/PluginController.cpp`)
- Twitch PubSub → Accounts: tracks account (evidence: `src/providers/twitch/PubSubManager.cpp`)
- Twitch PubSub → Twitch services: receives events
- Twitch EventSub → Helix API: requests subscriptions (evidence: `src/providers/twitch/eventsub/Controller.cpp`)
- Twitch EventSub → Twitch services: receives events
- Helix API → Network manager: uses
- Accounts → Settings: persists configuration
- Application → Application paths: configures services
