DocsGuides

Deploy your first Discord bot

From an empty folder to a bot that is online 24/7.

Guides 6 min read

This guide walks you through hosting a discord.js bot on DIGITALYCloud. It takes about five minutes and works on the Free plan.

1. Prerequisites

You need a bot token from the Discord Developer Portal and a project with a package.json.

index.js
import { Client, GatewayIntentBits } from 'discord.js';

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.once('ready', () => {
  console.log(`Logged in as ${client.user.tag}`);
});

client.login(process.env.DISCORD_TOKEN);
package.json
{
  "name": "syncbot",
  "type": "module",
  "scripts": { "start": "node index.js" },
  "dependencies": { "discord.js": "^14.16.0" }
}
Never commit your bot token. Store it as an environment variable instead.

2. Create the service

In the dashboard, click + New Service, choose Discord Bot, then connect your GitHub repository.

GitHub

Auto-deploy on push

Upload files

Drop a .zip archive

Docker Image

Any public image

3. Add your token

In the configuration step, add an environment variable named DISCORD_TOKEN. It is encrypted and only injected at runtime.

4. Deploy

Click Deploy Service. DIGITALYCloud installs dependencies, runs npm start and checks that the process stays alive.

Deployment logs
[21:14:02] Starting SyncBot...
[21:14:03] Loading environment variables...
[21:14:04] Connecting to Discord...
[21:14:05] Logged in successfully
[21:14:05] Bot is now online

Dashboard preview

SyncBot

Discord Bot · France — Lyon

Online

CPU

2.4%

RAM

186 MB

Uptime

14d 08h

Enable automatic deploys to ship every push to main without opening the dashboard.
Was this article helpful?