Deploy EMQX

MQTT broker for IoT: dashboard, MQTT over TCP and WSS, data on a volume

Deploy EMQX

/opt/emqx/data

Deploy and Host EMQX on Railway

EMQX is an MQTT broker for IoT devices, sensors and apps. Devices publish messages to topics, and EMQX routes them to every client subscribed to those topics. It supports MQTT 3.1, 3.1.1 and 5.0 over TCP and WebSocket, and comes with a web dashboard for clients, users, rules and monitoring.

About Hosting EMQX

This template runs EMQX 6.3.3 as one Railway service, built from a public GitHub repo that pins the official emqx/emqx image. Caddy, in the same container, puts the dashboard and MQTT over WebSocket (wss://YOUR-DOMAIN/mqtt) on the Railway domain, and a TCP proxy exposes plain MQTT on port 1883. MQTT clients must log in: the first user and the dashboard password are generated at deploy, and anonymous logins are refused. EMQX's built-in database (users, rules, retained messages, settings) lives on a volume, so it survives redeploys. New versions show up in Railway as an update you apply when you choose.

Common Use Cases

  • Collect telemetry from IoT devices, sensors and home automation systems
  • Send commands and live updates to devices, mobile apps and web dashboards
  • Route MQTT messages to other services with EMQX rules and webhooks

Dependencies for EMQX Hosting

  • One Railway service with a volume (no external database needed)
  • An MQTT client or library to connect devices (for example MQTTX, mosquitto clients or Paho)

Deployment Dependencies

Implementation Details

After deploy, open the Railway domain and sign in as admin with the EMQX_DASHBOARD__DEFAULT_PASSWORD variable. Connect MQTT clients with the MQTT_USERNAME and MQTT_PASSWORD variables:

  • MQTT over TCP: mqtt://RAILWAY_TCP_PROXY_DOMAIN:RAILWAY_TCP_PROXY_PORT (shown under the service's Networking settings)
  • MQTT over WebSocket: wss://YOUR-DOMAIN/mqtt on port 443
  • Inside the Railway project: mqtt://emqx.railway.internal:1883

Add more MQTT users in the dashboard under Access Control, Authentication. This is a single EMQX node. EMQX 5.9 and later is released under the Business Source License 1.1, which allows free production use of a single node in your own environment; clustering or reselling EMQX as a hosted service needs a commercial license from EMQ.

Why Deploy EMQX 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 EMQX 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

More templates in this category

View Template
Celery | Web, Worker and Scheduler as Three Services
Web, worker and scheduler wired up: Celery on Redis, outcomes in Postgres.

Templates Guru
0
View Template
Redpanda
Redpanda 26.2: Kafka-compatible streaming broker with Kafbat UI console

Agaz Self-Host
2
View Template
smoothmq
A drop-in replacement for AWS SQS

poundifdef
7