<!-- canonical: https://hostdc.xyz/host/discord-js · last updated 2026-09-06 · HostDC, Keep your Discord bot online 24/7. -->

# Host a discord.js bot

HostDC runs discord.js bots on Node.js 20 and 22, online 24/7, with a free plan that gives you a 256 MB RAM pool, 0.5 CPU and 512 MB storage. You upload the project, we install the dependencies from your lockfile and keep the process alive.

## Three steps

**1. Bring your project.** Drop a zip, paste a GitHub URL or write it in the browser editor. A minimal discord.js bot is three files:

```
package.json
package-lock.json
index.js
```

```js
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.once('clientReady', () => console.log(`Logged in as ${client.user.tag}`));
client.on('interactionCreate', (i) => {
  if (i.isChatInputCommand() && i.commandName === 'ping') i.reply('pong');
});

client.login(process.env.DISCORD_TOKEN);
```

**2. Add your token.** Put it in the Secrets tab, never in the code. We store it AES-256-GCM encrypted and inject it as `DISCORD_TOKEN`. If it leaks into your console output, we scrub it.

**3. Press Deploy.** We read `package-lock.json`, install through our checked proxy and start `node index.js`. The console streams live, and the first line that says it logged in ticks the "bot reports ready" step of your setup checklist.

## Limits you should know

The free plan gives a 256 MB RAM pool, 0.5 CPU and 512 MB storage, and needs reactivating weekly from your dashboard. Mini, Lite, Pro and Max are the paid plans: Lite is $1.69 a month with a 1 GB pool, and Pro is $2.49 a month with a 2 GB pool. None of them need reactivating. The full table is on the [pricing page](/pricing).

Music bots are not supported: voice streaming needs CPU and bandwidth the plans do not carry.

## Related

- [Host a Node.js bot](/host/node), the runtime behind discord.js
- [Guide: host a discord.js bot](/guides/host-discord-js-bot)
- [Environment variables and tokens](/guides/environment-variables-and-tokens)

## FAQ

### Which discord.js versions work?
Any version that runs on Node.js 20 or 22, which covers discord.js v14. Pick the Node version on the bot's Settings tab.

### Do I need a package-lock.json?
It helps. With a lockfile we install exactly what you tested. Without one we resolve from `package.json`, and the result can drift.

### Can I use slash commands?
Yes. Register them from your own code as usual. Outbound requests to Discord are allowed.

### What happens if my bot crashes?
It restarts automatically with backoff, and stops after 5 crashes in 10 minutes.
