Architecture
Vesicle is a Matrix homeserver split into four first-party services plus a small set of platform components. Helm is the supported way to run this layout in Kubernetes.
The four first-party services are Gateway, Engine, Worker and Auth. Each is a separate Deployment with its own replica count, so you can scale the busy path without scaling a monolith. They are written in Go and run as non-root containers.
Inbound traffic flow
Section titled “Inbound traffic flow”HTTPS for the homeserver host (<serverName>) lands on your ingress (or Gateway API), then on gateway. The gateway serves well-known locally and forwards the rest over NATS request/reply.
flowchart LR clients[Clients and remote homeservers] ingress[Ingress HTTPS] gw[Gateway] nats[NATS] eng[Engine] auth[Auth] wk[Worker] pg[(PostgreSQL)] clients --> ingress --> gw --> nats nats --> eng nats --> auth eng --> pg wk --> nats wk --> pg
| Path | Where it goes |
|---|---|
/.well-known/matrix/client, /.well-known/matrix/server | Gateway, locally |
GET / | 302 to Element Web (chat.<serverName>), when Element Web is enabled |
/_matrix/client/… login, logout, refresh | HTTP reverse proxy to MAS (compat) |
/_matrix/client/… (rest) | NATS → Engine |
/_matrix/federation/…, /_matrix/key/… | NATS → Engine |
/_synapse/admin/… | NATS → Engine |
/_synapse/mas/… | NATS → Auth |
Auth is not a public HTTP API. The gateway and the other services call it over NATS.
The worker takes no inbound HTTP. It runs the background roles: federation sending to other servers, and the durable queues that outlive a request.
Satellite hostnames do not go through the gateway. They are separate routes:
| Host | Target |
|---|---|
account.<serverName> | Matrix Authentication Service |
chat.<serverName> | Element Web |
admin.<serverName> | Element Admin |
mrtc.<serverName> | Matrix RTC authorisation and LiveKit SFU |
See DNS and hostnames and Ingress.
First-party services
Section titled “First-party services”| Component | Pod | Role |
|---|---|---|
| Gateway | vss-gateway | Public entry for client-server and federation HTTP, well-known, and root redirect to Element Web |
| Engine | vss-engine | The central logic: client API, rooms and events, sync, and inbound federation. It also owns the database schema and runs the migration |
| Worker | vss-worker | Background roles: federation sending and other durable queues |
| Auth | vss-auth | Authentication integration with Matrix Authentication Service |
All four read their configuration from a JSON file and secret files that the chart generates. Resource names are <release>-<component>; the examples use the release name vss.
Platform
Section titled “Platform”| Component | Pod | Role |
|---|---|---|
| Matrix Authentication Service (MAS) | vss-matrix-authentication-service | OIDC and account flows (account.<serverName>). Optional |
| PostgreSQL | vss-postgres-N | The database, a CloudNativePG cluster (or your own server). See Choose a database and Back up and restore |
| NATS (JetStream) | vss-nats | Messaging between the services, durable queues, and the media store |
vss-nats-box is a NATS utility pod from the NATS chart, not a Vesicle service.
User-facing add-ons
Section titled “User-facing add-ons”These are optional in the chart values and off by default:
| Component | Pod | Role |
|---|---|---|
| Element Web | vss-element-web | Matrix client (chat.<serverName>) |
| Element Admin | vss-element-admin | Admin console (admin.<serverName>) |
| Matrix RTC | vss-matrix-rtc-authorisation, vss-matrix-rtc-sfu | lk-jwt-service plus LiveKit SFU (mrtc.<serverName>) |
What a full install looks like
Section titled “What a full install looks like”flowchart TB
subgraph firstParty [First-party services]
gw2[Gateway x2]
eng2[Engine x2]
wk2[Worker x2]
auth2[Auth x2]
end
subgraph platform [Platform]
mas[MAS]
pg[PostgreSQL]
nats2[NATS JetStream]
end
subgraph addons [Optional add-ons]
ew[Element Web]
ea[Element Admin]
rtc[Matrix RTC]
end
gw2 --> nats2
nats2 --> eng2
nats2 --> auth2
nats2 --> wk2
eng2 --> pg
wk2 --> pg
auth2 --> mas
mas --> pg
See Install with Helm for the install that produces this layout, including example kubectl output.
Independent scaling
Section titled “Independent scaling”The design goal is that every first-party service runs with many replicas. See Scaling and availability for what that means and what still sets the limit.
Each first-party service is its own Kubernetes Deployment with replicaCount (default 2) and a PodDisruptionBudget (minAvailable: 1). Replicas coordinate through NATS and PostgreSQL, never through in-process state, so you can run any number of them. You scale:
| Service | Scale when |
|---|---|
| Gateway | Ingress concurrency and HTTP edge load |
| Engine | Client-server API, sync and room load, and inbound federation |
| Worker | Outbound federation and background queue load |
| Auth | Token verification and MAS integration load |
Capacity also depends on the database, NATS, the network and the federation workload. A higher replica count alone does not remove those limits. Platform pieces (PostgreSQL, NATS, MAS) and the add-ons have their own replica settings.
Health and metrics
Section titled “Health and metrics”Each service serves Prometheus metrics on port 2112 and the probe endpoints /livez and /readyz on the same port. The chart’s startup, readiness and liveness probes use them. ServiceMonitors render when the Prometheus Operator is installed.