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
- Open your server and go to Files.
- Upload your code, but don't upload the
node_modulesfolder. It's large, and the server installs packages itself. Zip your project, upload the zip and choose Unarchive. Make surepackage.jsonand your start file end up in the top folder. See Uploading files. - Set the start file. Open Startup. The Main JavaScript File variable is
index.jsby default. Change it if your bot starts from another file, for examplebot.jsorsrc/index.js. - Pick a Node.js version (optional). The Docker Image box on the Startup page offers Node.js 22 or 24.
- Start it. Go to Console and choose Start. On every start the server runs
npm install(when there's apackage.json) and thennodeon your start file. - 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).
Still stuck? Ask in the ESN Hosting Discord. Last updated October 27, 2026.