In short
Discord bot hosting means running your bot's code on a server that stays on 24/7 instead of on your own computer. A bot connects to Discord over a persistent connection; when your computer shuts down, that connection drops and the bot goes offline. For small and mid-sized bots, a bot VDS with 2 vCPU and 2 GB RAM is usually enough; music bots need more memory.
In this guide
- Why does your bot stop when your computer shuts down?
- What is Discord bot hosting, and what are the options?
- How many resources does each bot need?
- Moving your bot from PC to a server: step by step
- The ideal workflow: Develop on your computer, run on the server
- What to look for in a bot server
- Next step: Get your bot online 24/7
Discord bot hosting means running your bot's code on a server that's always on, instead of on your own computer. A bot is just a program, and it's only online while that code is running; when your computer sleeps, restarts or loses its internet connection, the bot goes down too. Once it's moved to a server, it keeps running 24/7 even when you turn your computer off. This article explains why, how many resources each kind of bot needs, and how to move it.
Why does your bot stop when your computer shuts down?
Discord bots open a WebSocket connection to Discord's server called the Gateway. Every event, such as messages, slash commands and member joins, is delivered to the bot through this open connection. A bot showing as “online” simply means that connection is open right now.
When you run your code on your own computer with node index.js or python bot.py, that terminal window is what holds the connection. If the window closes, Windows restarts after an update, the computer goes to sleep or your router drops for a moment, the process stops and the connection closes. Shortly after, Discord shows the bot as offline.
There's also a time limit: Discord expects an interaction such as a slash command to be answered within 3 seconds. On a slow or overloaded home computer, users may see “The application did not respond” even while the bot is online.
What is Discord bot hosting, and what are the options?
There are basically three ways to host a bot. The good news: a bot only opens outbound connections, so you don't need to open ports on your router or get a static IP. That makes moving it to a server fairly easy.
| Option | Pros | Cons | Best for |
|---|---|---|---|
| Your own computer | Free, quick for testing | The bot stops when your computer is off; depends on your power and internet | Development and testing |
| Free hosting platforms | No setup required | Sleep mode, limited resources, shared IP and data persistence issues | Small test bots |
| Bot VDS | Runs 24/7, root access, dedicated resources | Requires basic Linux knowledge | Bots used on real servers |
A VDS (Virtual Dedicated Server) is a slice of a physical server, split off through virtualization, with resources reserved for you. Because you get your own operating system and root access, you can install whatever software you need, whether that's Node.js, Python, Java or a database. We cover the limits of free options separately in our free Discord bot hosting comparison.
How many resources does each bot need?
A Discord bot's resource needs depend on what the code does and how many servers (guilds) it's in. The values below aren't exact measurements; they're starting estimates used in practice. Monitor your own bot for a few days to pin them down.
| Bot type | Typical contents | Resource needs (guideline) |
|---|---|---|
| Simple command and moderation bot | discord.js or discord.py, a few commands, a log channel | 1 vCPU and a few hundred MB of RAM is usually enough |
| Economy or leveling bot with a database | Persistent data with SQLite, PostgreSQL or MongoDB | If the database is on the same server, 1-2 GB RAM runs comfortably |
| Music bot | Lavalink (Java), audio processing, FFmpeg | Lavalink alone can use anywhere from a few hundred MB to 1 GB+ of memory; 2 GB or more is recommended |
| Multiple bots or a bot + web dashboard | Several processes on the same machine, dashboard | 3-4 GB RAM and 4 vCPU depending on the total number of processes |
There's one more threshold to watch as your bot grows: Discord requires bots that reach 2,500 servers to use sharding. Sharding splits the bot's connection into multiple pieces, and each piece uses its own memory. Until you reach that scale, a single small VDS is more than enough for most bots.
For most of the first three rows in this table, the OB-DISCORD-1 bot VDS with 2 vCPU and 2 GB RAM is a good starting point. If you'll run a music bot, multiple bots or a web dashboard alongside, it makes sense to look at the Discord Bot VDS plans with more RAM.
How do you measure resource usage?
Instead of relying on estimates, run your bot on your own computer for a few hours and check its memory usage. On Windows, the memory column for the node.exe or python.exe process in Task Manager gives you a good idea; on Linux, htop output does the same. If memory keeps growing after the bot starts and never comes down, that's a sign of a memory leak; you need to fix the code, not upgrade the server. Choosing a plan with at least twice the RAM you measured leaves a safe margin for updates and sudden spikes.
Moving your bot from PC to a server: step by step
The move follows the same logic regardless of language. The steps below assume a VDS running Ubuntu or Debian.
- Get the token out of your code. If your bot token is hardcoded, move it to a
.envfile and add.envto your.gitignore. Leaking the token to GitHub is the most common security mistake. - Prepare your dependency list. Node.js projects should have
package.jsonandpackage-lock.json; Python projects should have arequirements.txtfile. Don't copy thenode_modulesor virtual environment folder; it gets reinstalled on the server. - Connect to the server. Log in over SSH with the IP and root credentials you receive when the VDS is delivered.
- Install the runtime. Install Node.js or Python, depending on the language your bot is written in.
- Transfer the files. The cleanest method is pulling the code from a private Git repository. Alternatively, you can upload over SFTP (WinSCP, FileZilla) or use
scp. - Install dependencies and test manually. Start the bot once from the terminal and confirm it shows as online in Discord.
- Hook it up to a process manager. PM2 for Node.js or systemd for Python brings the bot back up automatically after crashes and reboots.
- Shut down the copy on your computer. A bot running in two places with the same token answers every command twice and causes errors.
Example commands for pulling from a Git repository:
sudo apt update && sudo apt install -y git
git clone https://github.com/kullanici-adiniz/botunuz.git
cd botunuz
nano .envIf you'd rather copy straight from your computer (scp is built into Windows 10 and later):
scp -r ./botunuz root@SUNUCU_IP:/root/For detailed language-specific setup, follow our guides on setting up a discord.js bot on a VDS with PM2 and running a discord.py bot with systemd.
The ideal workflow: Develop on your computer, run on the server
After moving to a server, it's tempting to edit code directly on it, but that means a bad change instantly hits every user. A healthier setup looks like this:
- Create a second application in the Developer Portal and use it as a test bot. Keep only this test bot's token on your computer.
- Try changes with the test bot on your own test server, and push them to your Git repository once you're sure they work.
- On the server, run
git pulland restart the bot with your process manager. - If you use a database, back it up before updating; never ship an update without a rollback plan.
With this setup, your live bot never runs half-finished code, and the real token lives only on the server.
What to look for in a bot server
- Root access: Essential so you can install the runtime version, database and tools you want.
- KVM virtualization: Each VDS has its own kernel and dedicated resources; another user's load doesn't eat your bot's memory.
- NVMe disk: Lowers read and write latency for bots that use a database.
- DDoS protection: Even if your bot accepts no inbound connections, the server's IP can still be targeted. This matters even more if you run a web dashboard alongside.
- Security: Use SSH keys instead of passwords, close unneeded ports and run the bot as a separate user instead of root.
- Location: The bot talks to Discord's servers, but if it also communicates with other services in Türkiye, such as a database or game server, a nearby location is an advantage.
Next step: Get your bot online 24/7
Once your bot is in use on a few servers, it shouldn't depend on your computer staying on. OyunBulut's OB-DISCORD-1 plan comes with 2 vCPU, 2 GB RAM, 30 GB NVMe disk, KVM virtualization, layered DDoS protection, automatic setup and root access, and runs on infrastructure in Istanbul. For bigger needs, you can review all Discord Bot VDS options, and if you get stuck during setup, open a support ticket to get help in Turkish.
Frequently asked questions
Why does my Discord bot go offline when my computer shuts down?
The bot is connected to Discord over an open WebSocket connection, and that connection is held by the program running on your computer. When the computer shuts down, sleeps or loses internet, the program stops and the bot goes offline.
How much RAM does a Discord bot need?
Simple command and moderation bots usually run on a few hundred MB. As a guideline, 1-2 GB is recommended for bots with a database, and 2 GB or more for music bots using Lavalink.
Do I need to open ports for a bot server?
No. Discord bots only open outbound connections, so port forwarding and a static IP aren't needed. You only need to open a port if you run a separate web dashboard for the bot.
Can I run my bot on my computer and the server at the same time?
Don't run two copies with the same token; the bot will answer commands twice and you'll get data conflicts. For testing, create a separate test bot in the Discord Developer Portal.
Windows or Linux for Discord bot hosting?
Node.js and Python bots use fewer resources on Linux and are easy to manage with PM2 or systemd. Even if you don't know Linux, you can finish the setup with the handful of commands in our guides.