---
title: "Deploy OpenClaw Discord"
description: "OpenClaw Gateway connected to a Discord bot"
category: "AI/ML"
url: https://railway.com/deploy/deploy-openclaw-discord-on-railway
---

# Deploy OpenClaw Discord

OpenClaw Gateway connected to a Discord bot

**[Deploy OpenClaw Discord on Railway](https://railway.com/template/deploy-openclaw-discord-on-railway)**

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

- **Creator:** onepush
- **Category:** AI/ML

## Template content

### OpenClaw

- **Image:** openclaw/openclaw:2026.10.3-browser@sha256:c84c4c37e7b9dc02dd869c9699ba0c4fb20ff821febe4b789bb2f8f4bfd9c8a3
- **Start command:** `/bin/sh -c "set -ef; D=${RAILWAY_VOLUME_MOUNT_PATH:-/data}; mkdir -p $D/.openclaw $D/workspace $D/.config/openclaw; if [ ! -L /home/node/.config/openclaw ]; then rm -rf /home/node/.config/openclaw; ln -s $D/.config/openclaw /home/node/.config/openclaw; fi; find $D ! -user 1000 -exec chown -h 1000:1000 {} +; chmod 700 $D/.openclaw; cd /app; if [ ${#OPENCLAW_RAILWAY_CONFIG} -gt 0 ]; then setpriv --reuid=1000 --regid=1000 --init-groups env HOME=/home/node USER=node node openclaw.mjs config set --batch-json $OPENCLAW_RAILWAY_CONFIG || echo railway-start: config batch failed; fi; exec setpriv --reuid=1000 --regid=1000 --init-groups env HOME=/home/node USER=node tini -s -- node /app/docker-entrypoint.mjs node openclaw.mjs gateway --bind lan --port 18789 --allow-unconfigured"`
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host OpenClaw Discord (Self-Hosted AI Assistant Gateway) on Railway

OpenClaw Discord connects the OpenClaw Gateway to a Discord bot. Create a bot in the Discord Developer Portal, enable the Message Content intent, copy the bot token, add it to the OpenClaw Discord channel config, and invite the bot with an OAuth2 URL.

## About Hosting OpenClaw Discord on Railway (self hosted OpenClaw Discord template)

OpenClaw is an MIT-licensed gateway and control plane for sessions, tools, events, and channels. Discord is one of more than 20 supported channel types, including Telegram, Slack, WhatsApp, Signal, Google Chat, and iMessage.

The start command changes ownership of /data, applies OPENCLAW_RAILWAY_CONFIG as a one-line batch JSON that sets gateway.mode to local, derives publicOrigin and controlUi.allowedOrigins from RAILWAY_PUBLIC_DOMAIN, and sets trustedProxies to 100.64.0.0/10 for Railway's proxy.

## Why Deploy OpenClaw Discord, the ChatGPT alternative on Railway (Railway Free Trial)

You do not need a managed SaaS assistant when you can run the gateway yourself. OpenClaw Discord gives you a bot that responds to mentions, runs shell commands or custom skills inside the container, and keeps conversation state on your own infrastructure.

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 OpenClaw Discord 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.

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

| Provider | Best for OpenClaw Discord | Trade-offs |
|---|---|---|
| DigitalOcean | Droplets with 1-2 GB RAM run the Docker image easily; predictable monthly cost | You manage reverse proxy, TLS, and health checks yourself |
| AWS | ECS or Lightsail can scale, and IAM can restrict access | Configuration overhead is high for a single bot; cost estimation is less transparent |
| Hetzner | Cheap VPS with enough RAM for the browser variant; good for long-running bots | No managed deploy previews; you handle DNS, SSL, and updates manually |

## Common Use Cases for hosted OpenClaw Discord

A self-hosted Discord bot is useful inside your team's existing server. Mention the bot in a support channel to run read-only diagnostics, query an internal API, or summarize a long thread. You can require pairing for unknown DM senders with a code, preventing spam.

Some operators use the Discord bot as a remote trigger for home automation or homelab tasks. Others keep a private Discord server as a mobile-friendly interface to the OpenClaw gateway, so they can approve browser devices, manage sessions, or start a long-running job from their phone.

## Dependencies for OpenClaw Discord Docker hosted on Railway

The OpenClaw Docker image bundles Node.js and the gateway runtime, so you do not install Node separately. The main external dependency is a model provider API key, such as OpenAI or Anthropic, but those are optional at boot and can be added later in the Control UI.

### Deployment Dependencies for Managed OpenClaw Discord Service (AI Assistant)

When you run OpenClaw Discord as a managed Railway service, you need the official OpenClaw Docker image, a Railway volume mounted at /data, fixed environment variables PORT and OPENCLAW_GATEWAY_PORT set to 18789, OPENCLAW_GATEWAY_BIND set to lan, and the generated OPENCLAW_GATEWAY_TOKEN.

### Implementation Details for OpenClaw Discord (Using OpenClaw official docker image)

The Docker image is available as openclaw/openclaw or ghcr.io/openclaw/openclaw, and a browser variant includes Chromium. The service listens on port 18789 and the health check hits /healthz.

To connect Discord, create an application and bot in the Discord Developer Portal, enable the Message Content intent, and copy the bot token. Run `openclaw channels add` from the Railway service shell or use the Control UI to add the Discord channel and paste the token.

## How does OpenClaw Discord compare against other AI assistant platforms

### OpenClaw vs Hermes Agent

- **License and stack:** OpenClaw is MIT-licensed and built around a gateway; Hermes Agent is also MIT but Python-based with a learning loop and skills.
- **Channel focus:** OpenClaw Discord is one of many channels; Hermes Agent typically runs as a local agent first and can migrate from OpenClaw.
- **State model:** OpenClaw keeps channel state and pairing on /data; Hermes stores skills and memory in its own format.

### OpenClaw vs Open WebUI

- **Core purpose:** OpenClaw is an agent gateway with tools, sessions, and channels; Open WebUI is primarily a chat UI for model providers.
- **Discord support:** OpenClaw has a native Discord channel; Open WebUI does not provide a first-class Discord bot gateway.
- **Deployment:** Both run in Docker, but OpenClaw's /data volume holds channel tokens and pairing state, specific to gateway operation.

### OpenClaw vs n8n AI agents

- **Automation model:** n8n is a workflow automation tool with AI nodes and a fair-code license; OpenClaw is an MIT agent gateway.
- **Channel reach:** OpenClaw Discord is one of 20+ channels; n8n can trigger workflows from Discord but is not an assistant-first gateway.
- **Tool execution:** OpenClaw tools run inside the container for the main session unless sandboxed; n8n nodes run in workflow executions.

### OpenClaw vs ChatGPT

- **Ownership:** OpenClaw is self-hosted and free software; ChatGPT is a closed SaaS assistant.
- **Discord integration:** OpenClaw Discord lets you run your own bot with allowlists and pairing; ChatGPT has no self-hosted Discord bot gateway.
- **Cost:** OpenClaw costs only model API usage plus hosting; ChatGPT requires a subscription for advanced features.

## How to use OpenClaw Discord (the OSS AI assistant)?

After the Railway deploy is live, open the public domain, paste the OPENCLAW_GATEWAY_TOKEN into the Control UI settings, and approve the browser device with `openclaw devices approve` in the Railway service shell. Add a model provider key under Settings or Models.

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

### Clone the Repository

OpenClaw is distributed as an npm package and Docker image, not a single repo you must clone for the gateway. To inspect the source, clone the upstream OpenClaw repository from GitHub. For a VPS install, skip cloning and install via npm or Docker.

### Install Dependencies

Install Node.js 24.16+ or 26.1+ on the VPS. Then run `curl -fsSL https://openclaw.ai/install.sh | bash` or `npm install -g openclaw@latest`. This gives you the openclaw CLI and gateway. For Docker, pull openclaw/openclaw or ghcr.io/openclaw/openclaw.

### Configure Environment Variables

Set OPENCLAW_GATEWAY_TOKEN to a long random string. Set OPENCLAW_GATEWAY_PORT to 18789 and OPENCLAW_GATEWAY_BIND to lan. Set OPENCLAW_STATE_DIR, OPENCLAW_CONFIG_DIR, OPENCLAW_CONFIG_PATH, OPENCLAW_WORKSPACE_DIR, HOME, OPENCLAW_HOME, and TZ as needed.

### Start the OpenClaw Discord Application

Run `openclaw gateway --bind lan --port 18789 --allow-unconfigured` or start the Docker container with a volume mounted at /data. Open the Control UI, paste the gateway token, approve the device, add a model provider key, and add the Discord bot token.

## Official Pricing of OpenClaw Discord (OpenClaw pricing)

OpenClaw is free and open source under the MIT license. There is no paid OpenClaw plan and no license fee for the Discord channel. You pay only for model provider API calls, such as OpenAI or Anthropic usage, and for the infrastructure that runs the gateway.

## OpenClaw Discord cloud vs self hosted comparison (Pricing, features, costs, and more)

### Monthly cost of self hosting OpenClaw Discord on Railway

Expect roughly $10 to $25 per month for the Railway service if you use the browser-capable image with Chromium and allocate 1 to 2 GB of RAM. A lighter non-browser image can run on less. Add model provider API costs on top, which vary with usage. There is no OpenClaw license fee.

### System Requirements for Hosting OpenClaw Discord on a VPS

A VPS with 1 GB of RAM can run the basic OpenClaw gateway and Discord channel, but 2 GB is safer if you use the browser variant or run multiple tools. One CPU core is enough for moderate Discord traffic.

## Frequently Asked Questions (FAQs)

### How do I keep the Discord bot connected after a Railway redeploy?

The bot token and pairing state are stored under /data/.openclaw on the Railway volume. As long as the volume persists, redeploys do not disconnect the bot.

### Can I restrict the Discord bot to only certain channels?

Yes. In the Discord channel settings, allowlist guilds, channels, and users. You can also enable mention gating so the bot only responds to direct mentions in busy channels.

### Do I need to enable the Message Content intent?

Yes. In the Discord Developer Portal, enable the Message Content intent for your bot. Without it, the bot cannot read normal message content and the OpenClaw Discord channel will not work correctly.

### How do unknown Discord users start a DM with the bot?

By default, OpenClaw Discord requires pairing for unknown DM senders. The bot gives them a code, and you approve it with `openclaw pairing approve` followed by the channel and code.

### Is OpenClaw Discord free?

OpenClaw is MIT-licensed and free. You pay for model provider API usage and your Railway or VPS hosting, but there is no OpenClaw subscription or license fee.

### Where does the Discord bot token live?

The token is stored in the OpenClaw channel config inside the gateway state directory on the /data volume. It is not stored as a Railway environment variable.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/deploy-openclaw-discord-on-railway
