If your Discord bot only runs while your own computer is on, you have already met the problem. Close the laptop, lose your home internet for a minute, or reboot to install an update, and the bot drops offline for everyone who uses it. This guide is for bot developers who want their bot online 24/7. It covers why a server beats your PC, how to pick the right specs, how to keep the process running through crashes and reboots, how to scale as you grow, and what it all actually costs.
Why your own PC is the wrong place to host a bot
Running a bot from your desktop or laptop works for the first day of development. As a permanent home it fails in predictable ways, and every one of them shows up as downtime your users notice.
- It is not always on. Sleep, shutdown, Windows updates, and power cuts all take the bot with them.
- Home internet is not built for hosting. Your IP address usually changes, upload speeds are low, and a brief drop disconnects the bot from Discord's gateway.
- You compete with yourself. The bot shares CPU and memory with your games, browser, and everything else you run.
- Security and privacy. Long-running services on a home machine expose your network, and your real IP is easier to leak.
What you want instead is a machine that is always on, always connected, and doing nothing but running your bot. That is exactly what a server is for.
Why a VPS is the right home for a Discord bot
A VPS, or virtual private server, is a slice of a powerful machine in a datacenter that behaves like your own Linux box. You get root access, a fixed public IP, and guaranteed resources, all for a few dollars a month. If the term is new to you, our guide comparing shared hosting, a VPS, and game servers breaks down the differences before you commit.
For a Discord bot, a VPS solves every problem your PC has:
- 24/7 uptime in a datacenter with redundant power and network.
- A stable, static IP and fast, low-latency connectivity to Discord.
- Isolated resources so your bot's memory and CPU are its own.
- Full control to install Node.js, Python, a database, and any process manager you like.
A Linux VPS is the natural fit. Almost every bot library, from discord.js to discord.py, is happiest on Linux, and providers, tutorials, and deployment tools all assume it. VASTROX runs on NVMe SSD storage in European datacenters with instant provisioning, so you can have a box ready in minutes.
How much CPU and RAM your bot actually needs
This is where new developers overspend. Most Discord bots are tiny. A typical command or moderation bot written in discord.js sits idle at roughly 100 to 200 MB of RAM and uses almost no CPU while it waits for events. You do not need a large server to run it.
Sensible starting points:
- Small command, moderation, or utility bot: 1 vCPU and 1 GB RAM is plenty, even with a small database on the same box.
- Bot with a database and a web dashboard: 1 to 2 vCPU and 2 GB RAM gives comfortable headroom.
- Music bot: this is the exception. Streaming audio means constant encoding with ffmpeg and steady bandwidth, so budget more CPU and pick a plan with generous data transfer. One or two voice channels is fine on a small VPS, but a music bot in dozens of servers at once needs real CPU.
Start small. It is easy to move up a plan later when your bot grows, and you avoid paying for capacity you are not using yet.
Keep your bot alive and deploy it safely
Getting the bot onto a server is only half the job. If you start it by hand with node index.js in an SSH session, it dies the moment you close that session, and it stays dead if it crashes or the server reboots. You need a process manager to keep it running, and a tidy way to ship updates.
pm2 for Node.js bots
pm2 is the most popular option for JavaScript bots. It restarts your bot automatically if it crashes, and it can bring the bot back after a full server reboot.
- Install it globally: npm install -g pm2
- Start your bot with a name: pm2 start index.js --name discord-bot
- Tell pm2 to launch on boot: pm2 startup and run the command it prints.
- Save the current process list so it is restored on reboot: pm2 save
From then on, pm2 logs shows live output, pm2 restart discord-bot reloads after a code change, and pm2 status confirms it is alive.
systemd for Python and everything else
If your bot is written in Python with discord.py, or you simply prefer the built-in Linux tool, systemd does the same job. Create a service file at /etc/systemd/system/discord-bot.service that runs your script, then set Restart=always so it recovers from crashes. Enable it with systemctl enable --now discord-bot and it will start on every boot. The key line either way is the automatic restart. That single setting is the difference between a bot that survives an unhandled error and one that stays offline until you notice.
Deploy and update with Git
Once the server is running, treat deployment as a short routine rather than copying files by hand.
- Use Git. Push your code to a private repository, then clone it onto the VPS. Updating becomes a quick git pull followed by a restart.
- Never commit your bot token. Keep it and any API keys in a .env file listed in .gitignore, and load it at runtime. A leaked token lets anyone control your bot, and Discord will invalidate it the moment it detects the leak.
- Install dependencies on the server with npm install or pip install -r requirements.txt so versions match your project.
- Restart cleanly after each update using pm2 restart or systemctl restart.
Scaling as your bot grows: sharding
A single process can run a bot across thousands of servers, but there is a hard limit. Discord requires sharding once your bot passes roughly 2,500 guilds. A shard is one connection to Discord's gateway that handles a subset of your servers, and the gateway will not let a single connection carry more than that.
The good news is you can grow in stages:
- Scale up first. Move to a VPS with more RAM and CPU. This alone carries most bots a long way.
- Add shards. Libraries like discord.js include a ShardingManager that spawns multiple shard processes automatically. Each shard uses its own memory, so more shards means more RAM.
- Scale out last. Only very large bots need to split shards across multiple servers. By the time you get there, you will already understand your own resource use well.
Do not build for a million users on day one. Ship on one small VPS, watch memory and CPU with pm2 or your host's dashboard, and upgrade when the numbers say so.
What Discord bot hosting costs
This is the reassuring part. A capable entry-level VPS runs from just a few dollars a month, and one box can comfortably host several small bots at once. Compare that to free platforms that put your bot to sleep after inactivity, cap your hours, or shut down without warning. For a service that is supposed to be online 24/7, "free" usually means "offline when it matters."
You can see current VPS options and monthly prices on our plans and pricing page, then pick the smallest plan that fits the specs above. Moving to a bigger plan later is painless, so there is no reason to overbuy at the start.
Getting started
Moving a bot off your PC is one of the highest-value upgrades a developer can make, and it is not hard. Rent a small Linux VPS, deploy your code from Git, keep your token in an environment variable, and wrap the process in pm2 or systemd so it survives crashes and reboots. Do that, and your bot stays online whether your laptop is open or not. Start small, measure real usage, and scale only when your bot earns it.