---
title: "Deploy MAS and Synapse"
description: "we use mas and synapse for homeserver"
category: "Automation"
url: https://railway.com/deploy/mas-and-synapse
---

# Deploy MAS and Synapse

we use mas and synapse for homeserver

**[Deploy MAS and Synapse on Railway](https://railway.com/template/mas-and-synapse)**

- **Creator:** penghuot's Projects
- **Category:** Automation
- **Total deploys:** 3

## Template content

### synapse https://devicons.railway.com/i/coder-dark.png

- **Source:** https://github.com/Penghuot/ess-helm
- **Health check:** /health
- **Public domain:** Yes

### mas-service https://devicons.railway.com/i/coder-white.png

- **Source:** https://github.com/Penghuot/ess-helm
- **Health check:** /health
- **Public domain:** Yes

### synapse-db https://devicons.railway.app/i/postgresql.svg

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

### mas-db https://devicons.railway.app/i/postgresql.svg

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

## Documentation

# Deploy and Host MAS and Synapse on Railway
Matrix Authentication Service (MAS) is an identity provider that enables secure login and account management for Matrix clients. Synapse is the reference homeserver implementation for the Matrix protocol, powering decentralized communication. Together, they provide authentication and messaging infrastructure for Matrix-based applications.

## About Hosting MAS and Synapse
Hosting MAS and Synapse on Railway involves deploying two tightly integrated services: Synapse as the homeserver and MAS as the authentication provider. Each service requires its own PostgreSQL database and a set of environment variables for secrets, endpoints, and client configuration. Railway simplifies this process by auto-injecting service domains and database credentials, reducing manual setup. With MAS handling OIDC flows and Synapse managing communication, you can run a full Matrix stack with minimal effort. This setup is ideal for developers, communities, or organizations wanting to host secure, scalable, and decentralized communication infrastructure without managing servers directly.

## Why Deploy MAS and Synapse 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 MAS and Synapse 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.

## Common Use Cases
Running a personal or community Matrix homeserver with secure authentication

Integrating Element Web with MAS for OIDC-based login flows

Hosting scalable, production-ready Matrix infrastructure with minimal configuration

## Dependencies for MAS and Synapse Hosting
PostgreSQL databases: One dedicated database for Synapse, one for MAS

RSA signing key: Required by MAS to sign tokens and enable secure authentication

### Deployment Dependencies
Railway-managed PostgreSQL instances

Railway environment variable injection (RAILWAY_PUBLIC_DOMAIN, RAILWAY_PRIVATE_DOMAIN)

Matrix Synapse Documentation

Matrix Authentication Service (MAS) GitHub (github.com in Bing)

## 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/mas-and-synapse
