NOWOŚĆ 📢 Zaoszczędź do 30% w pierwszym miesiącu, oferta ograniczona czasowo!

How to host a Node.js Discord bot

Discord bot hostingUpdated Oct 6, 20263 min read

This guide is for bots written in Node.js, for example with discord.js.

Set up the server

  1. Open your server in the panel. A new bot server starts as Node.js Bot, so you do not need to change the type.
  2. Open Files and upload your bot, including package.json. Do not upload the node_modules folder, the server installs it for you.

    • Using git instead? Open Settings, then Game Settings, and fill in Git repository (and the branch if you need one). The files are downloaded when the server is installed. For a private repository also set the git username and an access token.
  3. In Game Settings, set Main file to the file that starts your bot, such as index.js or src/bot.js. Files ending in .ts also work.
  4. Paste your token into Discord bot token (optional). Your code reads it as process.env.DISCORD_TOKEN.
  5. The server runs Node 22. If your bot needs a different Node version, ask support.

Start it

Open Console and start the server. On every start the server runs npm install when a package.json exists, then starts your main file. The first start takes longer while packages download.

Good to know

  • Extra packages: the Extra npm packages field installs more packages on every start without editing package.json.
  • Memory: Node is limited to 80 percent of your plan's memory, which leaves room for the rest of the process and avoids the server being stopped for using too much.
  • TypeScript: a .ts main file runs directly. Compiled JavaScript starts a little faster.
  • Updates from git: turn on Update from git on every start to pull your latest code each time the server restarts.

If it stops right away: read Why your Discord bot keeps stopping.

STWÓRZ SWÓJ SERWER GIER
GOTOWY, ABY ZACZĄĆ?

Oszczędź nawet 30% na swoim nowym serwerze gier.
Wydajność premium, natychmiastowa aktywacja i niezawodność bez kompromisów. Wszystko w lepszej cenie.

NASZE OSTATNIE WPISY