# fbkeskin/42-ft_irc architecture

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

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

## Overview

ft_irc is a multi-client TCP IRC server. A client connects, registers with PASS/NICK/USER, then issues channel and messaging commands; the server parses and dispatches requests, maintains client/channel state, and sends protocol replies. The graph covers README-documented command capabilities as well as sampled networking and state layers. Some command implementations and server sections were not excerpted, so documented but unsampled links are dashed and evidence limits are noted.

Main entry points: [`sources/Server.cpp`](https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Server.cpp) (Command Dispatch), [`libs/Server.hpp`](https://github.com/fbkeskin/42-ft_irc/blob/master/libs/Server.hpp) (Active Channels), [`commands/join.cpp`](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/join.cpp) (Channel Join), [`commands/who.cpp`](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/who.cpp) (WHO Lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server Runtime"]
  node_entry["Startup Validation<br/>[main.cpp]"]
  node_server["Socket Polling<br/>[Server.cpp]"]
  node_dispatch["Command Dispatch<br/>[Server.cpp]"]
end

subgraph group_protocol["Protocol Commands"]
  node_auth["Registration<br/>[pass.cpp]"]
  node_identity["Nick and User<br/>[nick.cpp]"]
  node_join["Channel Join<br/>[join.cpp]"]
  node_messaging["Private Messaging<br/>[privmsg.cpp]"]
  node_membership["Part and Quit<br/>[part.cpp]"]
  node_channel_admin["Channel Operations<br/>[mode.cpp]"]
  node_invite["Invitations<br/>[invite.cpp]"]
  node_kick["Kick Members<br/>[kick.cpp]"]
  node_topic["Topic Management<br/>[topic.cpp]"]
  node_who["WHO Lookup<br/>[who.cpp]"]
end

subgraph group_state["IRC State"]
  node_client_state["Client Session State<br/>[Client.cpp]"]
  node_channel_state["Channel State<br/>[Channel.cpp]"]
  node_client_store[("Connected Clients<br/>[Server.hpp]")]
  node_channel_store[("Active Channels<br/>[Server.hpp]")]
end

subgraph group_model["Domain Models"]
  node_parser["Message Parsing<br/>[Message.cpp]"]
end

node_user(("IRC Client"))

node_user -->|"starts with credentials"| node_entry
node_entry -->|"configures and runs"| node_server
node_user -->|"sends IRC lines"| node_server
node_server -.->|"parses received lines"| node_parser
node_server -->|"creates sessions"| node_client_state
node_server -->|"dispatches commands"| node_dispatch
node_dispatch -.->|"routes PASS"| node_auth
node_dispatch -->|"routes NICK USER"| node_identity
node_dispatch -->|"routes JOIN"| node_join
node_dispatch -->|"routes PRIVMSG"| node_messaging
node_dispatch -->|"routes PART QUIT"| node_membership
node_dispatch -->|"routes MODE"| node_channel_admin
node_dispatch -->|"routes INVITE"| node_invite
node_dispatch -->|"routes KICK"| node_kick
node_dispatch -->|"routes TOPIC"| node_topic
node_dispatch -.->|"routes WHO"| node_who
node_server -->|"stores sessions"| node_client_store
node_server -->|"stores channels"| node_channel_store
node_join -->|"creates and updates"| node_channel_store
node_join -->|"uses membership state"| node_channel_state
node_channel_admin -->|"changes channel modes"| node_channel_state
node_identity -->|"updates identity"| node_client_state
node_who -->|"looks up clients"| node_client_store
node_who -->|"looks up channels"| node_channel_store
node_messaging -.->|"sends channel messages"| node_channel_store
node_server -.->|"sends protocol replies"| node_user

click node_entry "https://github.com/fbkeskin/42-ft_irc/blob/master/sources/main.cpp"
click node_server "https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Server.cpp"
click node_parser "https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Message.cpp"
click node_dispatch "https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Server.cpp"
click node_auth "https://github.com/fbkeskin/42-ft_irc/blob/master/commands/pass.cpp"
click node_identity "https://github.com/fbkeskin/42-ft_irc/blob/master/commands/nick.cpp"
click node_join "https://github.com/fbkeskin/42-ft_irc/blob/master/commands/join.cpp"
click node_messaging "https://github.com/fbkeskin/42-ft_irc/blob/master/commands/privmsg.cpp"
click node_membership "https://github.com/fbkeskin/42-ft_irc/blob/master/commands/part.cpp"
click node_channel_admin "https://github.com/fbkeskin/42-ft_irc/blob/master/commands/mode.cpp"
click node_invite "https://github.com/fbkeskin/42-ft_irc/blob/master/commands/invite.cpp"
click node_kick "https://github.com/fbkeskin/42-ft_irc/blob/master/commands/kick.cpp"
click node_topic "https://github.com/fbkeskin/42-ft_irc/blob/master/commands/topic.cpp"
click node_who "https://github.com/fbkeskin/42-ft_irc/blob/master/commands/who.cpp"
click node_client_state "https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Client.cpp"
click node_channel_state "https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Channel.cpp"
click node_client_store "https://github.com/fbkeskin/42-ft_irc/blob/master/libs/Server.hpp"
click node_channel_store "https://github.com/fbkeskin/42-ft_irc/blob/master/libs/Server.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_entry,node_server,node_dispatch,node_user toneBlue
class node_auth,node_identity,node_join,node_messaging,node_membership,node_channel_admin,node_invite,node_kick,node_topic,node_who toneAmber
class node_client_state,node_channel_state,node_client_store,node_channel_store toneMint
class node_parser toneRose
```

## Components

### Server Runtime

- [Startup Validation](https://github.com/fbkeskin/42-ft_irc/blob/master/sources/main.cpp): `sources/main.cpp`
- [Socket Polling](https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Server.cpp): `sources/Server.cpp`
- [Command Dispatch](https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Server.cpp): `sources/Server.cpp`

### Protocol Commands

- [Registration](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/pass.cpp): `commands/pass.cpp`
- [Nick and User](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/nick.cpp): `commands/nick.cpp`
- [Channel Join](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/join.cpp): `commands/join.cpp`
- [Private Messaging](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/privmsg.cpp): `commands/privmsg.cpp`
- [Part and Quit](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/part.cpp): `commands/part.cpp`
- [Channel Operations](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/mode.cpp): `commands/mode.cpp`
- [Invitations](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/invite.cpp): `commands/invite.cpp`
- [Kick Members](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/kick.cpp): `commands/kick.cpp`
- [Topic Management](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/topic.cpp): `commands/topic.cpp`
- [WHO Lookup](https://github.com/fbkeskin/42-ft_irc/blob/master/commands/who.cpp): `commands/who.cpp`

### IRC State

- [Client Session State](https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Client.cpp): `sources/Client.cpp`
- [Channel State](https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Channel.cpp): `sources/Channel.cpp`
- [Connected Clients](https://github.com/fbkeskin/42-ft_irc/blob/master/libs/Server.hpp): `libs/Server.hpp`
- [Active Channels](https://github.com/fbkeskin/42-ft_irc/blob/master/libs/Server.hpp): `libs/Server.hpp`

### Domain Models

- [Message Parsing](https://github.com/fbkeskin/42-ft_irc/blob/master/sources/Message.cpp): `sources/Message.cpp`

### Other components

- **IRC Client**

## Connections

- IRC Client → Startup Validation: starts with credentials (evidence: `README.md`)
- Startup Validation → Socket Polling: configures and runs (evidence: `sources/main.cpp`)
- IRC Client → Socket Polling: sends IRC lines (evidence: `README.md`)
- Socket Polling → Message Parsing: parses received lines
- Socket Polling → Client Session State: creates sessions (evidence: `sources/Server.cpp`)
- Socket Polling → Command Dispatch: dispatches commands (evidence: `sources/Server.cpp`)
- Command Dispatch → Registration: routes PASS
- Command Dispatch → Nick and User: routes NICK USER (evidence: `sources/Server.cpp`)
- Command Dispatch → Channel Join: routes JOIN (evidence: `sources/Server.cpp`)
- Command Dispatch → Private Messaging: routes PRIVMSG (evidence: `sources/Server.cpp`)
- Command Dispatch → Part and Quit: routes PART QUIT (evidence: `sources/Server.cpp`)
- Command Dispatch → Channel Operations: routes MODE (evidence: `sources/Server.cpp`)
- Command Dispatch → Invitations: routes INVITE (evidence: `sources/Server.cpp`)
- Command Dispatch → Kick Members: routes KICK (evidence: `sources/Server.cpp`)
- Command Dispatch → Topic Management: routes TOPIC (evidence: `sources/Server.cpp`)
- Command Dispatch → WHO Lookup: routes WHO
- Socket Polling → Connected Clients: stores sessions (evidence: `libs/Server.hpp`)
- Socket Polling → Active Channels: stores channels (evidence: `libs/Server.hpp`)
- Channel Join → Active Channels: creates and updates (evidence: `commands/join.cpp`)
- Channel Join → Channel State: uses membership state (evidence: `commands/join.cpp`)
- Channel Operations → Channel State: changes channel modes (evidence: `commands/mode.cpp`)
- Nick and User → Client Session State: updates identity (evidence: `commands/nick.cpp`)
- WHO Lookup → Connected Clients: looks up clients (evidence: `commands/who.cpp`)
- WHO Lookup → Active Channels: looks up channels (evidence: `commands/who.cpp`)
- Private Messaging → Active Channels: sends channel messages (evidence: `commands/privmsg.cpp`)
- Socket Polling → IRC Client: sends protocol replies
