---
title: "Deploy DiscordJS ESM"
description: "DiscordJS ESM bot boilerplate with Railway deployment and dev scripts."
category: "Bots"
url: https://railway.com/deploy/discordjs-esm
---

# Deploy DiscordJS ESM

DiscordJS ESM bot boilerplate with Railway deployment and dev scripts.

**[Deploy DiscordJS ESM on Railway](https://railway.com/template/discordjs-esm)**

- **Creator:** Dash Desai's Projects
- **Category:** Bots
- **Total deploys:** 5

## Template content

### discordjs-bot-railway-template

- **Source:** https://github.com/dashdesai/discordjs-bot-railway-template

## Documentation

# 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

- [Railway CLI documentation](https://docs.railway.app/develop/cli)
- [Discord Developer Portal](https://discord.com/developers/applications)
- [DiscordJS Guide (Installations & Preparations)](https://discordjs.guide/#before-you-begin)

### Implementation Details

```bash
# 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.


## Similar templates

- [Telegram JavaScript Bot](https://railway.com/deploy/5lRkWa) — A template for Telegram bot in JavaScript using grammY
- [Cobalt Tools [Updated Aug ’26]](https://railway.com/deploy/cobalt) — Cobalt Tools [Aug ’26] (Media Downloader, Converter & Automation) Self Host
- [Telegram Gateway](https://railway.com/deploy/railway-telegram-gateway) — Multi-bot Telegram webhook gateway with WebSocket event streaming

Open this page in a browser: https://railway.com/deploy/discordjs-esm
