Skip to content

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, Client API, Federation API, and Auth. Each is a separate Deployment with its own replica count, so you can scale the busy path without scaling a monolith.

HTTPS for the homeserver host (<serverName>) lands on your ingress (Traefik or Gateway API), then on vesicle-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]
  cs[Client API]
  ss[Federation API]
  auth[Auth]
  clients --> ingress --> gw --> nats
  nats --> cs
  nats --> ss
  nats --> auth
PathWhere it goes
/.well-known/matrix/client, /.well-known/matrix/serverGateway, locally
GET /302 to Element Web (chat.<serverName>)
/_matrix/client/… login, logout, refreshHTTP reverse-proxy to MAS (compat)
/_matrix/client/… (rest)NATS → Client API
/_matrix/federation/…, /_matrix/key/…NATS → Federation API
/_synapse/admin/…NATS → Client API
/_synapse/mas/…NATS → Auth

Auth is not a public HTTP API. The gateway and peers call it over NATS (matrix.internal.auth.*).

Satellite hostnames do not go through the gateway app. They are separate ingress routes:

HostTarget
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.

ComponentPodRole
Gatewayvesicle-gatewayPublic entry for client-server and federation HTTP, well-known, and root redirect to Element Web
Client APIvesicle-client-apiMatrix client-server API and related persistence
Federation APIvesicle-fed-apiServer-server federation
Authvesicle-authAuthentication integration with Matrix Authentication Service
ComponentPodRole
Matrix Authentication Service (MAS)vesicle-matrix-authentication-serviceOIDC / account flows (account.<serverName>)
PostgreSQLvesicle-postgresqlDatabases for client-api, federation, and MAS
NATSvesicle-natsMessaging between first-party services

vesicle-nats-box is a NATS utility sidecar from the NATS chart, not a Vesicle microservice.

These are optional in chart values and enabled in a typical full install:

ComponentPodRole
Element Webvesicle-element-webMatrix client (chat.<serverName>)
Element Adminvesicle-element-adminAdmin console (admin.<serverName>)
Matrix RTCvesicle-matrix-rtc-authorisation, vesicle-matrix-rtc-sfulk-jwt-service plus LiveKit SFU (mrtc.<serverName>)

A typical Helm install in the vesicle namespace looks like this. Replica counts for the four first-party services default to 2.

flowchart TB
  subgraph firstParty [First-party services]
    gw2[Gateway x2]
    cs2[Client API x2]
    ss2[Federation API x2]
    auth2[Auth x2]
  end
  subgraph platform [Platform]
    mas[MAS]
    pg[PostgreSQL]
    nats2[NATS]
  end
  subgraph addons [Optional add-ons]
    ew[Element Web]
    ea[Element Admin]
    rtc[Matrix RTC]
  end
  gw2 --> nats2
  nats2 --> cs2
  nats2 --> ss2
  nats2 --> auth2
  cs2 --> pg
  ss2 --> pg
  auth2 --> mas
  mas --> pg

Example kubectl output after a full install (pod hashes will differ):

kubectl -n vesicle get pods
NAME READY STATUS RESTARTS AGE
vesicle-auth-… 1/1 Running 0 …
vesicle-auth-… 1/1 Running 0 …
vesicle-client-api-… 1/1 Running 0 …
vesicle-client-api-… 1/1 Running 0 …
vesicle-element-admin-… 1/1 Running 0 …
vesicle-element-web-… 1/1 Running 0 …
vesicle-fed-api-… 1/1 Running 0 …
vesicle-fed-api-… 1/1 Running 0 …
vesicle-gateway-… 1/1 Running 0 …
vesicle-gateway-… 1/1 Running 0 …
vesicle-matrix-authentication-service-… 1/1 Running 0 …
vesicle-matrix-rtc-authorisation-… 1/1 Running 0 …
vesicle-matrix-rtc-sfu-… 1/1 Running 0 …
vesicle-nats-0 2/2 Running 0 …
vesicle-nats-box-… 1/1 Running 0 …
vesicle-postgresql-0 1/1 Running 0 …

See Install with Helm for the install path that produces this layout.

Each first-party service is its own Kubernetes Deployment with replicaCount (default 2) and a PodDisruptionBudget (minAvailable: 1). They share NATS (queue groups) and PostgreSQL, so you scale:

ServiceScale when
GatewayIngress concurrency / HTTP edge load
Client APIClient-server API, sync, and room load
Federation APIServer-server federation traffic
AuthToken verification and MAS integration load

Platform pieces (PostgreSQL, NATS, MAS) and add-ons (Element Web/Admin, Matrix RTC) have their own replica knobs. They are not part of the four-service product plane.