{"id":31064934,"url":"https://github.com/varietyz/discord-js-bot-template","last_synced_at":"2025-09-15T15:06:21.144Z","repository":{"id":313022589,"uuid":"1049134722","full_name":"Varietyz/discord-js-bot-template","owner":"Varietyz","description":"Scalable Discord Bot Template, includes API, Rate-limiting, Regression detection, benchmarking/stress-testing, Hot reloading, Plugin architecture and rigorously following SoC, DRY and KISS principles.","archived":false,"fork":false,"pushed_at":"2025-09-03T11:48:01.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-03T13:27:19.887Z","etag":null,"topics":["api","benchmarking","business","discord-bot","discord-bot-framework","discord-bot-template","discord-js","modularity","plugin-system","production-ready","rate-limiting","seperation-of-concerns","sqlite","startups","stress-testing"],"latest_commit_sha":null,"homepage":"https://banes-lab.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Varietyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-02T14:34:00.000Z","updated_at":"2025-09-03T12:35:01.000Z","dependencies_parsed_at":"2025-09-03T13:27:21.970Z","dependency_job_id":"ad01774c-7a33-43d0-b163-5d59a12ca887","html_url":"https://github.com/Varietyz/discord-js-bot-template","commit_stats":null,"previous_names":["varietyz/discord-js-bot-template"],"tags_count":null,"template":true,"template_full_name":null,"purl":"pkg:github/Varietyz/discord-js-bot-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Varietyz%2Fdiscord-js-bot-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Varietyz%2Fdiscord-js-bot-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Varietyz%2Fdiscord-js-bot-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Varietyz%2Fdiscord-js-bot-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Varietyz","download_url":"https://codeload.github.com/Varietyz/discord-js-bot-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Varietyz%2Fdiscord-js-bot-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275274513,"owners_count":25435800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","benchmarking","business","discord-bot","discord-bot-framework","discord-bot-template","discord-js","modularity","plugin-system","production-ready","rate-limiting","seperation-of-concerns","sqlite","startups","stress-testing"],"created_at":"2025-09-15T15:06:16.487Z","updated_at":"2025-09-15T15:06:21.119Z","avatar_url":"https://github.com/Varietyz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# discord-bot-template\n\nProduction-ready Discord bot template\n\nA production-ready Discord bot template with plugin-based architecture, comprehensive security, and REST API management interface.\n\n## Features\n\n- **Plugin System**: Auto-discovery for commands, slash commands, interactions, and message handlers\n- **Security**: Role-based permissions with database-backed rate limiting\n- **Database**: SQLite with migration system and audit trails\n- **API**: REST endpoints for external management and monitoring\n- **Monitoring**: Performance benchmarking and comprehensive logging\n- **Architecture**: Modular design following DRY/KISS principles\n\n## Quick Start\n\n```bash\n# Clone and install dependencies\nnpm install\n\n# Configure environment\ncp .env.template .env\n# Edit .env with your bot token and settings\n\n# Run the bot\nnpm start\n\n# Development mode with hot reload\nnpm run dev\n\n# Run performance benchmarks\nnpm test\n\n# Generate documentation\nnpm run docs\n```\n\n## Configuration\n\nEdit `.env` file with the following options:\n\n- **DISCORD_TOKEN**: your_bot_token_here\n- **CLIENT_ID**: your_client_id_here\n- **DB_PATH**: ./data/bot.db\n- **API_PORT**: 3000\n- **API_ENABLED**: false\n- **API_TOKEN**: your_secure_api_token_here\n- **CORS_ORIGIN**: *\n- **RATE_LIMIT_WINDOW**: 60000\n- **RATE_LIMIT_MAX_REQUESTS**: 10\n- **LOG_LEVEL**: info\n\n## Project Structure\n\n```\napi\\middleware.js (36 lines)\napi\\routes.js (86 lines)\napi\\server.js (85 lines)\ncore\\client.js (41 lines)\ncore\\config.js (60 lines)\ncore\\constants.js (113 lines)\ncore\\shutdown.js (40 lines)\ndata\\database.js (68 lines)\ndata\\helpers.js (56 lines)\ndata\\index.js (19 lines)\ndata\\operations.js (95 lines)\nhandlers\\audit.js (115 lines)\nhandlers\\command.js (99 lines)\nhandlers\\interaction.js (119 lines)\nhandlers\\message.js (133 lines)\nhandlers\\slash.js (127 lines)\nmain.js (16 lines)\nplugins\\commands\\ping.js (15 lines)\nplugins\\interactions\\button.js (22 lines)\nplugins\\messages\\welcome.js (14 lines)\nplugins\\slash\\info.js (19 lines)\nsecurity\\permissions.js (110 lines)\nsecurity\\ratelimit.js (143 lines)\nutils\\docs-generator.js (140 lines)\nutils\\docs\\analyzer.js (66 lines)\nutils\\docs\\ast-parser.js (100 lines)\nutils\\docs\\file-scanner.js (40 lines)\nutils\\docs\\module-parser.js (110 lines)\nutils\\docs\\readme-generator.js (150 lines)\nutils\\docs\\writer.js (48 lines)\nutils\\logger.js (87 lines)\n```\n\n## Plugin Development\n\n### Command Plugin Example\n\n```javascript\n// src/plugins/commands/hello.js\nmodule.exports = {\n    type: 'command',\n    name: 'hello',\n    description: 'Greet users',\n    permission: null,\n\n    async execute(message, args) {\n        await message.reply(`Hello ${message.author.username}!`);\n    }\n};\n```\n\n### Slash Command Plugin Example\n\n```javascript\n// src/plugins/slash/ping.js\nconst { SlashCommandBuilder } = require('discord.js');\n\nmodule.exports = {\n    type: 'slash',\n    name: 'ping',\n    data: new SlashCommandBuilder()\n        .setName('ping')\n        .setDescription('Check bot latency'),\n\n    async execute(interaction) {\n        const ping = interaction.client.ws.ping;\n        await interaction.reply(`Pong! ${ping}ms`);\n    }\n};\n```\n\n## API Endpoints\n\nThe REST API provides external access to bot management:\n\n- `GET /health` - System health check\n- `GET /api/stats` - Plugin and system statistics\n- `GET /api/servers` - List managed servers\n- `GET /api/servers/:id/config` - Server configuration\n- `PUT /api/servers/:id/config` - Update server config\n- `GET /api/servers/:id/audit` - Audit logs\n\nAuthentication required via `Authorization: Bearer \u003cAPI_TOKEN\u003e` header.\n\n## Database Management\n\nThe bot uses SQLite for data persistence. Manual database access:\n\n```bash\n# Open database\nsqlite3 ./data/bot.db\n\n# View tables\n.tables\n\n# Query audit logs\nSELECT * FROM audit_logs ORDER BY timestamp DESC LIMIT 10;\n\n# Export data\n.dump \u003e backup.sql\n```\n\n## Performance\n\nBenchmark results show optimal performance:\n- Configuration loading: \u003c 1ms\n- Database operations: \u003c 10ms\n- Permission checks: \u003c 2ms\n- Plugin loading: \u003c 1ms\n\nRun `npm test` to benchmark your environment.\n\n## License\n\nMIT License - see LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarietyz%2Fdiscord-js-bot-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarietyz%2Fdiscord-js-bot-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarietyz%2Fdiscord-js-bot-template/lists"}