How to Host a Discord Bot 24/7 (Free and Paid Options)
A bot that sleeps when your laptop closes is a prototype. Getting to true 24/7 uptime means choosing the right host, a process manager that restarts crashes, and secrets that are not sitting in a public repository.
Almost every Discord bot starts life running on someone's laptop, and that works right up until the laptop lid closes, Windows updates at 3 AM, or the Wi-Fi drops for a minute. This guide covers the practical paths to keeping a bot online permanently, from free tiers to a proper bot hosting setup, and how to make each one survive crashes.
Your four options, honestly compared
| Option | Cost | Uptime | Best for |
|---|---|---|---|
| Your own computer | Free | Poor | Development and testing |
| Free PaaS tier | Free | Medium | Hobby bots, prototypes |
| Bot-specific host | Low-mid | Good | Non-technical users, multiple bots |
| VPS | Low | Best | Serious bots, full control |
Running locally is fine while you develop. The moment real users depend on your bot, move it to a server. Free tiers are genuinely useful for a small bot, but they cold-start after idle periods and can restart your process mid-command, which users experience as a bot that randomly stops responding.
Getting started on a VPS
Provision a small Linux server (Ubuntu or Debian), create a non-root user, and install your runtime: Node.js LTS or a current Python. Then transfer your bot, install dependencies, and store the token in an environment variable rather than in source code. A 2 vCPU, 2 GB RAM instance comfortably runs several small bots plus a database for persistence.
Keep it alive with PM2
PM2 is a process manager for Node apps that restarts on crash, restarts on memory leaks, starts on boot and keeps logs. The essential commands:
npm i -g pm2to install.pm2 start index.js --name mybotto launch.pm2 savepluspm2 startupso it survives a server reboot.pm2 logs mybotto tail output,pm2 monitfor live stats.
Python equivalents are systemd services (cleanest on Linux) or Supervisor. The pattern is the same: something outside your process notices failure and restarts it automatically.
Security essentials
- Keep the bot token in environment variables or a secret manager, never in Git.
- Rotate the token immediately if it has ever been committed.
- Restrict privileged intents in the Discord developer portal to what you use.
- Validate interaction payloads and do not evaluate user input.
- Firewall the server: only outbound connections should be needed for a bot.
- Separate bots into different users or containers so one compromise is contained.
Monitor it so you hear first
Auto-restart handles crashes, but it cannot help when Discord rejects your token, the gateway connection stays broken, or your database is full. Add an external uptime check - a scheduled command that verifies the bot responds, or a status endpoint - and alert to Discord DM or email when it fails. Two minutes of setup prevents the "why has my bot been offline for three days" surprise.
Move from localhost to a small VPS, add PM2, secure the token, and set one alert. That is the entire journey from prototype to production bot.
Ready to launch on NextyHost?
Affordable VPS plans sized perfectly for bots, with full root access.

