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

discord-advanced-framework

v0.2.2

Published

Advanced, production-ready framework for Discord bots with TypeScript, IoC container, modular architecture, and hexagonal design

Readme

Discord Advanced Framework (DAF)

🚀 Production-ready Discord bot framework with TypeScript, Dependency Injection, and modern architecture patterns.

npm version License: MIT

✨ Features

Core Features

  • 🎯 Decorator-based - Clean, declarative syntax with @Command, @OnEvent, @Cron
  • 💉 Dependency Injection - Built-in IoC container for modular architecture
  • 🏗️ Modular Design - Organize code into modules with @Module
  • 🔒 Guards & Middleware - Request pipeline with @UseGuard, @UseMiddleware
  • 🌍 Internationalization - Multi-language support with I18nManager
  • Scheduled Tasks - Cron jobs with @Cron decorator
  • 🎨 Utility Helpers - EmbedBuilder, Paginator, and more

Advanced Features

  • 🔘 Button/Select Handlers - @OnButton, @OnSelectMenu decorators
  • 💾 Database Adapters - Prisma, TypeORM, Drizzle support
  • 🗄️ Cache Adapters - Redis, in-memory caching
  • 🔥 Hot Reload - Development mode with auto-restart
  • 📝 Message Commands - Legacy prefix-based commands
  • 🧪 Fully Tested - Comprehensive test suite with Jest

📦 Installation

npm install discord-advanced-framework discord.js

Quick Start with CLI

npx discord-advanced-framework create my-bot
cd my-bot
npm install
npm run dev

🚀 Quick Start

1. Create a Simple Bot

import { initializeFramework, SlashCommand, ExecutionContext, Service } from 'discord-advanced-framework';
import { Client, GatewayIntentBits } from 'discord.js';

// Define a command
@Service()
class PingCommand extends SlashCommand {
  constructor() {
    super({
      name: 'ping',
      description: 'Replies with Pong!',
    });
  }

  async execute(context: ExecutionContext) {
    await context.interaction.reply('🏓 Pong!');
  }
}

// Initialize framework
const client = new Client({
  intents: [GatewayIntentBits.Guilds],
});

initializeFramework(client, {
  token: process.env.DISCORD_TOKEN!,
  modules: [PingCommand],
});

2. Using Modules

import { Module } from 'discord-advanced-framework';

@Module({
  name: 'FunModule',
  providers: [
    PingCommand,
    JokeCommand,
    MemeCommand,
  ],
})
export class FunModule {}

3. Dependency Injection

@Service()
class DatabaseService {
  async getUser(id: string) {
    // Database logic
  }
}

@Service()
class UserCommand extends SlashCommand {
  constructor(private db: DatabaseService) {
    super({ name: 'user', description: 'Get user info' });
  }

  async execute(context: ExecutionContext) {
    const user = await this.db.getUser(context.userId);
    await context.interaction.reply(`User: ${user.name}`);
  }
}

📚 Documentation

Guides

API Reference

🎯 Examples

Button Interaction

@Service()
class InteractiveCommand extends SlashCommand {
  constructor() {
    super({ name: 'interactive', description: 'Interactive buttons' });
  }

  async execute(context: ExecutionContext) {
    const button = new ButtonBuilder()
      .setCustomId('click_me')
      .setLabel('Click Me!')
      .setStyle(ButtonStyle.Primary);

    await context.interaction.reply({
      content: 'Click the button!',
      components: [new ActionRowBuilder().addComponents(button)],
    });
  }

  @OnButton('click_me')
  async handleClick(interaction: ButtonInteraction) {
    await interaction.reply({ content: '✅ Clicked!', flags: 64 });
  }
}

Scheduled Task

@Service()
class ScheduledTasks {
  @Cron('0 0 * * *') // Daily at midnight
  async dailyCleanup() {
    console.log('Running daily cleanup...');
  }

  @Cron('*/5 * * * *') // Every 5 minutes
  async statusCheck() {
    console.log('Checking status...');
  }
}

Embed Builder

const embed = EmbedBuilder.success('Operation completed!')
  .addField('User', 'John Doe')
  .addField('Action', 'Updated profile')
  .setTimestamp()
  .build();

await interaction.reply({ embeds: [embed] });

Pagination

const items = Array.from({ length: 50 }, (_, i) => `Item ${i + 1}`);

await Paginator.paginate(interaction, items, {
  pageSize: 10,
  renderer: (item) => `• ${item}`,
  embedBuilder: (page, totalPages) =>
    new EmbedBuilder().setTitle(`Items (Page ${page}/${totalPages})`),
});

🛠️ Development

# Install dependencies
npm install

# Build framework
npm run build

# Run tests
npm test

# Watch mode
npm run watch

📄 License

MIT © [Your Name]

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide for details.

🔗 Links


Made with ❤️ for the Discord bot community