# assanfakou/ft_irc architecture

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

- Interactive diagram: https://gitdiagram.com/assanfakou/ft_irc
- Repository: https://github.com/assanfakou/ft_irc

## Overview

ft_irc is a C++98 IRC server for standard IRC clients. A client connects over TCP, registers with a password and identity, then uses IRC commands for private messaging and channel membership, messaging, and moderation; the server returns protocol replies. The main runtime uses a poll-based server loop and stores client and channel state. The tree and excerpts support the server entry point, client state, protocol types, reply generation, command implementations, and a separate IRC bot client. Some internal dispatch links are dashed because their implementation was not shown.

Main entry points: [`src/Server.cpp`](https://github.com/assanfakou/ft_irc/blob/main/src/Server.cpp) (Poll server), [`src/bot/botClient.cpp`](https://github.com/assanfakou/ft_irc/blob/main/src/bot/botClient.cpp) (Bot connection), [`src/Parser.cpp`](https://github.com/assanfakou/ft_irc/blob/main/src/Parser.cpp) (Command parser), [`src/main.cpp`](https://github.com/assanfakou/ft_irc/blob/main/src/main.cpp) (Server entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server runtime"]
  node_entry["Server entry<br/>[main.cpp]"]
  node_server["Poll server<br/>[Server.cpp]"]
end

subgraph group_protocol["Protocol state"]
  node_client_state["Client state<br/>[Client.cpp]"]
  node_message["IRC message<br/>[Message.cpp]"]
  node_parser["Command parser<br/>[Parser.cpp]"]
  node_channel_state["Channel state<br/>[Channel.cpp]"]
  node_replies["Protocol replies<br/>[Reply.cpp]"]
end

subgraph group_commands["IRC commands"]
  node_registration["Registration<br/>[PASS.cpp]"]
  node_identity["User identity<br/>[USER.cpp]"]
  node_nickname["Nickname changes<br/>[NICK.cpp]"]
  node_join["Join channels<br/>[JOIN.cpp]"]
  node_part["Leave channels<br/>[PART.cpp]"]
  node_messaging["Private and channel messaging<br/>[MsgCommands.cpp]"]
  node_invite["Invite users<br/>[INVITE.cpp]"]
  node_kick["Remove members<br/>[KICK.cpp]"]
  node_topic["Channel topics<br/>[TOPIC.cpp]"]
  node_modes["Channel modes<br/>[MODE.cpp]"]
  node_listing["Channel listing<br/>[LIST.cpp]"]
end

subgraph group_bot["Bot client"]
  node_bot_client["Bot connection<br/>[botClient.cpp]"]
  node_bot_logic["Bot commands<br/>[bot.cpp]"]
end

node_irc_client(("IRC client"))

node_irc_client -->|"sends IRC commands"| node_server
node_entry -->|"starts"| node_server
node_server -->|"sends replies"| node_irc_client
node_server -.->|"parses input"| node_parser
node_parser -.->|"creates messages"| node_message
node_server -.->|"tracks clients"| node_client_state
node_server -.->|"tracks channels"| node_channel_state
node_server -.->|"formats responses"| node_replies
node_server -.->|"dispatches registration"| node_registration
node_server -.->|"dispatches registration"| node_identity
node_server -.->|"dispatches commands"| node_nickname
node_server -.->|"dispatches commands"| node_join
node_server -.->|"dispatches commands"| node_part
node_server -.->|"dispatches commands"| node_messaging
node_server -.->|"dispatches commands"| node_invite
node_server -.->|"dispatches commands"| node_kick
node_server -.->|"dispatches commands"| node_topic
node_server -.->|"dispatches commands"| node_modes
node_server -.->|"dispatches commands"| node_listing
node_bot_client -->|"connects to server"| node_irc_client
node_bot_client -.->|"handles received commands"| node_bot_logic

click node_entry "https://github.com/assanfakou/ft_irc/blob/main/src/main.cpp"
click node_server "https://github.com/assanfakou/ft_irc/blob/main/src/Server.cpp"
click node_client_state "https://github.com/assanfakou/ft_irc/blob/main/src/Client.cpp"
click node_message "https://github.com/assanfakou/ft_irc/blob/main/src/Message.cpp"
click node_parser "https://github.com/assanfakou/ft_irc/blob/main/src/Parser.cpp"
click node_channel_state "https://github.com/assanfakou/ft_irc/blob/main/src/Channel.cpp"
click node_replies "https://github.com/assanfakou/ft_irc/blob/main/src/Reply.cpp"
click node_registration "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/PASS.cpp"
click node_identity "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/USER.cpp"
click node_nickname "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/NICK.cpp"
click node_join "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/JOIN.cpp"
click node_part "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/PART.cpp"
click node_messaging "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/MsgCommands.cpp"
click node_invite "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/INVITE.cpp"
click node_kick "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/KICK.cpp"
click node_topic "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/TOPIC.cpp"
click node_modes "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/MODE.cpp"
click node_listing "https://github.com/assanfakou/ft_irc/blob/main/src/cmds/LIST.cpp"
click node_bot_client "https://github.com/assanfakou/ft_irc/blob/main/src/bot/botClient.cpp"
click node_bot_logic "https://github.com/assanfakou/ft_irc/blob/main/src/bot/bot.cpp"

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_entry,node_server,node_irc_client toneBlue
class node_client_state,node_message,node_parser,node_channel_state,node_replies toneAmber
class node_registration,node_identity,node_nickname,node_join,node_part,node_messaging,node_invite,node_kick,node_topic,node_modes,node_listing toneMint
class node_bot_client,node_bot_logic toneRose
```

## Components

### Server runtime

- [Server entry](https://github.com/assanfakou/ft_irc/blob/main/src/main.cpp): `src/main.cpp`
- [Poll server](https://github.com/assanfakou/ft_irc/blob/main/src/Server.cpp): `src/Server.cpp`

### Protocol state

- [Client state](https://github.com/assanfakou/ft_irc/blob/main/src/Client.cpp): `src/Client.cpp`
- [IRC message](https://github.com/assanfakou/ft_irc/blob/main/src/Message.cpp): `src/Message.cpp`
- [Command parser](https://github.com/assanfakou/ft_irc/blob/main/src/Parser.cpp): `src/Parser.cpp`
- [Channel state](https://github.com/assanfakou/ft_irc/blob/main/src/Channel.cpp): `src/Channel.cpp`
- [Protocol replies](https://github.com/assanfakou/ft_irc/blob/main/src/Reply.cpp): `src/Reply.cpp`

### IRC commands

- [Registration](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/PASS.cpp): `src/cmds/PASS.cpp`
- [User identity](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/USER.cpp): `src/cmds/USER.cpp`
- [Nickname changes](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/NICK.cpp): `src/cmds/NICK.cpp`
- [Join channels](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/JOIN.cpp): `src/cmds/JOIN.cpp`
- [Leave channels](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/PART.cpp): `src/cmds/PART.cpp`
- [Private and channel messaging](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/MsgCommands.cpp): `src/cmds/MsgCommands.cpp`
- [Invite users](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/INVITE.cpp): `src/cmds/INVITE.cpp`
- [Remove members](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/KICK.cpp): `src/cmds/KICK.cpp`
- [Channel topics](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/TOPIC.cpp): `src/cmds/TOPIC.cpp`
- [Channel modes](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/MODE.cpp): `src/cmds/MODE.cpp`
- [Channel listing](https://github.com/assanfakou/ft_irc/blob/main/src/cmds/LIST.cpp): `src/cmds/LIST.cpp`

### Bot client

- [Bot connection](https://github.com/assanfakou/ft_irc/blob/main/src/bot/botClient.cpp): `src/bot/botClient.cpp`
- [Bot commands](https://github.com/assanfakou/ft_irc/blob/main/src/bot/bot.cpp): `src/bot/bot.cpp`

### Other components

- **IRC client**

## Connections

- IRC client → Poll server: sends IRC commands (evidence: `README.md`)
- Server entry → Poll server: starts (evidence: `src/main.cpp`)
- Poll server → IRC client: sends replies (evidence: `README.md`)
- Poll server → Command parser: parses input
- Command parser → IRC message: creates messages
- Poll server → Client state: tracks clients
- Poll server → Channel state: tracks channels
- Poll server → Protocol replies: formats responses
- Poll server → Registration: dispatches registration
- Poll server → User identity: dispatches registration
- Poll server → Nickname changes: dispatches commands
- Poll server → Join channels: dispatches commands
- Poll server → Leave channels: dispatches commands
- Poll server → Private and channel messaging: dispatches commands
- Poll server → Invite users: dispatches commands
- Poll server → Remove members: dispatches commands
- Poll server → Channel topics: dispatches commands
- Poll server → Channel modes: dispatches commands
- Poll server → Channel listing: dispatches commands
- Bot connection → IRC client: connects to server (evidence: `src/bot/botClient.cpp`)
- Bot connection → Bot commands: handles received commands
