Discord bot hosting
Host a Discord bot 24/7 for $3.50 a month
To host a Discord bot 24/7, run it as an always-on background worker: on Makofy that is the Starter type at $3.50 a month (512 MB, 0.5 vCPU), with the bot token in an environment variable and the process started again if it crashes. A gateway bot needs no port or public URL, so it runs as a worker rather than a web service, and it never sleeps.
Last updated · By the Makofy team (Muncar Ventures LLC)
Why a Discord bot needs an always-on host
A Discord bot built on the gateway (discord.js, discord.py, JDA, Serenity and friends) keeps one long-lived WebSocket connection open to Discord. Messages, slash commands and member joins all arrive over that connection, so if the process stops, the bot shows as offline and commands fail until it reconnects. That rules out hosting that puts idle apps to sleep: a sleeping app is woken by an incoming HTTP request, and a gateway bot never receives one. It also rules out your own laptop, unless the lid never closes.
On Makofy the bot runs as a background worker: a service with no port and no URL that runs your start command and keeps it running. Workers can’t use the sleeping Nap type for exactly this reason, so the cheapest always-on option is Starter at $3.50 a month. See instance types for the full list.
What hosting a Discord bot costs
| Setup | What runs on Makofy | Monthly cost |
|---|---|---|
| One small bot | Starter worker | $3.50 |
| Bot with per-server settings in a database | Starter worker + Postgres | $6.50 |
| Bot with cooldowns or rate limits in Redis | Starter worker + Redis | $5.50 |
| Bot plus a web dashboard that may sleep | Starter worker + Nap web app + Postgres | $8 |
| Large bot that caches many members | Basic worker (1 GB / 1 vCPU) | $6 |
For comparison, the closest always-on 512 MB options elsewhere were $7 a month on Render and $7 for a Heroku Basic dyno, about $3.69 for a Fly.io machine, and $5 plus usage on Railway’s Hobby plan (list prices checked November 2026). Plans that sleep when idle, such as Render’s free tier or Heroku’s $5 Eco dynos (asleep after 30 idle minutes), don’t suit gateway bots because nothing wakes them up.
Deploy a discord.js bot step by step
- Create an application and a bot in the Discord Developer Portal, copy the bot token, and invite the bot to your server with the permissions it needs.
- Put the bot in a folder with a
package.jsonwhosestartscript runs it. For Node.js projects Makofy runsnpm starton Node 20. - Install the CLI with
curl -fsSL https://makofy.com/install.sh | shand sign in withmakofy login. - From the bot’s folder, run
makofy deploy --type worker. The CLI uploads the folder (files ignored by git are left out), builds it and starts it as a worker. Without a token the first start can’t log in yet; that is expected. - In the dashboard, add
DISCORD_TOKENas an environment variable and runmakofy deployagain. Variables are applied when the app is deployed. - Look for the “Logged in as” line in
makofy logs, then try/pingin your server. - Optionally connect the GitHub repository in the dashboard, so every push to your branch redeploys the bot.
// bot.js: a minimal discord.js v14 bot
import { Client, Events, GatewayIntentBits } from 'discord.js';
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, (c) => {
console.log('Logged in as ' + c.user.tag);
});
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') await interaction.reply('pong');
});
// Disconnect cleanly when a new version replaces this one.
process.on('SIGTERM', async () => {
await client.destroy();
process.exit(0);
});
client.login(process.env.DISCORD_TOKEN);{
"name": "my-discord-bot",
"type": "module",
"scripts": { "start": "node bot.js" },
"dependencies": { "discord.js": "^14.16.0" }
}Slash commands are registered with Discord’s API once, not on every start. Keep a small deploy-commands.js script and run it from your own machine whenever the command list changes; the bot on Makofy only needs to answer them.
discord.py, Go and other libraries
Nothing here is specific to discord.js. A discord.py bot deploys the same way: list discord.py in requirements.txt, name the entry file app.py (or pass --command "python bot.py"), and deploy with --type worker. Makofy builds Python projects on Python 3.12 and Go projects on Go 1.23, so a discordgo bot compiles without extra setup. For any other language, add a Dockerfile and Makofy builds it as-is. The CLI reference lists every deploy flag.
Keeping the bot online and healthy
- Restarts. If the process exits or crashes, it is started again and the bot reconnects to the gateway. Log the reason before exiting so you can find it in
makofy logs. - Safe deploys. A new version has to start and keep running. If it keeps crashing during the deploy, Makofy marks it unhealthy and brings back the previous working version automatically, and you can roll back to any earlier deploy with one click in the dashboard.
- Memory. A small bot with the Guilds intent fits in Starter’s 512 MB. Bots that cache every member or message of large servers use more; move to Basic (1 GB, $6) or Pro (2 GB, $12) in the app’s settings, and the change is prorated.
- Secrets. Keep the token in an environment variable, never in the repository. Several bots that share settings can read them from one env group.
- Data. Files written inside the app don’t survive a redeploy, so keep warnings, prefixes and other per-server settings in Postgres ($3/mo).
- Sharding. Discord requires sharding once a bot is in 2,500 servers. discord.js’s ShardingManager runs the shards inside the same app, so you can grow by moving to a larger instance type.
FAQ
Frequently asked questions
How much does it cost to host a Discord bot 24/7?
On Makofy a Discord bot costs $3.50 a month on the always-on Starter type (512 MB, 0.5 vCPU). Adding Postgres for data costs $3 a month more.
Can a Discord bot use the $1.50 Nap type?
No. Nap is for web services that wake on an HTTP request; a gateway bot never receives one, so it needs Starter or a larger type.
Does my Discord bot need a port or a URL?
No. A gateway bot only makes an outbound connection to Discord, so deploy it with makofy deploy --type worker and it gets no port or public URL.
What happens if my bot crashes?
The process is started again and reconnects to Discord. If a new deploy keeps crashing, Makofy rolls back to the previous working version.
Can I host several Discord bots?
Yes. Each bot is its own worker app at $3.50 a month, and they can share one Postgres ($3) and one Redis ($2) in the same workspace.
Related
Deploy your app in a few minutes.
Connect a GitHub repo or run makofy deploy. Flat price per app, 7-day free trial, card required.