Skip to content

How do I deploy a discord.js bot?

Create your bot at discord.com/developers/applications, open the Bot tab and press Reset Token to copy the token. Under OAuth2, pick the bot and applications.commands scopes and use the generated link to add the bot to your server.

In the panel, open the Startup page and paste the token into Discord Token. Your code reads it as process.env.DISCORD_TOKEN, so the token never has to be in your files.

Upload your bot with the File Manager: your entry file and a package.json that lists discord.js under dependencies (not devDependencies, which production installs skip). Every start runs npm install, so new packages only need adding to package.json and a restart. To deploy from Git instead, set Git Repository (and Git Branch if needed) on the Startup page and reinstall; each restart then pulls your latest commit.

The server starts index.js by default. If your bot starts from another file, set Bot Main File on the Startup page, for example src/bot.js. You can pick Node 18, 20 or 22 there too.

Press Start and watch the Console. Common errors: An invalid token was provided means the token is wrong or was reset; Cannot find module means a package is missing from dependencies; Used disallowed intents means a privileged intent needs switching on in the Developer Portal. The full guide with working code is at zerosrp.co.uk/discord-bot-hosting/discord-js.

Was this helpful?

Want to try this on a real server?

Everything described here is available on the trial too, on the same hardware and the same panel as the paid plans. Try it free for 48 hours, no credit card required.

Didn't fix it? Ask in Discord.

Ask in our Discord - we help with hosting questions whether or not you host with us.