There are a lot of Node.js Discord bots out there, but you can also build one with Next.js and host it for free on Vercel. An actually free Discord bot.
GitHub Repository · Live demo / invite the bot
How it works
Discord can send slash commands to a URL as plain HTTP requests, and the bot replies in the response. That's exactly what a Next.js route handler does, so there's no server to keep online.
The Boilerplate
It handles verifying requests, routing commands, registering them with Discord, and types. You just write commands:
export default defineCommand({ data: new SlashCommandBuilder() .setName("hello") .setDescription("Says hello"), execute: async (interaction) => ({ type: InteractionResponseType.ChannelMessageWithSource, data: { content: "Hello World!" }, }), }); Add it to src/bot/commands/index.ts, register from the home page, and it shows up in Discord. Since execute can be async, you can hit a database or an API too. Just reply within 3 seconds.
Deploy it with the Deploy with Vercel button in the README.
Limitation
It can't listen to messages or events, only slash commands.
This was one of my first projects that the public could actually use, and I've since rebuilt it on the latest Next.js. Feedback, issues and PRs are welcome, and a ⭐ on the repo is appreciated!


