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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mihou/nexus.js

v1.0.5

Published

The Javascript port of the Kotlin Discord framework, Nexus.

Downloads

1

Readme

Nexus.js

Slash commands for Discord.js, simplified.

Neuxs.js is the Javascript port of the Java-Kotlin framework Nexus, unlike the original, the port is fairly barebones and doesn't intend to go beyond the basics of slash commands due to the following factors:

  1. Synchronous nature of Javascript: Unlike the original framework heavily used on concurrency, we are limited to single-threaded executions here, which limits the potential for a lot of things such as auto-defers.

Demo

// commands/ping.ts
import {ChatInputCommandInteraction, SlashCommandUserOption} from "discord.js";
import {Command} from "@mihou/nexus.js";

export const PingCommand: Command = {
    name: "ping",
    description: "Pings a user.",
    options: [
        new SlashCommandUserOption().setName("user").setDescription("The user to pong.").setRequired(true)
    ],
    handler: (ev: ChatInputCommandInteraction) => {
        // do stuff here
    }
}
// test.ts
import {Nexus} from "@mihou/nexus.js";

Nexus.manager.add(PingCommand)

// You can also add one or more commands directly using the conveinence function:
// Nexus.manager.many(PingCommand)

const client = new Client({ intents: [GatewayIntentBits.Guilds] })
    .on(Events.InteractionCreate, Nexus.onInteractionCreate)
    .once(Events.ClientReady, async client => {
        // Your other stuff here when the client is ready.
        
        Nexus.client = client
        await Nexus.synchronizer.sync()
    })
client.login(token)

Installation

bun i @mihou/nexus.js

Features

Nexus.js includes the following features from the original framework:

  • Middlewares: same concept as web frameworks' middlewares, tasks that are executed before the command, can also prevent the command from being dispatched.
  • Afterwares: the complete opposite of middlewares and are executed after the command is dispatched and does not disrupt the command from being dispatched.

Middlewares

Middlewares are those executed before the command is dispatched, these are intended for things such as common user role permission checking, or anything similar that can be extracted elsewhere. This is the same concept as web frameworks' middlewares and can stop the command from being dispatched.

To create a middleware, simply add a new key-value to Nexus.middlewares, for example:

Nexus.middlewares.set("nexus.log", (ev) => {
    console.log('User used the command ', ev.commandName)
    // Return true to continue to the next middleware, or dispatch the command if nothing more.
    return true
})

To use a middleware, you can either add it as a global middleware through:

Nexus.globals.middlewares.push("nexus.log")

Add it as a command middleware by setting the middlewares option:

export const PingCommand = {
    name: "ping",
    description: "pong",
    middlewares: ["nexus.log"],
    ...
}

Global middlewares take a higher priority over command middlewares, which means they are executed first before any other middleware. If your middleware depends on execution order, it's best to remember it, in addition, command middlewares are executed as their order in the array declaration is done.

Afterwares

Afterwares are additional tasks that are to be executed after the command is dispatched, emphasis on dispatched, which means this will be executed quite parallel with the command (although, with the single-threaded nature of Javascript, this should be about as soon as there is an idle time with the thread after dispatching).

To create an afterware, simply add a new key-value to Nexus.afterwares, for example:

Nexus.afterwares.set("nexus.log", (ev) => {
    console.log('User used the command ', ev.commandName)
})

To use a afterware, you can either add it as a global afterware through:

Nexus.globals.afterwares.push("nexus.log")

Add it as a command afterware by setting the afterwares option:

export const PingCommand = {
    name: "ping",
    description: "pong",
    afterwares: ["nexus.log"],
    ...
}

Global afterwares take a higher priority over command afterwares, which means they are executed first before any other afterware. If your afterware depends on execution order, it's best to remember it, in addition, command afterwares are executed as their order in the array declaration is done.