To host a Discord bot on FPS.ms, create a free Python or Node.js Container, upload your bot's code with its requirements.txt or package.json, add your bot token on the Environment tab and click Start. The server installs your packages, starts your bot and keeps it online 24/7. This guide walks you through both languages.
Prerequisites
Before you start, make sure you have:
- A Container for your bot. Go to panel.fps.ms/deploy, click Containers and choose Python or NodeJS. Every account gets one free Container. See what is a Container?
- A Discord bot token. Follow our getting your bot token guide if you don't have one yet.
- Your bot code, ready to upload.
Python or Node.js?
Not sure which to pick? Python with discord.py is great for beginners, while Node.js with discord.js is better if you already know JavaScript. Both run 24/7 on FPS.ms for free.
Python setup
FPS.ms runs your Python bot by starting app.py. Follow these steps to get your bot online.
1. Create your main file
Create a file named app.py. This is the file FPS.ms runs when your server starts. You can change the file name in the Startup tab if needed.
Important
Your main file must be named app.py (or whatever you set in the Startup tab). Without it, you will see the error: /usr/local/bin/python: can't open file '/home/container/app.py': [Errno 2] No such file or directory
Here is an example discord.py bot:
import os
import discord
class MyClient(discord.Client):
async def on_ready(self):
print(f'Logged on as {self.user}!')
async def on_message(self, message):
if message.author == self.user:
return
print(f'Message from {message.author}: {message.content}')
intents = discord.Intents.default()
intents.message_content = True
client = MyClient(intents=intents)
client.run(os.environ['BOT_TOKEN'])
Security
Never hardcode your bot token in your code. The example reads it from the BOT_TOKEN environment variable, which you add in step 3.
2. Add your dependencies
Create a requirements.txt file listing the Python packages your bot needs. FPS.ms installs these automatically when your server starts. See installing Python packages for pinning versions and fixing pip errors.
discord.py
You can also install additional packages via the Startup tab under Additional Python packages without editing requirements.txt.
Important
Without a requirements.txt or packages listed in the Startup tab, your bot will crash with ModuleNotFoundError: No module named 'discord'. List every package your bot imports.
3. Upload and start
- Upload
app.pyandrequirements.txtto your server via the Files tab in the panel or through SFTP. - Open the Environment tab (under More) and add a variable named
BOT_TOKENwith your bot token as the value. See store your bot token. - Click Start on the Console tab.
Your bot should come online within a few seconds. You will see Logged on as YourBot#1234! in the console when it connects successfully.
Node.js setup
FPS.ms installs the packages from your package.json, then starts the Main file set in the Startup tab (index.js by default) with node. You have three ways to get your code onto the server.
Upload methods
| Method | Best for | How it works |
|---|---|---|
| GitHub repository | Active development | On a paid server, connect your repository on the Deployments tab |
| SFTP upload | Large projects | Upload your project folder via SFTP |
| Panel file manager | Quick edits | Create and edit files directly in the Files tab |
Important
Do not upload the node_modules or .npm cache folders. FPS.ms generates these automatically from your package.json.
Using a GitHub repository
On a paid server, open the Deployments tab and connect your GitHub repository. Every push to your branch then deploys your bot by itself, and you can roll back from the History tab. See deploy from GitHub for the full setup.
GitHub deploys need a paid plan. On a free server, upload your files with SFTP or the Files tab, or upgrade the server.
Already set a Git Repo Address?
If you filled in the Git fields in the Startup tab before, they stay there and keep working: your repo is pulled on reinstall, and on every restart when Auto Update is on.
1. Create your project files
You need at least two files. Here is a working example based on the official discord.js guide:
{
"name": "my-discord-bot",
"version": "1.0.0",
"description": "My Discord bot hosted on FPS.ms",
"main": "index.js",
"scripts": {
"start": "node ."
},
"dependencies": {
"discord.js": "latest"
}
}
const { Client, Events, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});
client.login(process.env.BOT_TOKEN);
Security
This example reads the token from the BOT_TOKEN environment variable. Add it on the Environment tab, see store your bot token.
2. Upload and start
- Upload your project files using one of the methods above.
- Add
BOT_TOKENwith your bot token on the Environment tab. - Click Start on the Console tab.
FPS.ms automatically runs npm install to install your dependencies, then starts your bot. You should see Ready! Logged in as YourBot#1234 in the console.
Using TypeScript?
Set the Main file in the Startup tab to your .ts file, like index.ts. FPS.ms runs it with ts-node, so you do not need to compile to JavaScript first.
Python vs Node.js comparison
| Feature | Python (discord.py) | Node.js (discord.js) |
|---|---|---|
| Entry point | app.py (configurable in Startup) |
index.js (configurable in Startup) |
| Dependencies | requirements.txt |
package.json |
| Language | Python | JavaScript |
| Best for | Beginners, data-heavy bots | JS developers, large-scale bots |
| Community size | Large | Very large |
| Slash commands | Supported | Supported |
Other languages
Discord libraries exist for other languages too, and every Container runtime can run them: JDA on Java, Discord.Net on .NET, discordgo on Go and serenity on Rust. See supported runtimes for the file each runtime starts.
Next steps
Your bot is now running 24/7 on FPS.ms. Here is what to do next:
- Edit your bot code: update files via the panel, SFTP or VS Code live sync
- Store your bot token: manage your token and config safely
- Add slash commands: make your bot interactive with modern Discord commands
- Deploy from GitHub: ship every push automatically on a paid server
- Create a schedule: set up automatic restarts or timed tasks
Troubleshooting
Having issues? Check these common problems:
| Error | Cause | Fix |
|---|---|---|
No such file or directory: app.py |
Missing entry point | Create app.py in the root directory |
ModuleNotFoundError: No module named 'discord' |
Missing dependencies | Create requirements.txt with discord.py |
TokenInvalid or LoginFailure |
Wrong or missing bot token | Check BOT_TOKEN on the Environment tab and restart |
KeyError: 'BOT_TOKEN' |
The variable is not set | Add BOT_TOKEN on the Environment tab and restart |
| Bot starts but goes offline | Code error or crash loop | Check the Console tab for error messages |
Cannot find module 'discord.js' |
Missing package.json |
Upload your package.json with discord.js as a dependency |
For more help, see our full troubleshooting guide, fix an app that will not start, or join the FPS.ms Discord server.