cordify
v1.0.1
Published
An all-in-one Node.js toolkit designed to simplify Discord bot development
Maintainers
Readme
Cordify
An all-in-one Node.js toolkit designed to simplify Discord bot development
Overview
Cordify combines multiple essential modules into a single, unified package — allowing developers to focus on logic instead of repetitive setup. Built in JavaScript (CommonJS), Cordify aims to be accessible, lightweight, and production-ready.
Key Features
🎯 Command System
A structured and automatic slash command handler inspired by discord-command-kit. Define your commands in a single directory, and Cordify handles registration, permission management, and error safety for you.
💾 JSON Data Store
Cordify includes a lightweight JSON-based datastore that serves as a zero-setup local database. It automatically creates and validates data files, ensuring type consistency and preventing corruption. Perfect for XP systems, guild configurations, and persistent user data.
🔐 Environment Loader
Cordify comes with a built-in environment loader that validates all required Discord-related variables such as TOKEN, CLIENT_ID, and GUILD_ID. It ensures every critical configuration is present before the bot starts, preventing runtime errors.
🛡️ AutoMod
A ready-to-use automoderation system that detects spam, excessive capitalization, link flooding, and more. All rules are easily configurable through a single .config.js file, with safe defaults already included.
🔧 CLI (Command Line Interface)
Cordify provides a CLI tool that allows you to quickly scaffold a new Discord bot project with one command:
npx cordify init my-botThe CLI automatically generates a recommended folder structure, configuration files, and starter scripts.
Installation
npm install cordify discord.jsQuick Start
1. Initialize a New Project
npx cordify init my-discord-bot
cd my-discord-bot
npm install2. Configure Your Bot
Edit the .env file with your Discord bot credentials:
TOKEN=your_bot_token_here
CLIENT_ID=your_client_id_here
GUILD_ID=your_guild_id_here3. Run Your Bot
npm startManual Setup
If you prefer to set up Cordify manually:
const { Client, GatewayIntentBits } = require('discord.js');
const cordify = require('cordify');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
cordify.env.loadAndValidate();
const datastore = new cordify.DataStore();
const commandHandler = new cordify.CommandHandler(client);
const automod = new cordify.AutoMod({
spamThreshold: 5,
capsLimit: 80,
blockLinks: false
});
client.once('ready', async () => {
console.log(`Logged in as ${client.user.tag}`);
await commandHandler.loadCommands();
await commandHandler.registerCommands(
process.env.TOKEN,
process.env.CLIENT_ID,
process.env.GUILD_ID
);
});
client.on('interactionCreate', async (interaction) => {
await commandHandler.handleInteraction(interaction);
});
client.on('messageCreate', async (message) => {
await automod.processMessage(message);
});
client.login(process.env.TOKEN);Creating Commands
Create a new file in your commands/ directory:
// commands/hello.js
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('hello')
.setDescription('Greets the user'),
async execute(interaction) {
await interaction.reply(`Hello, ${interaction.user.username}!`);
}
};Cordify automatically loads and registers all commands in the commands/ directory.
API Reference
DataStore
const datastore = new cordify.DataStore('path/to/data');
datastore.set('users', 'user123', { xp: 100, level: 5 });
const userData = datastore.get('users', 'user123');
datastore.has('users', 'user123');
datastore.delete('users', 'user123');
datastore.increment('users', 'user123_xp', 10);
datastore.push('users', 'user123_achievements', 'first_message');CommandHandler
const commandHandler = new cordify.CommandHandler(client);
await commandHandler.loadCommands('commands');
await commandHandler.registerCommands(token, clientId, guildId);
await commandHandler.handleInteraction(interaction);AutoMod
const automod = new cordify.AutoMod({
spamThreshold: 5,
spamWindow: 5000,
capsLimit: 80,
blockLinks: false,
ignoreBots: true,
ignoreRoles: ['Moderator', 'Admin']
});
await automod.processMessage(message);
automod.updateConfig({ spamThreshold: 10 });
automod.disable();
automod.enable();Environment Loader
cordify.env.load('.env');
cordify.env.validate(['TOKEN', 'CLIENT_ID']);
cordify.env.loadAndValidate();
const token = cordify.env.get('TOKEN');
const hasGuildId = cordify.env.has('GUILD_ID');Configuration
Create a cordify.config.js file to customize AutoMod settings:
module.exports = {
automod: {
spamThreshold: 5,
spamWindow: 5000,
capsLimit: 80,
blockLinks: false,
ignoreBots: true,
ignoreRoles: ['Moderator']
}
};Examples
Check out the example-bot/ directory for a complete working example demonstrating all Cordify features.
Requirements
- Node.js: v18 or newer
- Discord.js: v14+
- Module Type: CommonJS (require syntax)
- Operating Systems: Windows, macOS, Linux
Goals
- ✅ Eliminate redundant setup across Discord bot projects
- ✅ Provide a plug-and-play experience for both new and advanced developers
- ✅ Offer a reliable JSON-based datastore with zero configuration
- ✅ Maintain full compatibility with discord.js
- ✅ Minimize dependency size and complexity
Example Use Cases
- Quick bot prototypes without database setup
- Moderation or utility bots with persistent data
- Teams standardizing command registration and bot configuration
- Educational projects or hackathons
Future Plans
- Optional plugin architecture for advanced extensions
- Support for YAML and in-memory database adapters
- Interactive command registration via CLI
- Integrated testing utilities
Security Notes
- Cordify does not handle encryption or sensitive data storage
- JSON Data Store is intended for non-confidential bot information only
- Developers are responsible for token security and external database connections
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
Copyright © 2025 Cordify Developers
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Important: While this software is open-source and free to use, the original design and concept are protected. Users may install and use Cordify in their projects, but creating competing derivative packages or copying the core architecture without proper attribution is prohibited.
Support
For issues and questions, please open an issue on GitHub.
Built with ❤️ by the Cordify team
