Prerequisites
Before you begin, ensure you have:- Node.js 24 or later installed
- A Discord account and access to the Discord Developer Portal
- Basic knowledge of TypeScript or JavaScript
Step 1: Create a Discord bot
Create a new application
- Go to the Discord Developer Portal
- Click New Application
- Give your application a name and click Create
Create a bot user
- Navigate to the Bot tab in the left sidebar
- Click Add Bot and confirm
- Under the bot’s username, click Reset Token to generate a new token
- Copy the token — you’ll need it soon (keep it secret!)
Enable intents
Scroll down to Privileged Gateway Intents and enable:
- Server Members Intent (for member events)
- Message Content Intent (if using prefix commands)
Step 2: Create your CommandKit project
- Project name: Enter a name for your bot
- Template: Choose
basic-ts(TypeScript) orbasic-js(JavaScript) - Install dependencies: Select
Yes
Step 3: Configure your bot token
Create a.env file in your project root:
your_bot_token_here with the token you copied earlier, and your_client_id_here with your application ID (found in the General Information tab).
Step 4: Start the development server
Step 5: Test your bot
Your bot should now be online in your Discord server! Try these commands:/ping— The bot responds with “Pong!” and its latency- Type
!ping— Tests prefix command support (if you enabled Message Content intent)
Understanding the project structure
Your new CommandKit project has this structure:The ping command
Opensrc/app/commands/ping.ts to see a basic command:
- Export
datato define the slash command structure - Export
chatInputto handle slash command interactions - No registration calls needed — CommandKit handles it automatically
What’s next?
Create commands
Learn how to build powerful slash commands
Handle events
Respond to Discord events like messages and member joins
Use JSX components
Build Discord UI with React-like JSX syntax
Add plugins
Extend your bot with AI, caching, and more
Having trouble? Check out the Installation guide for detailed setup instructions or join our Discord community for help.