Deploy a Discord Bot from GitHub to Pterodactyl Without Manual FTP

Published on

A practical workflow for deploying Discord bots from GitHub to a Pterodactyl-style panel using Git, environment variables, and restart steps.

Manual FTP uploads work, but they get annoying fast. Modern bot development is easier when your code lives in GitHub or GitLab and deployments follow a repeatable checklist.

This guide explains a clean Git-based deployment workflow for Discord bots on a Pterodactyl-style hosting panel.

Why Git deployment is better

FTP encourages mistakes:

  • Uploading old files
  • Forgetting one dependency file
  • Editing production code directly
  • Losing track of what changed
  • Accidentally uploading .env

Git gives you history, rollback, branches, and a clear source of truth.

Repository checklist

Your bot repository should include these files.

For Node.js:

package.json
package-lock.json or pnpm-lock.yaml
src/ or index.js
README.md
.env.example

For Python:

requirements.txt
bot.py or main.py
cogs/
README.md
.env.example

Do not commit your real .env file. Use .env.example to document required variables.

Environment variables

Store secrets in the panel, not in Git.

Common variables:

DISCORD_TOKEN=your-token
CLIENT_ID=your-application-id
GUILD_ID=optional-test-server
DATABASE_URL=optional-database-url
LOG_LEVEL=info

Your code should read from process.env in Node.js or os.getenv() in Python.

Basic Git pull workflow

A simple deployment flow:

  1. Push code to GitHub.
  2. Open the hosting panel.
  3. Stop the bot.
  4. Pull the latest repository changes.
  5. Install dependencies.
  6. Start the bot.
  7. Check logs.

For Node.js, the install step is usually:

npm install --production

For Python:

pip install -r requirements.txt

Startup commands

A clear startup command prevents confusion.

Node.js examples:

node index.js
npm start

Python examples:

python3 bot.py
python3 main.py

Choose one standard entry point and document it in your README.

Private repositories

Private repositories need authentication. Use a deploy key or token generated specifically for deployment. Do not use your personal password.

Security checklist:

  • Read-only deploy key when possible
  • Separate token from your Discord bot token
  • Rotate tokens when staff leave
  • Never paste secrets into public console logs

Database migrations

If your bot uses a database, deployment may need a migration step.

Examples:

npm run migrate
python3 manage.py migrate

Run migrations before starting the bot when the new code expects a new schema.

Rollback plan

Every deployment should have a rollback path:

  • Know the previous working commit
  • Keep backups of important database data
  • Watch logs after deploy
  • Do not deploy major changes during peak community hours

Git makes rollback easier because you can return to a known commit instead of guessing which file changed.

Recommended Space-Node workflow

For most customers:

  1. Develop locally.
  2. Push to GitHub.
  3. Deploy through the panel or SFTP when ready.
  4. Store DISCORD_TOKEN as an environment variable.
  5. Let the host keep the bot online 24/7.

That gives you the convenience of Git and the reliability of a bot hosting environment.

Host your Git-based Discord bot on Space-Node

Start Your MC Server Now Today

Join content creators worldwide who trust our Minecraft infrastructure. Setup is instant and support is always available. Start from €0.90/mo (Dirt) or €2.70/mo (Coal) and go live in minutes.