---
title: "Deploy n8n Discord Bot"
description: "Discord alerts and moderation bots with n8n"
category: "Automation"
url: https://railway.com/deploy/n8n-discord-bot
---

# Deploy n8n Discord Bot

Discord alerts and moderation bots with n8n

**[Deploy n8n Discord Bot on Railway](https://railway.com/template/n8n-discord-bot)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/n8n-discord-bot/manifest.json

- **Creator:** onepush
- **Category:** Automation

## Template content

### n8n

- **Image:** n8nio/n8n:2.36.8
- **Health check:** /healthz
- **Public domain:** Yes

### n8n-worker

- **Image:** n8nio/n8n:2.36.8
- **Start command:** `n8n worker`
- **Health check:** /healthz

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

## Documentation

# Deploy and Host self hosted n8n Discord Bot (Open-Source Discord Automation) on Railway

n8n Discord Bot is a queue-mode n8n stack for Discord alerts, slash commands, moderation bots, and channel automation. Workers run heavy workflows while the editor stays responsive for webhook and Discord trigger traffic.


## About Hosting n8n Discord Bot open-source software on Railway (self hosted n8n template)

n8n is a fair-code licensed workflow automation platform that connects Discord to hundreds of services via a visual node editor. This Railway template runs n8n in queue mode with a dedicated worker, PostgreSQL, and Redis for Bull queue management, so Discord slash commands, moderation, and alerts never block the editor. You control your bot's logic without per-execution fees, keeping Discord tokens and workflow data inside your Railway project. The editor handles workflow design and webhooks; the worker executes jobs from Redis. PostgreSQL stores workflows and credentials; Redis brokers jobs. This separation handles Discord event bursts without freezing the editor.

For a smaller instance without workers, use the [cheapest n8n without queue mode](https://railway.com/deploy/n8n).

## Why Deploy n8n Discord Bot, the Zapier alternative on Railway (Railway Free Trial)

Zapier charges per task and locks advanced Discord automation behind premium tiers. A bot reacting to messages and running slash commands can burn thousands of tasks monthly, pushing you into $50+ plans. n8n flips that: you pay for infrastructure, not executions. On Railway, a queue-mode n8n Discord bot stack typically costs $10–$25 per month, with no per-task fees.

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 n8n Discord Bot 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.

The $5 free trial on GitHub signup lets you test this exact queue-mode Discord bot stack before committing. Deploy editor, worker, PostgreSQL, and Redis, connect your Discord bot token, and run real slash commands—all within trial credit. Scale the worker horizontally later without changing workflows.

### Railway vs Other Hosting Providers and VPS for n8n Discord Bot self hosting

| Provider | Setup Complexity | Scaling Model | Monthly Cost for Queue Mode | Best For |
|---|---|---|---|---|
| DigitalOcean | High—manual Docker Compose, reverse proxy, TLS, Redis/Postgres setup | Manual droplet resizing or Kubernetes | $18–$40+ | Teams comfortable with server admin |
| AWS | Very high—ECS/EKS, VPC, IAM, RDS, ElastiCache, ALB | Auto-scaling groups with significant config | $30–$80+ | Enterprise with AWS footprint |
| Hetzner | Medium—dedicated/cloud server, manual service management | Manual vertical scaling or Swarm | $10–$25 | Budget self-hosters with ops skills |
| Railway | Low—template deploys editor, worker, Postgres, Redis together | One-click horizontal scaling per service | $10–$25 typical | Discord bot builders without ops burden |

Railway eliminates glue work: no reverse proxy, no manual Redis/Postgres provisioning, no Compose file. The template wires services with internal networking. Scale the worker independently when needed.

## Common Use Cases for hosted n8n Discord Bot

**Slash command workflows.** Build `/report`, `/lookup`, `/assign` commands that trigger n8n workflows. The Discord trigger receives the interaction, your workflow calls APIs or queries Postgres, and returns a response. Queue mode keeps slow handlers from blocking other events.

**Moderation and anti-spam.** Listen for messages, run content through regex, sentiment, or LLM classifiers, and auto-delete, warn, or timeout. Log moderation actions in Postgres and notify moderators.

**Channel alerts and announcements.** Pipe GitHub releases, RSS, Stripe payments, or uptime monitors into Discord. Schedule digests with Cron, format embeds, and route alerts by channel.

**Role and member sync.** Connect Discord to your CRM or database. When users subscribe or churn, n8n updates roles automatically. Run periodic reconciliation jobs.

**AI-powered community bots.** Combine Discord triggers with OpenAI or self-hosted LLM nodes for support bots, FAQ answerers, or summarization. Queue mode keeps long AI calls on the worker.

## Dependencies for n8n Discord Bot Docker hosted on Railway

This template packages the official n8nio/n8n image with Postgres and Redis so Discord bots can run in queue mode without SQLite limits.


### Deployment Dependencies for Managed n8n Discord Bot Service (Discord Automation)

This template deploys four Railway services. The **editor** runs the n8n web app on port 5678, serves the UI, and exposes webhooks. The **worker** runs the same `n8nio/n8n:2.36.8` image with command `n8n worker`, pulling jobs from Redis. **PostgreSQL** stores workflows, credentials, and execution data. **Redis** runs the Bull queue. Both editor and worker share `EXECUTIONS_MODE=queue` and `DB_TYPE=postgresdb`. Both mount a volume at `/home/node/.n8n`. `WEBHOOK_URL` must match your Railway public URL for Discord callbacks.

### Implementation Details for n8n Discord Bot (Using n8n official docker image)

The template pins `n8nio/n8n:2.36.8` for both editor and worker. The worker overrides the command to `n8n worker`. Set `N8N_PROXY_HOPS=1` because Railway adds one proxy hop. Set `N8N_ENCRYPTION_KEY` to a long random string before creating credentials; it encrypts your Discord token and API keys. Losing it makes stored credentials unreadable. `EXECUTIONS_DATA_PRUNE=true` keeps Postgres from growing unbounded. Configure the Discord bot inside the editor: create a Discord application, add a bot, copy the token, and paste into n8n's Discord node credentials. Invite the bot with scopes `bot`, `applications.commands`, and required intents.

## How does n8n Discord Bot compare against other Discord Bot and Chat Automation platforms

Compared with SaaS chat automation and hand-coded Discord bots, this listing focuses on self-hosted queue-mode n8n with workers for alerts, moderation, and ops workflows.


### n8n Discord Bot vs Zapier (Zapier Alternative)

Zapier's Discord integration is limited to a few triggers/actions. n8n gives the full Discord API surface—messages, reactions, roles, channels, webhooks, slash commands—plus JavaScript code nodes. Zapier charges per task; n8n on Railway costs a flat infrastructure fee regardless of event volume.

### n8n Discord Bot vs Make (Make Alternative)

Make's visual builder is powerful but its Discord module lacks depth. Complex workflows often require chaining scenarios. n8n's queue mode scales horizontally for bursty traffic; Make throttles by plan quota. Self-hosting n8n keeps your bot running during Make outages and controls data residency.

### n8n Discord Bot vs Pipedream (Pipedream Alternative)

Pipedream is code-first (Node.js/Python), which suits developers but not community managers. Its free tier has daily invocation limits that busy servers exhaust. n8n's visual builder is accessible to non-developers, and Railway has no execution caps—only provisioned compute.

### n8n Discord Bot vs Discord bots coded by hand (Discord bots coded by hand Alternative)

Hand-coding with discord.js or discord.py demands ongoing maintenance: event loops, reconnects, rate limits, deploys, monitoring. Every feature requires code changes. n8n moves iteration into a visual editor where non-developers can modify workflows without touching the bot core. Code nodes remain for custom JavaScript, but operational burden is handled by n8n and Railway.

## How to use n8n Discord Bot (the OSS Discord Automation)?

Deploy this template on Railway. Editor, worker, Postgres, and Redis come up together. Open the editor, create your owner account, set the encryption key. Add a Discord credential with your bot token. Create a workflow with a Discord Trigger node—choose event (message, slash command, reaction, member join). Add processing nodes: IF, HTTP Request, Postgres, AI. End with a Discord action (send message, add role, delete). For slash commands, register in Discord Developer Portal or via n8n. Test manually, then activate. The worker picks up events from Redis and executes independently.

## How to self host n8n Discord Bot on other VPS Services (n8n Discord Bot self hosting guide)

You can recreate the same Discord bot stack on a VPS, but you must wire editor, worker, Postgres, Redis, WEBHOOK_URL, and a stable encryption key yourself.


### Clone the Repository

For manual VPS deployment, pull the official n8n Docker image. Create a docker-compose.yml defining editor, worker, postgres, and redis with the same environment variables as this template.

### Install Dependencies

Install Docker and Docker Compose. Provision PostgreSQL 14+ and Redis 6+ (containers or managed). Create a database and user. Generate an encryption key with `openssl rand -hex 32`. Expose only port 5678; keep Postgres and Redis internal.

### Configure Environment Variables

Set `EXECUTIONS_MODE=queue`, `DB_TYPE=postgresdb`, and the Postgres connection string in both editor and worker. Set `WEBHOOK_URL` to your public domain, `N8N_PROXY_HOPS=1` if behind a proxy, and `N8N_ENCRYPTION_KEY`. Mount `/home/node/.n8n` on both. Set `EXECUTIONS_DATA_PRUNE=true`.

### Start the n8n Discord Bot Application

Run `docker compose up -d`. The editor initializes the schema. Open your domain, create the owner account, verify the worker in queue status. Add Discord token, build a test workflow, confirm events flow through Redis. Monitor worker logs and set up restart policies.

## Official Pricing of n8n Discord Bot (n8n Discord Bot pricing)

n8n Community Edition is free to self-host. n8n Cloud Starter is about $2

## Similar templates

- [N8N Main + Worker](https://railway.com/deploy/n8n-main-worker) — Deploy and Host N8N with Inactive worker.
- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — Automate WhatsApp workflows with Evolution API, n8n, and Postgres.
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage

Open this page in a browser: https://railway.com/deploy/n8n-discord-bot
