# rdprost/mattermost architecture

> Architecture diagram of the GitHub repository rdprost/mattermost, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rdprost/mattermost
- Repository: https://github.com/rdprost/mattermost

## Overview

Mattermost is a self-hosted collaboration platform. A user works in a web or native client, which communicates with the Go server to use collaboration features such as channels, messaging, integrations, and search; the server persists data in PostgreSQL. The graph also preserves documented voice, screen-sharing, and AI capabilities, but the supplied excerpts do not expose their implementation paths or runtime wiring. Relationships are limited to startup calls visible in excerpts and capabilities stated in the README; several feature nodes therefore have no asserted call edges.

Main entry points: [`server/channels/app/server.go`](https://github.com/rdprost/mattermost/blob/master/server/channels/app/server.go) (Application server), [`server/channels/api4`](https://github.com/rdprost/mattermost/tree/master/server/channels/api4) (HTTP API), [`webapp/channels/src`](https://github.com/rdprost/mattermost/tree/master/webapp/channels/src) (Web client), [`webapp/channels/src/components/cloud_preview_modal/cloud_preview_modal_controller.tsx`](https://github.com/rdprost/mattermost/blob/master/webapp/channels/src/components/cloud_preview_modal/cloud_preview_modal_controller.tsx) (Cloud preview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client experience"]
  node_web["Web client"]
  node_clientapi["Client API<br/>[client4.ts]"]
  node_appcontracts["App contracts<br/>[apps.ts]"]
  node_cloudpreview["Cloud preview"]
  node_previewcontent["Preview content UI"]
  node_previewdata["Preview content data"]
  node_previewfetch["Preview content hook"]
end

subgraph group_runtime["Server runtime"]
  node_servercmd["Server command<br/>[server.go]"]
  node_appserver["Application server<br/>[server.go]"]
  node_api["HTTP API"]
  node_config["Configuration"]
  node_postgres[("PostgreSQL")]
end

subgraph group_collaboration["Collaboration features"]
  node_channels["Channels and posts<br/>[channel.go]"]
  node_identity["Identity and access<br/>[authentication.go]"]
  node_files["Files and media<br/>[file.go]"]
  node_notifications["Notifications<br/>[notification.go]"]
  node_voice["Voice and sharing"]
  node_automation["Workflow automation<br/>[plugin.go]"]
  node_ai["AI integration"]
end

subgraph group_platform["Platform services"]
  node_jobs["Background jobs<br/>[server.go]"]
  node_search["Search service<br/>[searchengine.go]"]
  node_remote["Remote clusters<br/>[service.go]"]
  node_sharedchannels["Shared channels<br/>[service.go]"]
  node_plugins["Plugin RPC"]
end

node_user(("Collaborator"))

node_user -->|"uses"| node_web
node_web -.->|"requests"| node_clientapi
node_clientapi -.->|"calls API"| node_api
node_servercmd -->|"creates"| node_appserver
node_servercmd -->|"initializes"| node_api
node_appserver -.->|"persists data"| node_postgres
node_api -.->|"serves requests"| node_channels
node_api -.->|"serves requests"| node_identity
node_api -.->|"serves requests"| node_files
node_appserver -.->|"runs jobs"| node_jobs
node_appserver -.->|"configures"| node_search
node_appserver -.->|"uses service"| node_remote
node_appserver -.->|"uses service"| node_sharedchannels
node_automation -.->|"uses RPC"| node_plugins
node_web -.->|"uses contracts"| node_appcontracts
node_cloudpreview -->|"fetches content"| node_previewfetch
node_cloudpreview -.->|"opens modal"| node_previewcontent
node_previewcontent -.->|"renders content"| node_previewdata
node_user -.->|"uses"| node_voice
node_user -.->|"uses"| node_ai

click node_web "https://github.com/rdprost/mattermost/tree/master/webapp/channels/src"
click node_clientapi "https://github.com/rdprost/mattermost/blob/master/webapp/platform/client/src/client4.ts"
click node_appcontracts "https://github.com/rdprost/mattermost/blob/master/webapp/platform/types/src/apps.ts"
click node_servercmd "https://github.com/rdprost/mattermost/blob/master/server/cmd/mattermost/commands/server.go"
click node_appserver "https://github.com/rdprost/mattermost/blob/master/server/channels/app/server.go"
click node_api "https://github.com/rdprost/mattermost/tree/master/server/channels/api4"
click node_config "https://github.com/rdprost/mattermost/tree/master/server/config"
click node_channels "https://github.com/rdprost/mattermost/blob/master/server/channels/app/channel.go"
click node_identity "https://github.com/rdprost/mattermost/blob/master/server/channels/app/authentication.go"
click node_files "https://github.com/rdprost/mattermost/blob/master/server/channels/app/file.go"
click node_notifications "https://github.com/rdprost/mattermost/blob/master/server/channels/app/notification.go"
click node_automation "https://github.com/rdprost/mattermost/blob/master/server/channels/app/plugin.go"
click node_jobs "https://github.com/rdprost/mattermost/blob/master/server/channels/jobs/server.go"
click node_search "https://github.com/rdprost/mattermost/blob/master/server/platform/services/searchengine/searchengine.go"
click node_remote "https://github.com/rdprost/mattermost/blob/master/server/platform/services/remotecluster/service.go"
click node_sharedchannels "https://github.com/rdprost/mattermost/blob/master/server/platform/services/sharedchannel/service.go"
click node_plugins "https://github.com/rdprost/mattermost/blob/master/server/public/plugin/client_rpc_generated.go"
click node_cloudpreview "https://github.com/rdprost/mattermost/blob/master/webapp/channels/src/components/cloud_preview_modal/cloud_preview_modal_controller.tsx"
click node_previewcontent "https://github.com/rdprost/mattermost/blob/master/webapp/channels/src/components/cloud_preview_modal/preview_modal_content_controller.tsx"
click node_previewdata "https://github.com/rdprost/mattermost/blob/master/webapp/channels/src/components/cloud_preview_modal/preview_modal_content_data.ts"
click node_previewfetch "https://github.com/rdprost/mattermost/blob/master/webapp/channels/src/hooks/useGetCloudPreviewModalContent.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_clientapi,node_appcontracts,node_cloudpreview,node_previewcontent,node_previewdata,node_previewfetch toneBlue
class node_servercmd,node_appserver,node_api,node_config,node_postgres toneAmber
class node_channels,node_identity,node_files,node_notifications,node_voice,node_automation,node_ai toneMint
class node_jobs,node_search,node_remote,node_sharedchannels,node_plugins toneRose
class node_user toneIndigo
```

## Components

### Client experience

- [Web client](https://github.com/rdprost/mattermost/tree/master/webapp/channels/src): `webapp/channels/src`
- [Client API](https://github.com/rdprost/mattermost/blob/master/webapp/platform/client/src/client4.ts): `webapp/platform/client/src/client4.ts`
- [App contracts](https://github.com/rdprost/mattermost/blob/master/webapp/platform/types/src/apps.ts): `webapp/platform/types/src/apps.ts`
- [Cloud preview](https://github.com/rdprost/mattermost/blob/master/webapp/channels/src/components/cloud_preview_modal/cloud_preview_modal_controller.tsx): `webapp/channels/src/components/cloud_preview_modal/cloud_preview_modal_controller.tsx`
- [Preview content UI](https://github.com/rdprost/mattermost/blob/master/webapp/channels/src/components/cloud_preview_modal/preview_modal_content_controller.tsx): `webapp/channels/src/components/cloud_preview_modal/preview_modal_content_controller.tsx`
- [Preview content data](https://github.com/rdprost/mattermost/blob/master/webapp/channels/src/components/cloud_preview_modal/preview_modal_content_data.ts): `webapp/channels/src/components/cloud_preview_modal/preview_modal_content_data.ts`
- [Preview content hook](https://github.com/rdprost/mattermost/blob/master/webapp/channels/src/hooks/useGetCloudPreviewModalContent.ts): `webapp/channels/src/hooks/useGetCloudPreviewModalContent.ts`

### Server runtime

- [Server command](https://github.com/rdprost/mattermost/blob/master/server/cmd/mattermost/commands/server.go): `server/cmd/mattermost/commands/server.go`
- [Application server](https://github.com/rdprost/mattermost/blob/master/server/channels/app/server.go): `server/channels/app/server.go`
- [HTTP API](https://github.com/rdprost/mattermost/tree/master/server/channels/api4): `server/channels/api4`
- [Configuration](https://github.com/rdprost/mattermost/tree/master/server/config): `server/config`
- **PostgreSQL**

### Collaboration features

- [Channels and posts](https://github.com/rdprost/mattermost/blob/master/server/channels/app/channel.go): `server/channels/app/channel.go`
- [Identity and access](https://github.com/rdprost/mattermost/blob/master/server/channels/app/authentication.go): `server/channels/app/authentication.go`
- [Files and media](https://github.com/rdprost/mattermost/blob/master/server/channels/app/file.go): `server/channels/app/file.go`
- [Notifications](https://github.com/rdprost/mattermost/blob/master/server/channels/app/notification.go): `server/channels/app/notification.go`
- **Voice and sharing**
- [Workflow automation](https://github.com/rdprost/mattermost/blob/master/server/channels/app/plugin.go): `server/channels/app/plugin.go`
- **AI integration**

### Platform services

- [Background jobs](https://github.com/rdprost/mattermost/blob/master/server/channels/jobs/server.go): `server/channels/jobs/server.go`
- [Search service](https://github.com/rdprost/mattermost/blob/master/server/platform/services/searchengine/searchengine.go): `server/platform/services/searchengine/searchengine.go`
- [Remote clusters](https://github.com/rdprost/mattermost/blob/master/server/platform/services/remotecluster/service.go): `server/platform/services/remotecluster/service.go`
- [Shared channels](https://github.com/rdprost/mattermost/blob/master/server/platform/services/sharedchannel/service.go): `server/platform/services/sharedchannel/service.go`
- [Plugin RPC](https://github.com/rdprost/mattermost/blob/master/server/public/plugin/client_rpc_generated.go): `server/public/plugin/client_rpc_generated.go`

### Other components

- **Collaborator**

## Connections

- Collaborator → Web client: uses (evidence: `README.md`)
- Web client → Client API: requests
- Client API → HTTP API: calls API
- Server command → Application server: creates (evidence: `server/cmd/mattermost/commands/server.go`)
- Server command → HTTP API: initializes (evidence: `server/cmd/mattermost/commands/server.go`)
- Application server → PostgreSQL: persists data
- HTTP API → Channels and posts: serves requests
- HTTP API → Identity and access: serves requests
- HTTP API → Files and media: serves requests
- Application server → Background jobs: runs jobs
- Application server → Search service: configures
- Application server → Remote clusters: uses service
- Application server → Shared channels: uses service
- Workflow automation → Plugin RPC: uses RPC
- Web client → App contracts: uses contracts
- Cloud preview → Preview content hook: fetches content (evidence: `webapp/channels/src/components/cloud_preview_modal/cloud_preview_modal_controller.tsx`)
- Cloud preview → Preview content UI: opens modal (evidence: `webapp/channels/src/components/cloud_preview_modal/cloud_preview_modal_controller.tsx`)
- Preview content UI → Preview content data: renders content (evidence: `webapp/channels/src/components/cloud_preview_modal/preview_modal_content_controller.tsx`)
- Collaborator → Voice and sharing: uses (evidence: `README.md`)
- Collaborator → AI integration: uses (evidence: `README.md`)
