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:
- Push code to GitHub.
- Open the hosting panel.
- Stop the bot.
- Pull the latest repository changes.
- Install dependencies.
- Start the bot.
- 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:
- Develop locally.
- Push to GitHub.
- Deploy through the panel or SFTP when ready.
- Store
DISCORD_TOKENas an environment variable. - Let the host keep the bot online 24/7.
That gives you the convenience of Git and the reliability of a bot hosting environment.