DiscordJS ESM
DiscordJS ESM bot boilerplate with Railway deployment and dev scripts.
discordjs-bot-railway-template
dashdesai/discordjs-bot-railway-template
Just deployed
Deploy and Host DiscordJS ESM on Railway
DiscordJS ESM is a modern boilerplate for building Discord bots using Discord.js with ECMAScript Modules (ESM) instead of the older CommonJS format. It aligns with the latest JavaScript standards and simplifies deployment by including everything needed to run the bot locally or on Railway with minimal setup.
About Hosting DiscordJS ESM
Hosting a DiscordJS ESM bot involves setting up a Discord application, configuring bot commands, and deploying the code to a cloud platform. This template provides a pre-configured environment for Railway, including a railway.json
file, Node.js .gitignore
, and helpful npm scripts for registering and running your bot. Designed for simplicity, the boilerplate covers DiscordJS setup using ESM syntax while streamlining development and deployment workflows. Whether testing locally or deploying to production, this template supports both with clear command-line instructions and environment configuration.
Common Use Cases
- Running modern Discord bots with ESM syntax
- Hosting slash-command-based bots without managing infrastructure
- Rapidly deploying Discord bots to test features or demos
Dependencies for DiscordJS ESM Hosting
- Node.js 18+ (for native ESM support)
- Discord.js (latest version with ESM support)
Deployment Dependencies
Implementation Details
# Register slash commands
npm run register-commands
# Run the bot locally in dev mode
npm run dev
# Deploy to Railway
railway up
# Switch back to local development
railway down && npm run dev
⚠️ You can safely ignore the Use --omit=dev
warning in the Railway deploy logs.
Why Deploy DiscordJS ESM on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying DiscordJS ESM on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
discordjs-bot-railway-template
dashdesai/discordjs-bot-railway-templateGUILD_ID
The ID of the Discord Server you wish to deploy to
DISCORD_TOKEN
The Bot Token from Discord Developer Portal
APPLICATION_ID
The Application ID from Discord Developer Portal