How underctrl-io/commandkit works
Project type and purpose
• This is a monorepo for “commandkit,” a plugin-based Discord bot meta-framework.
• It contains:
• A core library (packages/commandkit) plus companion plugins (ai, analytics, cache, i18n, legacy, queue, redis, tasks).
• A CLI tool to scaffold new bots (packages/create-commandkit).
• A sample “test-bot” app demonstrating usage (apps/test-bot).
• A documentation website (apps/website) built with Docusaurus.
• A Devtools suite split into a UI SPA (packages/devtools-ui) and a backend API server (packages/devtools).
• Build & release orchestrated with pnpm workspaces and Turborepo, plus GitHub Actions workflows for CI/CD.
File structure analysis
• Top-level: .github/workflows, pnpm-workspace.yaml, turbo.json → CI, publish pipelines, monorepo orchestration.
• packages/…: each folder is a separately versioned/published npm package (core, plugins, CLI, devtools, tsconfig presets).
• apps/…: two full-stack “applications”:
• apps/test-bot: a Discord bot built on commandkit + plugins.
• apps/website: the public documentation site.
• scripts/…: internal doc generation tooling.
README insights
• “commandkit” is a discord.js meta-framework.
• Primary deliverables are the npm packages (core + plugins) and companion apps (CLI, example bot, docs site).
a. Main components
• Monorepo layer: pnpm / Turborepo / GitHub Actions
• Package modules:
• Core library (commandkit)
• Plugins (ai, analytics, cache, i18n, legacy, queue, redis, tasks)
• CLI scaffolder (create-commandkit)
• Devtools server + UI
• Sample application (test-bot)
• Documentation website
• External dependencies: Discord API, npm Registry, PostHog/Umami (analytics), Redis/BullMQ/SQLite (pluggable storage)
b. Relationships & interactions
• Developer → uses CLI to scaffold a new bot → built on core + chosen plugins → deployed to Discord
• Test-bot app imports core + plugin packages
• Devtools UI ↔ Devtools server (REST) ↔ underlying packages for configuration, auth, monitoring
• apps/website reads auto-generated API docs (via scripts/docs) and serves static site
• CI/CD pipelines watch code changes → build/test → publish packages to npm → deploy docs
c. Architectural patterns
• Monorepo modularization by domain (core, plugins, apps, tools)
• Plugin architecture (core dispatches to runtime/compile-time plugins)
• Example/sample application demonstrating the framework
• Separate docs site decoupled from code but integrated into CI
• Devtools split into frontend SPA + backend API
d. Key technologies
• Node.js + TypeScript
• pnpm workspaces & Turborepo
• Docusaurus (docs)
• GitHub Actions (CI/CD)
• Discord.js (runtime target)
• Redis, BullMQ, SQLite (pluggable queues & storage)
• REST + Axios (Devtools UI ↔ server)
Final advice
• Every major piece (monorepo orchestrator, libraries, plugins, CLI, sample app, docs site, devtools).
• Plugin-based, modular nature.
• How components relate to external systems (Discord, npm registry, analytics backends).