Railway

Deploy MAS and Synapse

we use mas and synapse for homeserver

Deploy MAS and Synapse

Just deployed

Just deployed

/var/lib/postgresql/data

/var/lib/postgresql/data

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)


Template Content

More templates in this category

View Template
N8N Main + Worker
Deploy and Host N8N with Inactive worker.

jakemerson
View Template
Postgres Backup
Cron-based PostgreSQL backup to bucket storage

Railway Templates
View Template
Prefect [Updated Feb ’26]
Prefect [Feb ’26] (ETL & Automation alternative to Airflow) Self Host

shinyduo