Discord Bot Hosting Overview
Galaxy Nexus provides reliable, always-on hosting for Discord bots in every major language. Whether you're running a moderation bot, music player, or custom community tool, we keep it online.
Supported Languages
| Language | Runtime | Best For |
|---|---|---|
| Node.js | v20 LTS | Discord.js bots, slash commands, webhooks |
| Python | 3.11+ | discord.py, Pycord, simple automation |
| Java | 21 | JDA bots, Minecraft-Discord bridges |
| Go | 1.22+ | High-performance bots, custom gateways |
| Rust | stable | Low-resource bots, embedded systems |
Custom Dependencies
You can install additional packages via package.json (Node.js), requirements.txt (Python), or your language's build system. The build step runs automatically on deployment.
How It Works
Create Your Bot on Discord
- Go to the Discord Developer Portal
- Click New Application, give it a name
- Go to the Bot tab, click Add Bot
- Copy the token — you'll need it for deployment
Set Up Intents
In the Discord Developer Portal, under Bot → Privileged Gateway Intents, enable the intents your bot needs:
- Message Content Intent — required to read message text
- Server Members Intent — required to access member lists
- Presence Intent — required to see user statuses
Only enable what you actually use. Extra intents consume more resources.
Write Your Bot Code
Structure your project so the bot starts from a single entry point:
Node.js: index.js or src/index.js
Python: main.py or bot.py
Java: a compiled .jar file
Go: compiled binary
The entry point is what Galaxy Nexus runs when it starts your bot.
Deploy to Galaxy Nexus
- Navigate to Discord Bots from the main menu
- Choose your language and plan size
- Upload your bot code or connect a Git repository
- Configure your bot token as an environment variable
- Click Deploy
Monitor and Manage
Once deployed, your dashboard shows:
- Status: online / offline / starting
- Uptime: how long the bot has been running
- RAM usage: current memory consumption
- Guild count: how many servers your bot is in
- Console: real-time log output
Environment Variables
Store secrets like your bot token in environment variables, not in your code:
| Variable | Description | Required |
|---|---|---|
DISCORD_TOKEN | Your bot token from the Developer Portal | Yes |
DISCORD_CLIENT_ID | Your application's client ID | Recommended |
DISCORD_GUILD_ID | Development guild for slash commands | Optional |
DATABASE_URL | Database connection string | Optional |
API_KEY | Any third-party API keys | Optional |
Set these in your bot's control panel under Settings → Environment Variables. They're injected at runtime and never visible in your code or logs.
Never Commit Your Token
If your bot token ends up in a public repository, Discord will automatically revoke it. Always use environment variables and add .env to your .gitignore.
Sharding
When your bot grows past 2,500 guilds, Discord requires sharding. Each shard handles a subset of guilds.
Automatic Sharding (Recommended)
Most libraries handle sharding automatically when you pass a shardCount:
// Discord.js v14
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [GatewayIntentBits.Guilds],
shards: 'auto' // Automatically calculates optimal shard count
});
client.login(process.env.DISCORD_TOKEN);# discord.py
import os
import discord
from discord.ext import commands
bot = commands.Bot(
command_prefix='!',
intents=discord.Intents.default(),
shard_count=2 # Adjust based on guild count
)
bot.run(os.getenv('DISCORD_TOKEN'))Sharding on Galaxy Nexus
When deploying with sharding, set the shard count in your bot's configuration. The panel splits shards across available CPU resources automatically.
| Guild Count | Recommended Shards |
|---|---|
| < 2,500 | 1 (auto) |
| 2,500 – 5,000 | 2 |
| 5,000 – 10,000 | 4 |
| 10,000+ | Contact support for custom plan |
Monitoring
Your dashboard shows real-time metrics:
- Console: stream your bot's stdout/stderr output
- Resource graphs: CPU, RAM, and network usage over time
- Guild history: track server adoption
- Error logs: filter and search past errors
Log Errors for Debugging
Use your language's standard logging instead of console.log / print. Structured logs make it easier to find issues:
// Node.js: pino or winston
const logger = require('pino')();
logger.info({ event: 'command_run', command: 'ping', guild: guild.id });
// Python: built-in logging
import logging
logging.basicConfig(level=logging.INFO)
logging.info(f'Bot online as {bot.user}')Next Steps
- Deploy your first bot
- Configure auto-restart in your bot settings
- Set up a database for persistent data
- Join the Discord community for help