Discord

How to host a Discord bot 24/7

How to keep a Discord bot online around the clock: hosting options, using a process manager, handling the token safely, and staying within Discord's rules.

5 min read · Updated Jul 28, 2026

A Discord bot only responds while its program is running, so to keep it online around the clock you run it somewhere that stays on, not your laptop. A small bot needs very little, so hosting is cheap or free.

This guide covers where to run a bot, how to keep it alive, and how to handle its token safely.

Step by step

  1. 1

    Pick where it runs

    A small VPS, a Raspberry Pi, or a hosting platform's always-on plan all work. Free tiers often sleep after inactivity, which drops the bot offline, so a cheap always-on VPS is the reliable choice.

  2. 2

    Get your code onto it

    Upload your bot's project, the one you wrote or generated, and install its dependencies. Because you own the code, you can host it anywhere Node runs.

  3. 3

    Keep the token in the environment

    Put the bot token in an environment variable, never in the code or a public repo. If a token ever leaks, reset it in the Discord Developer Portal immediately.

  4. 4

    Run it under a process manager

    Start the bot with a process manager like pm2 so it restarts automatically if it crashes or the machine reboots, instead of staying down until you notice.

  5. 5

    Monitor and update

    Watch the logs for errors and rate-limit warnings. To update the bot, deploy the new code and restart the process, and keep the library current so it stays compatible with Discord.

What you can build

  • A moderation bot that runs 24/7
  • A leveling bot that tracks XP continuously
  • A reminder bot that fires on schedule
  • An announcement relay from an RSS feed
Describe yours

Frequently asked

Yes, but many free tiers sleep on inactivity and take the bot offline. For true 24/7 uptime, a low-cost always-on VPS is more reliable.
Run it on an always-on host under a process manager that restarts it automatically, and keep an eye on the logs.
In an environment variable on the host, never in the source. Devellix-generated bots already read the token from the environment.

Keep reading

Stop reading. Start building.

Describe what you want and Devellix writes it, builds it, and hands you the source. Free credits to start.