npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ircd-base

v1.3.0

Published

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

Downloads

23

Readme

node-ircd-base

A typesafe Node.js library for implementing IRC servers using a simple API

Install

To install it in your project, run npm install ircd-base or yarn add 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:

const Ircd = require('./src/ircd')

// 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 for my email.