How to host a Discord bot 24/7: a complete beginner guide
Go from a bot that only runs on your PC to one that stays online 24/7: create the app, prepare your files, upload them and start it on a host.
Your bot works on your computer, but it goes offline the moment you close the terminal, put your PC to sleep or lose Wi-Fi. Hosting it means running the same code on a server that stays on all the time. This guide walks through the whole path once, start to finish, and links to the detailed guide for each step.
What you need #
- A bot that already runs on your own computer (Python, Node.js, Java or another language).
- Its token from the Discord Developer Portal (how to get it).
- A list of the packages it uses (
requirements.txtfor Python,package.jsonfor Node.js). - A bot server. On ESN, bot hosting starts at $0.50/month: see the plans page.
The steps #
- Create the bot application in the Discord Developer Portal, copy its token and invite the bot to your server. Turn on only the privileged intents your code actually uses.
- Take the token out of your code. Put it in a
.envfile asDISCORD_TOKEN=...and read it with python-dotenv or dotenv, so it never ends up in a screenshot or a public repo. - List your packages: one per line in
requirements.txt(for examplediscord.pyandpython-dotenv), or inpackage.jsonfor Node.js. - Get a bot server: on panel.esnoffical.com choose a bot plan for your language. The server is set up automatically after checkout.
- Upload your files in the panel's Files page (or over SFTP). Leave out
node_modules,venvand__pycache__; the server installs packages itself. - Open Startup and set the main file (for example
main.pyorindex.js) to your file's exact name. - Press Start and read the Console. When your bot logs in, it shows online in Discord.
- Stop the copy on your PC, so only one copy of the bot answers commands.
Detailed versions: Python bot, Node.js bot, upload and start any bot.
Why not just leave it running on your PC? #
You can, but the bot is only online while that PC is on, awake and connected. Updates, power cuts and sleep mode all take it down, and your home connection and electricity carry it. A host keeps the process running after you close the panel and turn your computer off.
Keep it online after it starts #
- Catch errors inside commands and events so one bad command doesn't stop the bot.
- Watch memory on the server page. If it sits near your plan's limit, see how much RAM a Discord bot needs.
- If it goes offline anyway, work through why your Discord bot is offline.
Already hosted somewhere else? #
Moving from Replit, Railway, Heroku or a VPS is the same steps with your existing files: see move your bot to ESN.
FAQ #
Can I host a Discord bot 24/7 on my own computer? #
Yes, but only while the computer stays on, awake and online. When it sleeps, restarts or loses internet, the bot goes offline. A host runs it on a server that stays on.
How much does it cost to host a Discord bot on ESN? #
Bot hosting on ESN starts at $0.50/month. Every plan is on the plans page.
Which languages can I host? #
Python, Node.js and Java bots, plus 29 more languages for bots and apps. See Bot & App languages.
Where do I put my bot token? #
In a .env file in your server's top folder, as DISCORD_TOKEN=your-token, and read it from your code. Never paste the token in your code, a chat or a screenshot.
Where can I get help? #
Ask in the ESN Systems Discord or use the live chat on the panel.
Still stuck? Use the live chat on the panel or ask in the ESN Systems Discord. Last updated October 31, 2026.