---
title: "Deploy Eclipse Mosquitto"
description: "MQTT broker: login required, data on a volume, WebSocket and dashboard"
category: "Queues"
url: https://railway.com/deploy/eclipse-mosquitto
---

# Deploy Eclipse Mosquitto

MQTT broker: login required, data on a volume, WebSocket and dashboard

**[Deploy Eclipse Mosquitto on Railway](https://railway.com/template/eclipse-mosquitto)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/eclipse-mosquitto/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Queues

## Template content

### Mosquitto https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/mosquitto.png

- **Source:** https://github.com/aalfath/mosquitto-railway-template
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host Eclipse Mosquitto on Railway

Eclipse Mosquitto is a small, open-source MQTT broker from the Eclipse Foundation. Devices, apps and services publish messages to topics, and the broker delivers them to every subscriber. It supports MQTT 5.0, 3.1.1 and 3.1, QoS 0–2, retained messages and persistent sessions, and since 2.1 it ships a built-in web dashboard.

## About Hosting Eclipse Mosquitto

This template runs Mosquitto 2.1.2 from the official image, pinned by digest, as one service built from a public GitHub repo. Every client has to log in: the username is `mqtt` and the password is generated at deploy. Plain MQTT is reachable through a Railway TCP proxy, and from other services over the private network on port 1883. The service's HTTPS domain carries MQTT over WebSocket at `/mqtt` and the Mosquitto dashboard at `/`, behind the same login. Retained messages, persistent sessions and queued messages are saved to a volume, so they survive restarts and redeploys. After deploy, copy `MQTT_URL` or `MQTT_PUBLIC_URL` from the service's variables.

## Common Use Cases

* Collect sensor data from ESP32, Arduino or Raspberry Pi devices, or from Home Assistant, Node-RED and Zigbee2MQTT
* Pass events between backend services and workers in the same Railway project
* Push live updates to browsers and mobile apps over MQTT on WebSocket

## Dependencies for Eclipse Mosquitto Hosting

* The official `eclipse-mosquitto` Docker image (2.1.2, Alpine)
* A Railway volume for the persistence file, a TCP proxy for MQTT and a Railway domain for WebSocket and the dashboard

### Deployment Dependencies

* [Mosquitto website and documentation](https://mosquitto.org/documentation/)
* [Mosquitto 2.1.2 release and changelog](https://github.com/eclipse-mosquitto/mosquitto/blob/v2.1.2/ChangeLog.txt)
* [Official Docker image](https://hub.docker.com/_/eclipse-mosquitto)
* [Template repo: aalfath/mosquitto-railway-template](https://github.com/aalfath/mosquitto-railway-template)

### Implementation Details

| Where | Address |
|---|---|
| Other Railway services | `${{Mosquitto.MQTT_URL}}` (`mqtt://mqtt:PASSWORD@mosquitto.railway.internal:1883`) |
| Outside Railway, plain MQTT | `${{Mosquitto.MQTT_PUBLIC_URL}}` (TCP proxy host and port; unencrypted) |
| Outside Railway, encrypted | `wss://YOUR-DOMAIN/mqtt` on port 443 |
| Dashboard | `https://YOUR-DOMAIN/`, log in with `mqtt` and `MQTT_PASSWORD` |

Anonymous logins are refused on every listener. To add more users, set `MQTT_EXTRA_USERS` on the service as `user1:password1,user2:password2` and redeploy; to change the password, change `MQTT_PASSWORD` and redeploy. The health check is `/healthz`. Updates: when the repo moves to a new Mosquitto version, Railway shows an "update available" notice on your project; read the repo's `CHANGELOG.md`, then apply it.

## Why Deploy Eclipse Mosquitto 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 Eclipse Mosquitto 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

- [Celery | Web, Worker and Scheduler as Three Services](https://railway.com/deploy/celery-or-web-work-1) — Web, worker and scheduler wired up: Celery on Redis, outcomes in Postgres.
- [Redpanda](https://railway.com/deploy/redpanda-1) — Redpanda 26.2: Kafka-compatible streaming broker with Kafbat UI console
- [smoothmq](https://railway.com/deploy/AJv-64) — A drop-in replacement for AWS SQS

Open this page in a browser: https://railway.com/deploy/eclipse-mosquitto
