A Discord bot on a VPS stays online 24/7. Minimum: Node.js (or Python), the token outside code, and a process that survives SSH.
Steps
Install Node.js LTS and create the project:
sudo apt updatesudo apt install -y nodejs npmmkdir -p ~/discord-bot && cd ~/discord-botnpm init -y && npm install discord.jsStore the token in an env file (do not commit it):
nano ~/discord-bot/.envDISCORD_TOKEN=your_secret_tokenStart the bot (example) and keep it in tmux:
tmux new -s discordbotcd ~/discord-bot && node index.js
Tips
- Revoke and regenerate the token if it leaks.
- For production use a systemd unit with Restart=always.
ext step
A stable VPS for bots and games: Browse game servers.