# gotify/server architecture

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

- Interactive diagram: https://gitdiagram.com/gotify/server
- Repository: https://github.com/gotify/server
- Video tour (about a minute): https://gitdiagram.com/gotify/server/video

## Overview

Gotify is a self-hosted server for sending messages over REST and receiving them in real time over WebSocket, with user, client, application, and plugin management. The main runtime starts from configuration, initializes persistence, and creates the HTTP router; callers then use the API to manage resources or submit messages, which the server can deliver to connected clients. The Web UI provides corresponding management and message views. The README documents these product capabilities; unsampled routes and UI stores limit evidence for some internal links, which are omitted or marked unverified.

Main entry points: [`router/router.go`](https://github.com/gotify/server/blob/master/router/router.go) (HTTP router), [`ui/src/index.tsx`](https://github.com/gotify/server/blob/master/ui/src/index.tsx) (UI bootstrap), [`ui/src/stores.tsx`](https://github.com/gotify/server/blob/master/ui/src/stores.tsx) (UI stores), [`app.go`](https://github.com/gotify/server/blob/master/app.go) (Server startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server runtime"]
  node_config["Configuration<br/>[config.go]"]
  node_bootstrap["Server startup<br/>[app.go]"]
  node_router["HTTP router<br/>[router.go]"]
  node_auth["Authentication<br/>[authentication.go]"]
end

subgraph group_domain["API and data"]
  node_message_api["Message API<br/>[message.go]"]
  node_application_api["Application API<br/>[application.go]"]
  node_client_api["Client API<br/>[client.go]"]
  node_user_api["User API<br/>[user.go]"]
  node_oidc_api["OIDC login<br/>[oidc.go]"]
  node_database[("Database<br/>[database.go]")]
  node_application_data["Application persistence<br/>[application.go]"]
  node_models["Domain models<br/>[message.go]"]
end

subgraph group_delivery["Realtime and plugins"]
  node_stream["WebSocket delivery<br/>[stream.go]"]
  node_plugin_manager["Plugin manager<br/>[manager.go]"]
  node_plugin_handlers["Plugin handlers<br/>[messagehandler.go]"]
end

subgraph group_webui["Web interface"]
  node_ui_entry["UI bootstrap<br/>[index.tsx]"]
  node_ui_stores["UI stores<br/>[stores.tsx]"]
  node_ui_auth["User session<br/>[CurrentUser.ts]"]
  node_ui_apps["Application management<br/>[Applications.tsx]"]
  node_ui_clients["Client management<br/>[Clients.tsx]"]
  node_ui_messages["Message views<br/>[MessagesStore.ts]"]
  node_ui_plugins["Plugin management<br/>[PluginStore.ts]"]
end

node_operator(("Server operator"))
node_browser(("Web UI user"))

node_operator -->|"starts server"| node_bootstrap
node_bootstrap -->|"loads settings"| node_config
node_bootstrap -->|"initializes"| node_database
node_bootstrap -->|"creates router"| node_router
node_router -->|"configures auth"| node_auth
node_router -->|"routes requests"| node_message_api
node_router -->|"routes requests"| node_application_api
node_router -->|"routes requests"| node_client_api
node_router -->|"routes requests"| node_user_api
node_router -->|"routes login"| node_oidc_api
node_application_api -->|"reads and writes"| node_application_data
node_application_data -->|"queries"| node_database
node_application_data -->|"persists"| node_models
node_router -->|"sets notifier"| node_stream
node_browser -->|"opens interface"| node_ui_entry
node_ui_entry -->|"initializes stores"| node_ui_stores
node_ui_entry -->|"initializes session"| node_ui_auth
node_ui_entry -.->|"loads interface"| node_ui_apps
node_ui_entry -.->|"loads interface"| node_ui_clients
node_ui_entry -->|"initializes store"| node_ui_messages
node_ui_entry -->|"initializes store"| node_ui_plugins
node_ui_stores -->|"provides store"| node_ui_messages
node_ui_stores -.->|"provides store"| node_ui_apps
node_ui_stores -.->|"provides store"| node_ui_clients
node_ui_stores -->|"provides store"| node_ui_plugins

click node_config "https://github.com/gotify/server/blob/master/config/config.go"
click node_bootstrap "https://github.com/gotify/server/blob/master/app.go"
click node_router "https://github.com/gotify/server/blob/master/router/router.go"
click node_auth "https://github.com/gotify/server/blob/master/auth/authentication.go"
click node_message_api "https://github.com/gotify/server/blob/master/api/message.go"
click node_application_api "https://github.com/gotify/server/blob/master/api/application.go"
click node_client_api "https://github.com/gotify/server/blob/master/api/client.go"
click node_user_api "https://github.com/gotify/server/blob/master/api/user.go"
click node_oidc_api "https://github.com/gotify/server/blob/master/api/oidc.go"
click node_database "https://github.com/gotify/server/blob/master/database/database.go"
click node_application_data "https://github.com/gotify/server/blob/master/database/application.go"
click node_models "https://github.com/gotify/server/blob/master/model/message.go"
click node_stream "https://github.com/gotify/server/blob/master/api/stream/stream.go"
click node_plugin_manager "https://github.com/gotify/server/blob/master/plugin/manager.go"
click node_plugin_handlers "https://github.com/gotify/server/blob/master/plugin/messagehandler.go"
click node_ui_entry "https://github.com/gotify/server/blob/master/ui/src/index.tsx"
click node_ui_stores "https://github.com/gotify/server/blob/master/ui/src/stores.tsx"
click node_ui_auth "https://github.com/gotify/server/blob/master/ui/src/CurrentUser.ts"
click node_ui_apps "https://github.com/gotify/server/blob/master/ui/src/application/Applications.tsx"
click node_ui_clients "https://github.com/gotify/server/blob/master/ui/src/client/Clients.tsx"
click node_ui_messages "https://github.com/gotify/server/blob/master/ui/src/message/MessagesStore.ts"
click node_ui_plugins "https://github.com/gotify/server/blob/master/ui/src/plugin/PluginStore.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_config,node_bootstrap,node_router,node_auth,node_browser toneBlue
class node_message_api,node_application_api,node_client_api,node_user_api,node_oidc_api,node_database,node_application_data,node_models toneAmber
class node_stream,node_plugin_manager,node_plugin_handlers,node_operator toneMint
class node_ui_entry,node_ui_stores,node_ui_auth,node_ui_apps,node_ui_clients,node_ui_messages,node_ui_plugins toneRose
```

## Components

### Server runtime

- [Configuration](https://github.com/gotify/server/blob/master/config/config.go): `config/config.go`
- [Server startup](https://github.com/gotify/server/blob/master/app.go): `app.go`
- [HTTP router](https://github.com/gotify/server/blob/master/router/router.go): `router/router.go`
- [Authentication](https://github.com/gotify/server/blob/master/auth/authentication.go): `auth/authentication.go`

### API and data

- [Message API](https://github.com/gotify/server/blob/master/api/message.go): `api/message.go`
- [Application API](https://github.com/gotify/server/blob/master/api/application.go): `api/application.go`
- [Client API](https://github.com/gotify/server/blob/master/api/client.go): `api/client.go`
- [User API](https://github.com/gotify/server/blob/master/api/user.go): `api/user.go`
- [OIDC login](https://github.com/gotify/server/blob/master/api/oidc.go): `api/oidc.go`
- [Database](https://github.com/gotify/server/blob/master/database/database.go): `database/database.go`
- [Application persistence](https://github.com/gotify/server/blob/master/database/application.go): `database/application.go`
- [Domain models](https://github.com/gotify/server/blob/master/model/message.go): `model/message.go`

### Realtime and plugins

- [WebSocket delivery](https://github.com/gotify/server/blob/master/api/stream/stream.go): `api/stream/stream.go`
- [Plugin manager](https://github.com/gotify/server/blob/master/plugin/manager.go): `plugin/manager.go`
- [Plugin handlers](https://github.com/gotify/server/blob/master/plugin/messagehandler.go): `plugin/messagehandler.go`

### Web interface

- [UI bootstrap](https://github.com/gotify/server/blob/master/ui/src/index.tsx): `ui/src/index.tsx`
- [UI stores](https://github.com/gotify/server/blob/master/ui/src/stores.tsx): `ui/src/stores.tsx`
- [User session](https://github.com/gotify/server/blob/master/ui/src/CurrentUser.ts): `ui/src/CurrentUser.ts`
- [Application management](https://github.com/gotify/server/blob/master/ui/src/application/Applications.tsx): `ui/src/application/Applications.tsx`
- [Client management](https://github.com/gotify/server/blob/master/ui/src/client/Clients.tsx): `ui/src/client/Clients.tsx`
- [Message views](https://github.com/gotify/server/blob/master/ui/src/message/MessagesStore.ts): `ui/src/message/MessagesStore.ts`
- [Plugin management](https://github.com/gotify/server/blob/master/ui/src/plugin/PluginStore.ts): `ui/src/plugin/PluginStore.ts`

### Other components

- **Server operator**
- **Web UI user**

## Connections

- Server operator → Server startup: starts server (evidence: `app.go`)
- Server startup → Configuration: loads settings (evidence: `app.go`)
- Server startup → Database: initializes (evidence: `app.go`)
- Server startup → HTTP router: creates router (evidence: `app.go`)
- HTTP router → Authentication: configures auth (evidence: `router/router.go`)
- HTTP router → Message API: routes requests (evidence: `router/router.go`)
- HTTP router → Application API: routes requests (evidence: `router/router.go`)
- HTTP router → Client API: routes requests (evidence: `router/router.go`)
- HTTP router → User API: routes requests (evidence: `router/router.go`)
- HTTP router → OIDC login: routes login (evidence: `router/router.go`)
- Application API → Application persistence: reads and writes (evidence: `api/application.go`)
- Application persistence → Database: queries (evidence: `database/application.go`)
- Application persistence → Domain models: persists (evidence: `database/application.go`)
- HTTP router → WebSocket delivery: sets notifier (evidence: `router/router.go`)
- Web UI user → UI bootstrap: opens interface (evidence: `README.md`)
- UI bootstrap → UI stores: initializes stores (evidence: `ui/src/index.tsx`)
- UI bootstrap → User session: initializes session (evidence: `ui/src/index.tsx`)
- UI bootstrap → Application management: loads interface
- UI bootstrap → Client management: loads interface
- UI bootstrap → Message views: initializes store (evidence: `ui/src/index.tsx`)
- UI bootstrap → Plugin management: initializes store (evidence: `ui/src/index.tsx`)
- UI stores → Message views: provides store (evidence: `ui/src/stores.tsx`)
- UI stores → Application management: provides store (evidence: `ui/src/application/Applications.tsx`)
- UI stores → Client management: provides store (evidence: `ui/src/client/Clients.tsx`)
- UI stores → Plugin management: provides store (evidence: `ui/src/stores.tsx`)
