ESN Docs

Docs › Discord bots

How to host a Node.js Discord bot on ESN Hosting

Step-by-step: run a discord.js (or any Node.js) bot 24/7 on ESN Hosting, install npm packages automatically and set your start file.

This guide gets a Node.js Discord bot (discord.js, Eris and so on) running 24/7 on an ESN server.

Before you start

  • A server set up as Discord bot (Node.js). Use your free trial or a plan.
  • Your bot's code with its package.json.

Steps

  1. Open your server and go to Files.
  2. Upload your code, but don't upload the node_modules folder. It's large, and the server installs packages itself. Zip your project, upload the zip and choose Unarchive. Make sure package.json and your start file end up in the top folder. See Uploading files.
  3. Set the start file. Open Startup. The Main JavaScript File variable is index.js by default. Change it if your bot starts from another file, for example bot.js or src/index.js.
  4. Pick a Node.js version (optional). The Docker Image box on the Startup page offers Node.js 22 or 24.
  5. Start it. Go to Console and choose Start. On every start the server runs npm install (when there's a package.json) and then node on your start file.
  6. Check the console for your bot's ready message.

TypeScript bots

The Node.js server runs plain JavaScript. Build your bot on your computer (for example npx tsc), upload the built output, and set the start file to the built file, such as dist/index.js.

Keep your token safe

Put your token in a .env file in the top folder (DISCORD_TOKEN=...), add the dotenv package, and load it with require('dotenv').config() at the top of your start file. Never share your token. If it leaks, reset it in the Discord Developer Portal.

Java bots

Java bots (JDA and similar) run from a .jar file. Upload your built jar, then set the JAR FILE variable on the Startup page to its exact file name (for example bot.jar).

Note: the panel can show the server as Starting even while your bot is running fine. The console output is the real answer.

Still stuck? Use the live chat on the panel or ask in the ESN Hosting Discord. Last updated October 27, 2026.