A modern, type-safe Discord.js framework with decorators and advanced features.
- 🎯 TypeScript-first with full type safety
- 🎨 Decorator-based commands and events
- 📥 Automatic imports so you write less and code faster
- 🔌 Plugin system for extensibility
- 🚀 Easy to use with minimal setup
npm install @harmonixjs/core tsx discord.js
npm install --save-dev typescriptnpx tsc --initUpdate tsconfig.json:
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "dist",
"esModuleInterop": true
}
}// src/index.ts
import { Harmonix } from "@harmonixjs/core";
const bot = new Harmonix({
bot: {
id: "YOUR_BOT_CLIENT_ID",
token: "YOUR_BOT_TOKEN"
},
publicApp: true,
folders: {
commands: "./src/commands",
events: "./src/events",
components: "./src/components"
},
intents: [3249151] // (All Intents)
});
// Register a plugin
bot.use(...);
// Start listening
bot.login(botConfig.bot.token);// src/commands/Ping.ts
@Command({
name: "ping",
description: "Ping command",
})
export default class PingCommand implements CommandExecutor {
execute(bot: Harmonix, ctx: CommandContext) {
ctx.reply("Pong!");
}
}
// src/commands/PingPrefix.ts
@Command({
name: "ping",
description: "Ping command",
type: 'prefix'
})
export default class PingPrefixCommand implements CommandExecutor<"prefix"> {
execute(bot: Harmonix, ctx: CommandContext<"prefix">) {
ctx.reply("Pong!");
}
}// src/events/Ready.ts
@Event(Events.ClientReady)
export default class ClientReady implements EventExecutor<Events.ClientReady> {
execute(bot: Harmonix, client: Client<true>) {
bot.logger.sendLog("SUCCESS", `Bot is ready! Logged in as ${client.user.tag}`);
}
}// src/components/TestButton.ts
@Component({
id: "test_button"
})
export default class TestButton implements ComponentExecutor {
execute(bot: Harmonix, ctx: ComponentContext) {
ctx.reply("Test button clicked!");
}
}
// src/components/TestSelect.ts
@Component({
id: "test_button"
type: "string-select"
})
export default class TestSelect implements ComponentExecutor<"string-select"> {
execute(bot: Harmonix, ctx: ComponentContext<"string-select">) {
//...
}
}npx tsx src/index.tsHarmonix supports first-class plugins — you can add plugins directly to the framework to register commands, events, middleware, or extend internals.
- @harmonixjs/quick-db: Simple and flexible Quick.db plugin for Harmonix Discord framework.
- @harmonixjs/express: A powerful Express-based HTTP API plugin for the Harmonix Discord framework.
- @harmonixjs/image-builder: Development..