How to Deploy a discord.js Bot
A discord.js bot needs a supported Node.js runtime, installed project dependencies, a secure bot token and a persistent process. Prepare and test it locally before uploading it to a hosting panel.
The consolex1 custom egg
The Node.js Universal egg is developed by the consolex1 hosting provider. Its source code is public on GitHub.
1. Check intents and permissions
Enable only the privileged gateway intents your bot actually uses in the Discord Developer Portal. Give the bot the minimum server permissions it needs.
2. Prepare package.json
Declare discord.js as a dependency, commit a lockfile and define a production start script such as node index.js. Test that script locally.
3. Protect the token
Read process.env.DISCORD_TOKEN in your code and set the token privately in the panel. If a token has been exposed, reset it in the Developer Portal immediately.
4. Choose the Node.js version, deploy and start
The Node.js Universal egg currently offers versions 14, 16, 18, 20, 22, 24 and 26. Choose Node.js Universal when creating the server, select the version in the Startup tab, upload source and manifest files, install dependencies and set the startup command. Versions 14, 16 and 18 are no longer maintained upstream and are available for compatibility only. Start the service and check the live console for login or gateway errors.
5. Validate bot behavior
Confirm the bot appears online, responds to a test command and reconnects after a restart. Review memory use; the free plan provides 256 MB RAM and may not fit every bot.