# ircd-base

> A bare-bones and extensible embedded IRC daemon toolkit for NodeJS

Latest version **1.4.3** (published 2024-10-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install ircd-base
pnpm add ircd-base
yarn add ircd-base
bun add ircd-base
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.3 |
| Published | 2024-10-26 |
| First published | 2022-07-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 153.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Termer |
| Maintainers | termer |
| Keywords | ircd, api, base, irc |

## Links

- npm: https://www.npmjs.com/package/ircd-base
- npm.io page: https://npm.io/package/ircd-base

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 1.4.3 (latest) — 2024-10-26
- 1.4.2 — 2024-10-25
- 1.4.1 — 2024-10-25
- 1.4.0 — 2024-10-24
- 1.3.0 — 2023-10-02
- 1.2.0 — 2023-07-13
- 1.1.6 — 2022-10-23
- 1.1.5 — 2022-07-26
- 1.1.4 — 2022-07-26
- 1.1.3 — 2022-07-26
- 1.1.2 — 2022-07-25
- 1.1.1 — 2022-07-25
- 1.1.0 — 2022-07-24
- 1.0.0 — 2022-07-24

## README

# node-ircd-base

A dependency-free, typesafe Node.js library for implementing IRC servers using a simple API.

Supports Node.js, Deno and Bun.

[![npm version](https://img.shields.io/npm/v/ircd-base)](https://www.npmjs.com/package/ircd-base)

# Install

To install it in your project, run `npm install ircd-base`.

# What is it?

This library is a set of building blocks to create your own IRC server (IRCd).
This can be used for a variety of purposes, including creating IRC gateways to other protocols, creating custom chat servers, and integrating IRC into existing Node.js projects.

To show the capabilities of the library check out the following example:

```typescript
import { Ircd } from 'ircd-base'

// Start a basic development server that displays the capabilities of the library
// The server's cosmetic hostname will be 'my-network' (doesn't affect where the server listens)
const ircd = new Ircd('my.network')

ircd.onConnect(async function (client) {
	console.log('Client connected')

	await client.sendNotice('You are about to login')

	client.onLoginAttempt(async function (userInfo, password, accept, deny) {
		if (password === 'test') {
			await accept()
		} else {
			await deny()
		}
	})
	client.onSuccessfulLogin(async function () {
		console.log(`User ${client.nick} authenticated`)
		await client.sendMotd('Hello world!\nThis is my test MotD!\nWelcome to my IRCd!')
		await client.setMode('+Zi')
	})
	client.onFailedLogin(async function (userInfo, password) {
		console.log(`User ${userInfo.nick} tried to login with password "${password}", but it wasn't correct`)
		await client.disconnect('Wrong username or password')
	})
	client.onDisconnect(function () {
		if (client.isAuthenticated) {
			console.log(`User ${client.nick} disconnected`)
		} else {
			console.log('Unauthenticated client disconnected')
		}
	})
})

ircd.listen(6667, 'localhost').then(function () {
	console.log(`Listening at ${ircd.host}:${ircd.port}`)
})
```

An IRC server running on port 6667 that allows users to login only using the password "test", after which a MotD is sent.
All that was required was 38 lines of clean code.

Because all the library provides is an interface for receiving events and interacting with clients, all logic is left to the programmer.
This provides the programmer with freedom to script their IRC server however they want without having to worry about IRC protocol specifics.

# Support/Contact

If you have any questions or need any help, join #node-ircd-base on irc.rizon.net.

If you spot a bug or are requesting a feature, please open an issue on this repository.

To contact the library author, you can message "termer" on irc.rizon.net, or see my [GitHub profile](https://github.com/termermc) for my email.

---
_Source: https://npm.io/package/ircd-base · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
