Comparison

Hosting a Discord bot 24/7: options that keep the gateway online

If your bot uses discord.js or discord.py with the gateway, it must stay connected.

Comparison2 min readUpdated

Options

HostEntry priceBilling modelServer admin effort
RailwayHobby $5/mo incl. $5 of usage; Free plan $1/mo of usageUsage (RAM, CPU, egress)Low
Vultr$5/mo (1 GB); $3.50/mo (0.5 GB)Fixed monthlyHigh
Fly.io$2.19 per 30 days (256 MB)Per machine timeMedium
DigitalOcean$4/mo (512 MiB); $6/mo (1 GiB)Fixed monthlyHigh

Prices verified on 2026-10-19 on the providers' official pricing pages. They change: check before you buy.

Keep it healthy

  • Request only the intents you use; privileged intents need approval for larger bots.
  • Let the host restart the process on crash (Railway restart policy or systemd Restart=always).
  • Log the READY event and reconnects so you can see outages.
  • Run one copy per token: two copies answer every command twice.

Templates

discord.js template · discord.py template · Bot command generator

Frequently asked questions

Why does my free host disconnect the bot?

Free web tiers sleep without inbound HTTP traffic; the gateway connection is outbound, so it does not count and the process is stopped.

Do I need sharding?

Only for large bots; Discord requires it beyond a certain number of servers. Small bots run a single shard.

Can an interactions-only bot avoid 24/7 hosting?

Yes: an HTTP interactions endpoint can run on serverless, but it must verify Ed25519 signatures and answer within 3 seconds.