Skip to main content
The CommandKit CLI provides a powerful development experience for building Discord bots with built-in TypeScript, JSX, and hot module reloading support.

What is the CommandKit CLI?

The CommandKit CLI is a modern build tool that handles the entire lifecycle of your Discord bot development:
  • Zero-config TypeScript/JSX - Write TypeScript and JSX out of the box with no configuration
  • Hot Module Reloading - Commands and events reload instantly during development
  • Production Builds - Optimized bundling for deployment
  • Code Generators - Scaffold commands, events, and custom templates
  • Auto Type Generation - Automatic TypeScript types for your project
The CLI uses tsdown under the hood for fast, optimized bundling.

Available Commands

The CommandKit CLI provides these main commands:

dev

Start development server with hot reloading

build

Build optimized production bundle

start

Run production build

create

Generate commands, events, and more

Installation

The CLI is included with the CommandKit package:
npm install commandkit
Once installed, you can use the commandkit command in your project:
commandkit dev

Basic Usage

Development

Start your bot in development mode with hot reloading:
commandkit dev

Production Build

Build your bot for production:
commandkit build
Then start the production server:
commandkit start

Generate Files

Create a new command:
commandkit create command ping
Create a new event:
commandkit create event ready

Global Options

All commands support these options:

Config Path

Specify a custom config file location:
commandkit dev --config ./custom-config.js
commandkit build -c ./custom-config.js
By default, the CLI looks for commandkit.js or commandkit.ts in your project root.

Environment Variables

The CLI automatically loads environment variables from:
  • .env - Base environment variables
  • .env.local - Local overrides (gitignored)
  • .env.development - Development-specific variables
  • .env.production - Production-specific variables
Variables prefixed with COMMANDKIT_PUBLIC_ are available in your code at runtime.

Zero-Config Features

The CommandKit CLI works out of the box with:
  • TypeScript - Full TypeScript support with no tsconfig needed
  • JSX/TSX - Write Discord components with JSX syntax
  • ESM - Modern ES modules by default
  • Auto-imports - CommandKit exports are automatically available
  • Source Maps - Full debugging support in development and production

Project Structure

The CLI expects this project structure:
project/
├── src/
│   ├── app/
│   │   ├── commands/     # Bot commands
│   │   ├── events/       # Event handlers
│   │   └── locales/      # i18n files (optional)
│   └── app.ts            # Main bot file
├── commandkit.js         # Config file (optional)
└── package.json
The CLI will automatically detect TypeScript if tsconfig.json exists in your project.

Next Steps

Learn more about specific CLI commands:

Development Mode

Learn about hot reloading and the development workflow

Production Builds

Optimize and bundle your bot for deployment

Code Generators

Scaffold new commands and events quickly

Build docs developers (and LLMs) love