← Blog

Host a Discord Bot 24/7 on a VPS

October 22, 2026 · 4 min read

Running a Discord bot from your laptop means it goes offline whenever you close the lid. A small VPS keeps it online 24/7 for a few dollars a month.

Which plan

Most Discord bots are light. Atom (1 GB RAM) is plenty for a typical bot; choose Spark if yours handles music, images or many servers.

1. Prepare the server

For a Python bot:

apt update && apt install -y python3-venv git
adduser --disabled-password --gecos "" bot
su - bot
git clone https://github.com/you/your-bot.git
cd your-bot
python3 -m venv venv
./venv/bin/pip install -r requirements.txt

Running the bot as its own non-root user limits the damage if it's ever compromised.

2. Keep the token out of the code

Create a .env file next to the bot with DISCORD_TOKEN=... and load it from your code. Never commit the token — anyone with it controls your bot.

3. Run it as a systemd service

Back as root, create /etc/systemd/system/discord-bot.service:

[Unit]
Description=Discord bot
After=network-online.target
Wants=network-online.target

[Service]
User=bot
WorkingDirectory=/home/bot/your-bot
EnvironmentFile=/home/bot/your-bot/.env
ExecStart=/home/bot/your-bot/venv/bin/python bot.py
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Start it and enable it on boot:

systemctl daemon-reload
systemctl enable --now discord-bot

4. Check on it

systemctl status discord-bot
journalctl -u discord-bot -f

With Restart=always, a crash brings it straight back up.

Node.js bots

The same service file works for discord.js — just point ExecStart at node and your entry file.

Updating

su - bot -c "cd your-bot && git pull"
systemctl restart discord-bot

Deploy a server — your bot online in minutes, paid in crypto.

Ready to deploy?

Fund a balance in crypto and get a server in ~60 seconds.

Get started →