Free bot hosting goes to sleep, rate-limits you, or vanishes. A small VPS keeps your Discord bot online around the clock for a few euros — here's how to set it up properly.
Why a VPS (not free hosting)
Free tiers and "always-on" hobby platforms tend to sleep idle apps, cap your hours, or change terms. A bot needs to be actually running 24/7. A small VPS gives you a real always-on machine with full control for the price of a coffee — and your bot doesn't share fate with a free platform's policy changes.
How much VPS do you need?
Most bots are light. A 1 GB Starter handles a typical bot comfortably; size up only for big bots, music streaming, or databases. Discord bots make outbound connections to Discord's API, so NAT IPv4 is a non-issue — you don't need a dedicated IP (see NAT IPv4 vs dedicated IP).
Step 1 — Get your VPS & basics
- Deploy an Ubuntu LTS VPS; root credentials arrive by email in minutes.
- SSH in (on your dedicated port), create a non-root user, and update:
apt update && apt upgrade. - Install your runtime —
nodejs/npmfor a JS bot, orpython3/pip/venvfor a Python one.
Step 2 — Deploy your bot
Clone your code (git) or upload it, install dependencies (npm install or pip install -r requirements.txt), and put your bot token in an environment variable or a .env file — never hard-code it. Test that it starts and connects.
Step 3 — Keep it alive
You want the bot to restart on crash and on reboot. Two standard ways:
-
pm2 (Node, but works for any process):
pm2 start bot.js, thenpm2 startupandpm2 saveso it survives reboots. Great logs and restarts built in. -
systemd (any language): write a small service unit with
Restart=alwaysandenableit. The most robust, OS-native option.
Avoid running the bot in a bare screen/tmux long-term — it won't survive a reboot. pm2 or systemd is the right tool.
Step 4 — Maintain
Check logs (pm2 logs or journalctl -u yourbot), keep the system updated, and take a snapshot before big changes. That's it — a bot that's genuinely online 24/7.
Our VPS for Discord bots is real KVM with full root from €4.99/mo, SSD, and NAT IPv4 (which is perfect for bots). Set up pm2 or systemd once and forget about it.
FAQ
Can I run a Discord bot on a cheap VPS?
Yes — most bots are light and run comfortably on a 1 GB KVM VPS with full root. It's the reliable way to stay online 24/7 versus free tiers that sleep or cap usage.
Does NAT IPv4 / no dedicated IP matter for a bot?
No. Discord bots make outbound connections to Discord's API, so a shared (NAT) IP is completely fine. You don't need a dedicated IP for a bot.
How do I keep the bot running after a crash or reboot?
Use pm2 (pm2 startup + pm2 save) or a systemd service with Restart=always and enable it. Both auto-restart on crash and survive reboots — better than screen/tmux.
Python or Node — does the host care?
No. A KVM VPS with full root runs either. Install nodejs/npm or python3/pip/venv as your bot needs.
Originally published at overnight.host. We run a small, honest hosting company on dedicated bare metal — Linux & Windows VPS, game servers, web hosting. Live status at up.overnight.host.
Top comments (0)