---
title: "How to migrate a Discord bot from Replit to a VPS | StreetHosting"
description: "Get past the limits and sleep mode of free hosting: move your Discord bot to a VPS with real uptime, secure environment variables and automatic restarts."
url: "https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps"
type: "page"
language: "en-US"
---

Discord Bots · 3 min · Intermediate

Published on Jun 17, 2026 · Updated on Jun 17, 2026

# Migrate your Discord bot from Replit to a VPS

Free hosts put apps to sleep and cap resources, which takes bots offline. Here is how to move your code to a VPS, carry your secrets over safely and keep the bot truly online.

By [Equipe StreetHosting](https://streethosting.com.br/en/autores#equipe-streethosting) · StreetHosting infrastructure and support team

[Migration](https://streethosting.com.br/en/guides/topics/migration) [Monitoring and alerts](https://streethosting.com.br/en/guides/topics/monitoring) [Deploying and running apps](https://streethosting.com.br/en/guides/topics/deploy)

Summarize with:

[](https://chat.openai.com/?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fdiscord-bots%2Fmigrate-discord-bot-from-replit-to-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "ChatGPT") [](https://claude.ai/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fdiscord-bots%2Fmigrate-discord-bot-from-replit-to-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Claude") [](https://www.google.com/search?udm=50&aep=11&q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fdiscord-bots%2Fmigrate-discord-bot-from-replit-to-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Google AI Mode") [](https://x.com/i/grok?text=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fdiscord-bots%2Fmigrate-discord-bot-from-replit-to-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Grok") [](https://www.perplexity.ai/search/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fdiscord-bots%2Fmigrate-discord-bot-from-replit-to-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Perplexity")

Share:

[](https://x.com/intent/tweet?text=How%20to%20migrate%20a%20Discord%20bot%20from%20Replit%20to%20a%20VPS&url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fdiscord-bots%2Fmigrate-discord-bot-from-replit-to-vps "Share on X") [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fdiscord-bots%2Fmigrate-discord-bot-from-replit-to-vps "Share on Facebook") [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fdiscord-bots%2Fmigrate-discord-bot-from-replit-to-vps "Share on LinkedIn") [](https://wa.me/?text=How%20to%20migrate%20a%20Discord%20bot%20from%20Replit%20to%20a%20VPS%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fdiscord-bots%2Fmigrate-discord-bot-from-replit-to-vps "Share on WhatsApp")

For agents: Copy as Markdown [.md](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps.md)

In this guide 5 sections

* [Why migrate](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#por-que-migrar)
* [Export the bot](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#exportar)
* [Upload it to the VPS](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#subir-vps)
* [Move the secrets](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#segredos)
* [Real uptime](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#uptime)

Quick answer

To migrate your bot from **Replit to a VPS**, export the code, upload it to the VPS, install the runtime and the dependencies, and recreate the environment variables, such as the token, in a secure file. Set up PM2 or systemd for automatic restarts and start at boot. The result is real uptime, with no sleep mode and no resource caps.

## Why migrate[](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#por-que-migrar)

Free hosting is fine to get started, but it puts apps to sleep and caps resources. For a bot that needs a constant connection to Discord, that means downtime and ignored commands. A VPS gives you continuous execution and full control, as the guide on [24/7 Discord bot hosting](https://streethosting.com.br/en/guides/discord-bots/discord-bot-hosting-24-7) shows.

## Export the bot[](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#exportar)

Download the code from your current host or clone it from your repository. Make sure you have the latest version and the list of dependencies. Also write down every environment variable the bot uses, so you can recreate them on the VPS.

## Upload it to the VPS[](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#subir-vps)

1. Connect to the VPS over SSH, as shown in [the first access guide](https://streethosting.com.br/en/guides/vps/connect-to-vps-via-ssh-first-time).
2. Upload the code and install the same runtime version.
3. Install the project dependencies.
4. Run the bot once to confirm it connects.

## Move the secrets[](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#segredos)

| Where it was              | Where it goes on the VPS        |
| ------------------------- | ------------------------------- |
| Secrets in the free panel | Secure environment variable     |
| Bot token                 | Protected config file           |
| API keys                  | Variables kept outside the code |

If you are unsure whether the token was exposed during the migration, generate a new one in the portal. It is quick and removes the risk that someone copied the old one.

## Real uptime[](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#uptime)

* Runtime and dependencies installed on the VPS
* Environment variables recreated securely
* Automatic restart with PM2 or systemd
* Start at boot configured and tested

Finish by setting up the process manager, following the [deploy with PM2](https://streethosting.com.br/en/guides/discord-bots/deploy-discord-bot-pm2). For the right machine, take a look at the [Ryzen VPS](https://streethosting.com.br/en/vps/ryzen) and the [Discord bot plans](https://streethosting.com.br/en/bots).

In this guide

* [Why migrate](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#por-que-migrar)
* [Export the bot](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#exportar)
* [Upload it to the VPS](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#subir-vps)
* [Move the secrets](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#segredos)
* [Real uptime](https://streethosting.com.br/en/guides/discord-bots/migrate-discord-bot-from-replit-to-vps#uptime)

## Frequently asked questions

Why did my bot keep going down on free hosting?

Free services usually go to sleep when there is no activity and cap CPU and RAM. For a bot that has to stay connected to Discord at all times, that means constant downtime and commands that get no response.

Do I need to change my code to run it on a VPS?

Usually little or nothing. The code is normally the same. What changes is the environment: you install the runtime and the dependencies, and recreate the environment variables on the VPS.

How do I move the token safely?

Recreate the environment variable on the VPS, in a protected config file or in the panel. Never paste the token straight into the code. If there is any doubt about exposure, generate a new token in the portal.

Will the bot stop going to sleep on a VPS?

Yes. On a VPS the bot runs continuously. With PM2 or systemd handling automatic restarts and start at boot, it stays online even after a crash or a machine reboot.

Next step

See bot plans

24/7 Discord bots with fast activation and support in Portuguese.

[See bot plans](https://streethosting.com.br/en/bots)

[See Ryzen VPS Ryzen 9 9950X VPS in São Paulo with root access, NVMe and gamer Anti-DDoS.](https://streethosting.com.br/en/vps/ryzen) [See VPS plans Root VPS in Brazil with NVMe and Anti-DDoS.](https://streethosting.com.br/en/vps)

## Related guides

[Discord bots Intermediate Deploy a Discord bot with Node.js and PM2: env vars and auto restart PM2 is a popular Node process manager for Discord bots because it restarts after a crash, survives reboots when paired with the startup hook and centralizes basic logs without standing up a whole Kubernetes cluster. This guide covers the ecosystem file, env vars for the token and how it fits hosting in Brazil. 4 min Read guide](https://streethosting.com.br/en/guides/discord-bots/deploy-discord-bot-pm2) [Discord bots Beginner 24/7 Discord bot hosting in Brazil Discord bot hosting 24/7 combines a process manager with automatic restart, a token kept out of your code, logs and a server in Brazil for low latency to the API and your players. 6 min Read guide](https://streethosting.com.br/en/guides/discord-bots/discord-bot-hosting-24-7) [VPS Beginner How to connect to your VPS for the first time via SSH You bought the VPS and received an IP, a user and a password. Now it is time for the first login. Here is how to connect over SSH from any system and what to do in the first few minutes. 3 min Read guide](https://streethosting.com.br/en/guides/vps/connect-to-vps-via-ssh-first-time)

[← Back to the Guide Center](https://streethosting.com.br/en/guides)
