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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@glowland/discord-framework

v3.0.0

Published

Small typed framework for loading and dispatching discord.js modules.

Downloads

1,217

Readme

@glowland/discord-framework

A small, typed, file-driven framework for Discord bots built on discord.js.

It handles the boring runtime work:

  1. Load modules from folders.
  2. Route Discord interactions, messages, voice updates, and events to those modules.
  3. Inject your app context.
  4. Handle permissions, errors, reloads, and command registration.

No DI container. No hidden lifecycle. No template prison.


Features

  • Typed wrappers over discord.js
  • File-based module loading
  • Slash command manager
  • Context menu manager
  • Button manager
  • Select menu manager
  • Message module manager
  • Voice state update manager
  • Event manager
  • Shared application-command registration
  • Developer-only application commands
  • Built-in reload methods
  • Dynamic permission system (permissionResolver)
  • Duplicate component warnings in development
  • Minimal assumptions about your project structure

Installation

npm i @glowland/discord-framework discord.js

Breaking changes

Module renames

SlashCommand -> SlashCommandModule
ContextMenu -> ContextMenuModule
Button -> ButtonModule
SelectMenu -> SelectMenuModule

Permissions system

allowedRoleIds was removed.

Use permissionResolver instead.


Mental model

Put a module in the right folder, export the right class, load the folder, then listen.

That is the whole framework.

You keep your bot architecture. The framework just gives you clean routing.


Suggested folder structure

components/
  commands/
  context-menus/
  buttons/
  select-menus/
  messages/
  voice-state-updates/
  events/

Each manager loads one folder.


Quick start

import path from "node:path";
import {
  SlashCommandManager,
  ContextMenuManager,
  ButtonManager,
  SelectMenuManager,
  MessageManager,
  VoiceStateUpdateManager,
  EventManager,
  registerApplicationCommands,
} from "@glowland/discord-framework";

const componentsPath = process.env.COMPONENTS_PATH!;

const createInteractionContext = async (interaction) => ({
  client,
  guildDB: await client.guildDB.get(interaction.guildId),
});

Permissions

Buttons, select menus, and context menus support permission checks.

Discord permissions

permissionsRequired: ["ManageGuild"]

Dynamic permissions (recommended)

permissionResolver: (context, interaction) => {
  const roles = context.guildDB.data.adminRoles;
  return interaction.member.roles.cache.some(r => roles.includes(r.id));
}

Access rule

permissionResolver OR all required permissions

So a user can run the component if:

  • the resolver returns true, or
  • they have every permission listed in permissionsRequired

If access fails, the framework replies and does not execute the module.


Modules

Slash command

export default new SlashCommandModule({
  name: "ping",
  description: "Replies with Pong.",

  async execute(context, interaction) {
    await interaction.reply("Pong.");
  },
});

Button

export default new ButtonModule({
  customId: "example.confirm",

  permissionResolver: (context, interaction) =>
    interaction.memberPermissions.has("ManageGuild"),

  async execute(context, interaction) {
    await interaction.reply({
      flags: MessageFlags.Ephemeral,
      content: "Confirmed.",
    });
  },
});

Select menu

export default new SelectMenuModule({
  customId: "example.select",
  type: "String",

  async execute(context, interaction) {
    await interaction.reply({
      flags: MessageFlags.Ephemeral,
      content: interaction.values.join(", "),
    });
  },
});

Message

export default new MessageModule({
  trigger: "!ping",

  async execute(context, message) {
    await message.reply("pong");
  },
});

Event

export default new EventModule({
  name: "ready",
  once: true,

  execute(client) {
    console.log(`Ready as ${client.user.tag}`);
  },
});

Context

Every manager receives a createContext function.

You control what goes inside.

createContext: async (interaction) => ({
  client,
  guildDB: await client.guildDB.get(interaction.guildId),
})

Reloading

await buttons.reloadButtons();

Reloading = clear cache → re-import modules


Design goals

  • explicit over implicit
  • small core
  • strong typing without killing DX
  • framework, not template
  • no hidden lifecycle

License

MIT