---
title: "Free Discord Bot Hosting 24/7 - Python & Node.js | FPS.ms"
description: "Host your Discord bot for free on FPS.ms. Step-by-step setup for Python (discord.py) and Node.js (discord.js) with 24/7 uptime."
url: https://fps.ms/docs/discord-bots/installation
---
# Installation

Host your Discord bot for free on FPS.ms with Python or Node.js. Upload your code, set up dependencies, and your bot runs 24/7. This guide walks you through the full setup for both languages.

## Prerequisites

Before you start, make sure you have:

1. **An FPS.ms account** — [create your first server](https://fps.ms/docs/getting-started/how-to-create-first-server.md) then open the **Containers** tab on the Deploy page and choose **Python** or **NodeJS**
2. **A Discord bot token** — follow our [getting your bot token](https://fps.ms/docs/discord-bots/getting-your-bot-token.md) guide if you don't have one yet
3. **Your bot code** ready to upload

!!! info "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 executing `app.py` as the entry point by default. 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 entry point filename in the **Startup** tab if needed.

!!! danger "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:

```py title="app.py"
import os
from dotenv import load_dotenv
import discord
load_dotenv()

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'])
```

!!! tip "Security" "Never hardcode your bot token directly in your code. Store it in a `.env` file instead — see our [environment variables guide](https://fps.ms/docs/discord-bots/using-environment-variables.md) to set this up on FPS.ms."

### 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.

```txt title="requirements.txt"
discord.py
python-dotenv
```

You can also install additional packages via the **Startup** tab under **Additional Python packages** without editing `requirements.txt`.

!!! danger "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

1. Upload `app.py` and `requirements.txt` to your server via the **Files** tab in the panel or through [SFTP](https://fps.ms/docs/getting-started/connecting-to-sftp.md)
2. Create a `.env` file with your bot token — see the [environment variables guide](https://fps.ms/docs/discord-bots/using-environment-variables.md)
3. 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 runs your Node.js bot by executing the start script defined in `package.json`. You have three ways to get your code onto the server.

### Upload methods

| Method | Best for | How it works |
|--------|----------|--------------|
| **GitHub repository** | Active development | Enter your repo details in the **Startup** tab, then press **Reinstall Server** |
| **SFTP upload** | Large projects | Upload your project folder via [SFTP](https://fps.ms/docs/getting-started/connecting-to-sftp.md) |
| **Panel file manager** | Quick edits | Create and edit files directly in the **Files** tab |

!!! danger "Important" "Do not upload the `node_modules` or `.npm` cache folders. FPS.ms generates these automatically from your `package.json`."

#### Using a GitHub repository

To deploy from GitHub:

1. Go to the **Startup** tab on the panel
2. Enter your **Git Repo Address** (e.g., `https://github.com/yourname/your-bot`)
3. Optionally set the **Branch**, **Git Username**, and **Git Access Token** (required for private repos)
4. If you have existing files on the server, select all files and delete them first
5. Click **Reinstall Server** to pull the code from GitHub
6. Your repo will be pulled fresh on reinstall, and updated automatically on every restart if **Auto Update** is enabled

!!! warning "Clear files first" "If you already have files on the server, delete them before reinstalling from GitHub. Otherwise the clone may fail because the directory is not empty."

### 1. Create your project files

You need at minimum three files. Here is a working example based on the [official Discord.js guide](https://discordjs.guide/):

```json title="package.json"
{
    "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",
        "dotenv": "latest"
    }
}
```

```js title="index.js"
require('dotenv').config();
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);
```

!!! tip "Security" "This example reads the token from the `BOT_TOKEN` environment variable. Store it in a `.env` file on your server — see our [environment variables guide](https://fps.ms/docs/discord-bots/using-environment-variables.md)."

### 2. Upload and start

1. Upload your project files using one of the [methods above](#upload-methods)
2. Create a `.env` file with your bot token
3. 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.

!!! info "Using TypeScript?" "FPS.ms supports TypeScript natively via `ts-node`. Set the **Main file** in the Startup tab to your `.ts` file (e.g., `index.ts`) and it will run directly — no 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 |

## Next steps

Your bot is now running 24/7 on FPS.ms. Here is what to do next:

- [Edit your bot code](https://fps.ms/docs/discord-bots/editing-code.md) — update files via the panel, SFTP, or VS Code live sync
- [Set up environment variables](https://fps.ms/docs/discord-bots/using-environment-variables.md) — securely manage your bot token and config
- [Add slash commands](https://fps.ms/docs/discord-bots/adding-slash-commands.md) — make your bot interactive with modern Discord commands
- [Create a schedule](https://fps.ms/docs/getting-started/creating-schedules.md) — set up automatic restarts or timed tasks
- [Upload files via SFTP](https://fps.ms/docs/getting-started/connecting-to-sftp.md) — transfer files securely to your server

## 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` |
| `TOKEN_INVALID` | Wrong or missing bot token | Check your token in the `.env` file |
| 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](https://fps.ms/docs/discord-bots/troubleshooting.md) or join the [FPS.ms Discord server](https://fps.ms/discord).

---

[FPS.ms](https://fps.ms/index.html.md) · [All pages](https://fps.ms/llms.txt) · [Documentation](https://fps.ms/docs/llms.txt)
