Move your Discord bot to ESN from another host (Replit, Railway, Heroku, VPS)
Step by step: move a Python or Node.js Discord bot to ESN Hosting from Replit, Railway, Heroku, a VPS or another host. Bring your files, token, secrets and data, set the start file, and switch over without downtime surprises.
Already running your Discord bot somewhere else, like Replit, Railway, Heroku, a VPS or another bot host? This guide moves it to ESN Hosting without losing your files, your token or your data. It works for Python and Node.js bots, on every bot plan, from ESN Nano ($0.50/month) up.
Before you start #
- A bot server on ESN that matches your bot's language (Python or Node.js). No server yet? Bot plans start at $0.50/month: see the plans page.
- Access to your old host, so you can download your files and copy your secrets.
- About 10 minutes. Your bot will be offline for a minute or two while you switch.
1. Get your files from your old host #
Pick whichever way your old host offers:
- Another panel or a VPS with SFTP/FTP: skip the download. Use the free built-in importer to pull everything straight into your ESN server. See Import from your old host.
- Replit: open your Repl, open the three-dots menu in the Files pane and choose Download as zip.
- GitHub or another Git repo (common on Railway and Heroku): download the repo as a
.zipfrom its page. - Anything else: download your bot's folder as a
.zip, or copy it with an SFTP app like FileZilla or WinSCP.
node_modules, venv or .venv, __pycache__ and .git. ESN installs your packages itself every time the bot starts. Do bring any data files your bot writes, such as .db, .sqlite or .json files.2. Upload to ESN #
- Open your server on the panel and go to Files.
- Choose Upload and pick your
.zip. Then open its menu (the three dots) and choose Unarchive. - Make sure your main file sits in the top folder. If the zip made an extra folder, move the files up out of it.
Big bot or lots of files? Use SFTP instead. See Using SFTP.
3. Bring your token and secrets #
Most hosts keep your token outside your code, in a place called Secrets (Replit), Variables (Railway) or Config Vars (Heroku). Those don't come with your files, so copy them over:
- In Files on ESN, choose New File.
- Add one line per secret, using the same names your code already uses, with no quotes or spaces around the
=:DISCORD_TOKEN=your-token-here DATABASE_URL=your-database-url-if-you-have-one - Save it as
.envin the top folder.
If your code doesn't load .env yet, add it:
- Python: add
python-dotenvtorequirements.txt, then near the top of your main file:
Your existingfrom dotenv import load_dotenv load_dotenv()os.getenv("DISCORD_TOKEN")oros.environ["DISCORD_TOKEN"]lines then keep working. - Node.js: add
dotenvtopackage.json, then put this on the first line of your main file:
Your existingrequire("dotenv").config();process.env.DISCORD_TOKENkeeps working.
.env. See Create a Discord bot and get its token.4. Remove old-host leftovers #
- Keep-alive web servers: on Replit many bots run a small Flask or Express server (often
keep_alive.pyorkeepAlive.js) plus an uptime pinger to stay awake. ESN runs your bot 24/7, so you can remove thekeep_alive()call and that file. See Keep a bot online 24/7. - Procfile, railway.json, .replit and replit.nix: ESN doesn't use these. They're safe to delete or leave.
- Built-in databases: data in your old host's own database add-on (for example Replit Database) is not in your zip. Export it before you cancel the old host, or switch your bot to a file such as SQLite or JSON that moves with your files. An external database (like MongoDB Atlas) keeps working: just put its connection string in
.env.
5. Set the start file and packages #
- Go to Startup and set the file that runs your bot: Main Python File (default
main.py) or Main JavaScript File (defaultindex.js). Type the exact name, capitals included. If your old host started the bot with something likepython bot.pyornode src/index.js, use that file. More detail: Startup settings. - Check your package list is in the top folder:
requirements.txtfor Python,package.jsonfor Node.js. On Replit, Python packages are often listed only inpyproject.toml, so make arequirements.txtwith one package per line, for examplediscord.pyandpython-dotenv. See Install packages for your bot.
6. Stop the old copy, then start on ESN #
- Stop the bot on your old host first. If two copies run with the same token, every command answers twice and things get confusing.
- On ESN, go to Console and press Start. You'll see packages install, then your bot's own messages, like "Logged in as YourBot".
- Test a couple of commands in Discord. If everything works, you can cancel the old host.
If it doesn't work #
- "Improper token" or "TokenInvalid": the token in
.envis wrong, has spaces or quotes, or the name doesn't match the one in your code. - "ModuleNotFoundError" or "Cannot find module": a package is missing from
requirements.txtorpackage.json, or your start file name is wrong. - Commands answer twice: the old copy is still running. Stop it on your old host.
- Data is missing: your data file wasn't in the zip, or it lived in the old host's database add-on. Copy the file over, or export the data.
More fixes: Common bot errors and Troubleshooting.
Still stuck? Use the live chat on the panel or ask in the ESN Systems Discord. Last updated October 31, 2026.