---
title: "Deploy Rocket.Chat"
description: "Open-source Slack alternative: Rocket.Chat with a MongoDB replica set."
category: "Other"
url: https://railway.com/deploy/rocketchat-89
---

# Deploy Rocket.Chat

Open-source Slack alternative: Rocket.Chat with a MongoDB replica set.

**[Deploy Rocket.Chat on Railway](https://railway.com/template/rocketchat-89)**

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

- **Creator:** Tasha
- **Category:** Other
- **Total deploys:** 7

## Template content

### Rocket.Chat

- **Image:** rocketchat/rocket.chat:8.9.1
- **Health check:** /api/info
- **Public domain:** Yes

### MongoDB

- **Image:** mongo:7.0
- **Start command:** `sh -c 'docker-entrypoint.sh mongod --replSet rs0 --bind_ip_all & until mongosh --quiet --eval "db.adminCommand({ping:1})" >/dev/null 2>&1; do sleep 1; done; mongosh --quiet --eval "try{if(!rs.status().ok){throw 1}}catch(e){rs.initiate({_id:\"rs0\",members:[{_id:0,host:\""$RAILWAY_PRIVATE_DOMAIN"\:27017\"}]})}"; wait'`

## Documentation

# Deploy and Host Rocket.Chat on Railway

[Rocket.Chat](https://www.rocket.chat) is an open-source team chat and customer-engagement platform — a self-hosted alternative to Slack and Microsoft Teams, with channels, direct messages, voice/video, and a livechat widget for your website. This template runs Rocket.Chat with a correctly configured MongoDB.

## About Hosting Rocket.Chat

Rocket.Chat is a Meteor application backed by MongoDB. The part almost every self-hosted setup gets wrong is the database: Rocket.Chat's realtime features (new messages appearing instantly, presence, livechat) depend on MongoDB running as a **replica set** so it can use change streams. A plain, standalone MongoDB boots fine but leaves realtime broken, which is why so many Rocket.Chat templates work at first and then feel dead. This template ships MongoDB pre-initialized as a single-node replica set, on the private network, with its data on a persistent volume, and connects Rocket.Chat to it with an admin account created for you.

## Why Deploy Rocket.Chat on Railway?

Railway provisions Rocket.Chat and MongoDB, the private networking between them, and the database volume from this one template in one click. Compared with other Rocket.Chat templates, this one fixes what makes them unreliable:

- **Realtime actually works.** MongoDB is initialized as a replica set (rs0) automatically on first boot, so messages, presence, and livechat update live — not after a refresh.
- **Nothing is lost.** MongoDB (including uploaded files via GridFS) is stored on a persistent volume.
- **Log in immediately.** An admin is created on first boot from ADMIN_USERNAME / ADMIN_PASS, and the setup wizard is skipped.
- **Pinned versions** of both Rocket.Chat and MongoDB for reproducible deploys.

## Common Use Cases

- Internal team chat as a self-hosted Slack or Teams replacement
- A customer support / livechat channel embedded on your website
- A private, data-resident community or client workspace

## Dependencies for Rocket.Chat Hosting

- A MongoDB replica set (included and auto-configured in this template)
- A persistent volume for the database (included)

### Deployment Dependencies

- [Rocket.Chat documentation](https://docs.rocket.chat)
- [Rocket.Chat Docker deployment](https://docs.rocket.chat/docs/deploy-with-docker-docker-compose)

### Implementation Details

On first login, use ADMIN_USERNAME (default admin) and copy ADMIN_PASS from the Rocket.Chat service's Variables tab; change them afterwards. MongoDB runs as replica set rs0 and is reachable only on the project's private network; Rocket.Chat connects to it via MONGO_URL. The database and all uploaded files persist on the MongoDB volume at /data/db.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/rocketchat-89
