New to CraftNodes? Use code WELCOME10 at checkout for 10% off your first month.

Back to Blog

May 13, 2026

Getting Started with Node.js Discord Bots on CraftNodes

A beginner guide to hosting Node.js Discord bots on CraftNodes. Deploy discord.js bots in minutes with Pterodactyl panel support.


Why Node.js for Discord Bots?

Node.js is the most popular runtime for Discord bots. The discord.js library is mature, well-documented, and has a huge community. CraftNodes Discord Bot plans come with Node.js pre-installed.

Creating a Basic discord.js Bot

A basic bot needs three files: package.json declaring your dependencies, index.js as the entry point, and a .env file for your bot token.

Install dependencies locally with npm install discord.js then upload all files including node_modules — or let the startup script run npm install automatically.

Uploading to CraftNodes

Upload your project files via the Pterodactyl file manager. In the Startup tab, set the main file to index.js. Add your DISCORD_TOKEN environment variable. Click Start.

Handling Restarts

CraftNodes servers auto-restart if your bot crashes. For cleaner restarts, use a process manager pattern in your code and catch unhandled promise rejections.

Using a Database

For persistent data, JSON files work for small bots. For production use, connect to a remote MongoDB Atlas cluster or use SQLite with better-sqlite3.


All posts

CraftNodes Blog