ircxd - IRC client & server library for Elixir

CIHex.pmHexDocsLicense

Use it to build your bots, or embed an IRC server on your app - backed by your application's own accounts and data.

ircxd, an IRC client and server library for Elixir

Features

Installation

Add ircxd to your Mix dependencies:

def deps do
[
{:ircxd, "~> 1.0"}
]
end

Then fetch dependencies:

mix deps.get

Quickstart

Depending on whether you want to build a client or server, point your agent at the client adapter or server adapter documentation links mentioned below in the documentation section.

Start a client process and receive events in the calling process:

{:ok, client} =
Ircxd.start_link(
host: "irc.libera.chat",
port: 6697,
tls: true,
sni: "irc.libera.chat",
nick: "myapp",
username: "myapp",
realname: "My App",
caps: ["server-time", "echo-message"],
notify: self()
)
receive do
{:ircxd, :registered} -> :ok
end
:ok = Ircxd.Client.join(client, "#elixir")
:ok = Ircxd.Client.privmsg(client, "#elixir", "hello from ircxd")
:ok = Ircxd.Client.action(client, "#elixir", "waves")

TLS clients verify the server certificate chain and hostname by default using the operating-system CA store. A custom trust root can be supplied with tls_options: [cacertfile: "/path/to/ca.pem"]. Disabling verification with verify: :verify_none should be limited to isolated development fixtures.

Supported IRC commands

The client table below lists commands with dedicated Ircxd.Client helpers or automatic client handling. Ircxd.Client.raw/3, Ircxd.Client.raw_tagged/4, and Ircxd.Client.transmit/2 can send other commands supported by a remote network.

Client commands

AreaCommands
Connection and capabilitiesCAP, PASS, NICK, QUIT, WEBIRC; automatic USER, PING, and PONG
ChannelsJOIN, PART, NAMES, LIST, INVITE, KICK, TOPIC, MODE, RENAME
MessagingPRIVMSG, NOTICE, TAGMSG, BATCH, REDACT
Presence and identityAWAY, SETNAME, MONITOR, METADATA, MARKREAD
User and server queriesWHO, WHOIS, WHOWAS, USERHOST, ISON, MOTD, LUSERS, VERSION, TIME, ADMIN, INFO, HELP, STATS, LINKS, ISUPPORT
Accounts and historyAUTHENTICATE through SASL, REGISTER, VERIFY, CHATHISTORY
Operator, service, and legacyOPER, KILL, WALLOPS, SQUERY, TRACE, CONNECT, SQUIT, REHASH, RESTART, SUMMON, USERS, SERVLIST

Higher-level helpers cover replies, typing notifications, reactions, channel context, multiline messages, read markers, metadata subscriptions, capability lifecycle, and all six supported CHATHISTORY queries.

Server commands

AreaCommands
Registration and connectionCAP, AUTHENTICATE (PLAIN and EXTERNAL), PASS, NICK, USER, PING, PONG, QUIT
ChannelsJOIN, PART, NAMES, LIST, INVITE, KICK, TOPIC, MODE
MessagingPRIVMSG, NOTICE, TAGMSG, BATCH, REDACT
Presence and identityAWAY, SETNAME, MONITOR
User and server queriesWHO, WHOIS, WHOWAS, USERHOST, ISON, MOTD, LUSERS, VERSION, TIME, ADMIN, INFO, HELP, STATS, LINKS
HistoryCHATHISTORY (LATEST, BEFORE, AFTER, AROUND, BETWEEN, and TARGETS)

The embedded server also negotiates the IRCv3 capabilities that back these commands. Applications can add adapter-defined commands through the adapter's handle_command/3 callback; unknown commands receive the standard numeric or IRCv3 FAIL response.

Embedded IRC Server

Add Ircxd.Server to an OTP supervision tree:

children = [
{Ircxd.Server,
id: :public_irc,
port: 6667,
server_name: "irc.example.test",
adapter: {Ircxd.Server.Adapters.ETS, history_limit: 1_000}}
]
Supervisor.start_link(children, strategy: :one_for_one)

The included ETS adapter provides node-local, memory-only accounts, channels, policy, and bounded history. Applications can query or change adapter-owned state directly:

{:ok, users} = Ircxd.Server.query(server, :users)
{:ok, channel} = Ircxd.Server.execute(server, {:put_channel, "#elixir", %{}})

Listeners bind to localhost by default. Use ip: {0, 0, 0, 0} to expose the listener, or enable implicit TLS with tls: true and standard Erlang tls_options.

Adapters

Both sides accept adapter: {Module, init_arg}. Use Ircxd.Client.Adapter for outbound client events and Ircxd.Server.Adapter for application-owned server state, persistence, authentication, authorization, and custom commands.

See Client usage and adapters for the complete client lifecycle and client callback contract. The server adapter guide covers server state, security boundaries, and production integration.

Documentation

Story

I've tried to build an IRC client & app many times ever since I first used Elixir. But priorities and other shiny stars kept me away. Because it's 2026, and now thanks to AI, I have ircxd :)

IRC client prototype from November 2017

Tweet about the IRC client prototype

License

Copyright 2026 Akash Manohar John

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.