Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A free Next.js template for building and deploying Discord slash-command bots as a serverless REST API.
The NextJS Discord Bot Boilerplate is an open-source template that turns a Next.js application into a fully functional Discord slash-command bot, handling command registration and interaction responses through a serverless REST API.
It is a Next.js project that abstracts the setup work of creating a Discord bot so developers can focus on writing commands. You provide Discord application credentials and a registration key, then deploy the project to Vercel; the template exposes an interaction endpoint that receives Discord webhooks and routes them to your commands. Built on Next.js and Discord.js, it runs serverless and requires no dedicated backend.
./commands/tutorialhere.ts shows the exact structure for defining new slash commands.REGISTER_COMMANDS_KEY registers commands with Discord automatically./api/discord-bot/interactions that you paste into Discord's 'INTERACTIONS ENDPOINT URL' field.NEXT_PUBLIC_APPLICATION_ID, PUBLIC_KEY, BOT_TOKEN, and a custom REGISTER_COMMANDS_KEY to secure command registration../commands/tutorialhere.ts.REGISTER_COMMANDS_KEY to register commands, then invite the bot.The template is free to use and deploy. Vercel offers a free tier that is sufficient for running the serverless bot endpoints.
Yes, the template itself is free, and it is designed to deploy on Vercel's free tier. You only need a Discord application, which is also free to create.
You need NEXT_PUBLIC_APPLICATION_ID, PUBLIC_KEY, and BOT_TOKEN from your Discord application, plus a custom REGISTER_COMMANDS_KEY that protects the command registration endpoint on your site.
After deploying, open your deployment website, enter the REGISTER_COMMANDS_KEY you set, and submit the form. The template calls Discord's application-command API to register all commands defined in the commands folder.
No. Since the bot logic runs as Next.js API routes, it runs serverless. You only need the Next.js deployment, not a VPS or always-on Node process.
