Your own Matrix server on a VPS: Synapse or Conduit, database and federation
Matrix is an open protocol for chat, calls and file sharing, and a Matrix server (homeserver) stores your users' messages, accounts and media. People usually run their own server for a team or a company: the conversations live on your machine, you create the accounts, and staff use familiar clients such as Element on desktop and mobile. The VPS requirements for Matrix depend heavily on two decisions: which server implementation you choose, and whether it will talk to the rest of the Matrix network.
Synapse, Conduit or Dendrite
- Synapse is the main implementation, written in Python and developed by Element. It supports the full protocol, the admin API, workers for scaling and most bridges. The price is its appetite: from 1 GB of free memory for the server itself, plus a database alongside.
- Conduit and its forks (continuwuity, tuwunel) are Rust servers with a built-in RocksDB database. They run in 256–512 MB of memory, install as a single binary and suit a family or a small team well. Some features and bridges are less well supported than in Synapse.
- Dendrite is a Go implementation that has been put into maintenance mode: only security fixes are released. It's better not to choose it for a new server.
If you need predictability and compatibility with every client and bridge, take Synapse; if saving resources matters and you have up to a couple of dozen users, go with the Conduit family.
How much memory, and which database
The Synapse documentation says plainly that SQLite is only fit for testing: a production install needs PostgreSQL. You can run it on the same VPS and move it to a separate server as load grows; the VPS for PostgreSQL page covers choosing a plan for the database. Guidelines for Synapse with PostgreSQL:
- Up to 20–30 users in internal rooms: 2 GB of memory and 1–2 cores; this is the default filter in the table.
- 50–200 users, or membership in large public rooms: 4–8 GB.
- Several hundred active users: 8 GB or more, with workers on separate cores.
The main non-obvious factor isn't the number of your own users but large federated rooms. When someone on your server joins a public room with tens of thousands of members, Synapse downloads and stores its entire state: memory and the database grow by gigabytes in a day. For a company server it's sensible to limit federation to a list of trusted servers (federation_domain_whitelist) or turn it off altogether. Keep a separate eye on the media folder: attachments and the cache of remote files pile up for years, so enable a media retention policy from the start and take an NVMe disk with headroom.
Domain, ports and federation
A Matrix server is tied to a domain name: a user address looks like @ivan:example.ru, and you can't change the domain later without recreating accounts. Synapse usually listens on 8008 on localhost only, and a reverse proxy (nginx or Caddy) publishes it to the outside with a TLS certificate on 443/TCP. Federation goes over 8448/TCP by default; to get by with port 443 alone and keep the server on a subdomain, set up delegation through the /.well-known/matrix/server and /.well-known/matrix/client files on the main domain. The public Federation Tester helps check that other servers can see you. It's best to close public registration right away (enable_registration: false) and create accounts by hand or with invitation tokens: an open server quickly fills up with strangers' accounts.
Voice and video calls through NAT need a TURN server, usually coturn: 3478 over UDP and TCP, 5349 for TLS, and a range of UDP ports for relaying media. One-to-one calls go through TURN, while group conferences are easier to host separately; compare with the VPS for Jitsi option.
Bridges, data storage and backups
Bridges connect Matrix rooms to other networks: there are bridges to Telegram, Slack, IRC and email. Each bridge is a separate process with its own database, usually in Docker; allow 100–300 MB of memory per bridge. The whole stack is conveniently run with Docker Compose, and choosing a plan for containers is covered on the VPS for Docker page.
If the server is used by employees of a Russian company and the conversations contain personal data, the server's location becomes a legal question: under 152-FZ, the initial recording and storage of Russian citizens' data must take place in Russia. In that case, instead of the European locations in the default filter, look at plans compliant with 152-FZ. Outside Russia, check your own data protection rules for where personal data may be stored.
Backing up the database alone isn't enough. Save the PostgreSQL dump, the media folder and the server's signing key file (*.signing.key): losing the key breaks other servers' trust in your domain. Keep in mind that the server can't read messages in encrypted rooms, so users should enable key backup in their client; otherwise, if they lose a device, their history will be inaccessible.