Deploy Element Web
Element Web v1.12.35 with its own Synapse homeserver and Postgres
Element Web
Just deployed
Just deployed
/data
Just deployed
/var/lib/postgresql/data
Deploy and Host Element Web on Railway
Element Web is the browser version of Element, the Matrix chat client: rooms, direct messages, threads, file sharing, voice and video calls, with end-to-end encryption. This template deploys it together with its own Matrix homeserver (Synapse) and PostgreSQL, so your accounts and messages live on your server, not on matrix.org.
About Hosting Element Web
Element Web is a static web app. To be useful it needs a Matrix homeserver for accounts, rooms and message history, and that homeserver needs a database and somewhere to keep its signing key and uploaded files. This template runs three services: Element Web v1.12.35, Synapse v1.165.0 and Railway's PostgreSQL. Both apps use official images, pinned by version and digest. Element's config.json is written at start, so the login page already points at your Synapse. Synapse generates its keys and secrets and creates an admin account with a generated password. Sign-up is closed by default. Nothing needs to be filled in at deploy time.
Common Use Cases
- A private Slack or Discord alternative for a team, family or community, with your data on your own server
- An end-to-end encrypted chat that you control and that can still talk to the wider Matrix network
- A web client and homeserver to put Matrix bridges and bots (Slack, Discord, Telegram, IRC) behind
Dependencies for Element Web Hosting
- A Matrix homeserver: Synapse is included, with its signing key, secrets and media on a volume
- PostgreSQL: Railway's Postgres service is included, with a volume
Deployment Dependencies
- Element Web source and releases: https://github.com/element-hq/element-web/releases
- Element Web configuration: https://github.com/element-hq/element-web/blob/develop/docs/config.md
- Synapse configuration manual: https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html
- Template repo (Dockerfiles, start scripts, changelog): https://github.com/aalfath/element-web-railway-template
Implementation Details
The template deploys these services:
- Element Web (public): nginx serves the Element bundle with the security headers that Element recommends. The health check is
/version. - Synapse (public): the Matrix homeserver. Element in your browser talks to it directly, so it needs its own domain. It serves the Matrix well-known files itself, so federation works over HTTPS without a proxy. Keys, secrets and media are on the
/datavolume. The health check is/health. - Postgres: stores accounts, rooms and messages. Synapse creates its own
synapsedatabase with the C locale it needs.
After deploy:
- Open the Element Web service's URL. The login page shows your Synapse domain as the homeserver.
- Sign in as
adminwithSYNAPSE_ADMIN_PASSWORDfrom the Synapse service's Variables tab. - Add people in one of two ways:
- set
SYNAPSE_ENABLE_REGISTRATION=trueon Synapse and hand out registration tokens; or - create the accounts with Synapse's admin API.
- set
Server name. SYNAPSE_SERVER_NAME is the :domain part of every user ID, and it can't change after the first start. To use your own domain, add it to Synapse and set SYNAPSE_SERVER_NAME and SYNAPSE_PUBLIC_BASEURL before you create accounts.
Options. On Element Web:
ELEMENT_BRANDrenames the app.ELEMENT_DISABLE_CUSTOM_URLS=truehides the homeserver picker.ELEMENT_CONFIG_JSONmerges any other Element setting intoconfig.json.
On Synapse, put SMTP, single sign-on (OIDC) or TURN settings in a YAML file under /data/conf.d/.
Updates. Both app services build from the template's GitHub repo. When we bump the pinned Element or Synapse version there, Railway shows an "update available" notice in your project, and you choose when to apply it. Read CHANGELOG.md in the repo first.
Why Deploy Element Web 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 Element Web 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
