# kimchi-project/wok architecture

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

- Interactive diagram: https://gitdiagram.com/kimchi-project/wok
- Repository: https://github.com/kimchi-project/wok

## Overview

Wok is a CherryPy-based web framework: a browser reaches the running daemon, which serves its HTML5 interface and REST resources that plugins can extend. The main request path runs through the server, root routing, resource handlers, domain models, and rendered responses; supporting branches provide authentication, asynchronous tasks, request logging, and notifications. The README documents plugin extensibility, while several domain modules are only named in the source index, so links to those modules are omitted where their callers are not shown.

Main entry points: [`ui/js/src/wok.main.js`](https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.main.js) (Main interface), [`src/wok/server.py`](https://github.com/kimchi-project/wok/blob/master/src/wok/server.py) (CherryPy server), [`src/wok/root.py`](https://github.com/kimchi-project/wok/blob/master/src/wok/root.py) (Root router), [`src/wok/control/base.py`](https://github.com/kimchi-project/wok/blob/master/src/wok/control/base.py) (REST resources)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server and Routing"]
  node_server["CherryPy server<br/>[server.py]"]
  node_root["Root router<br/>[root.py]"]
  node_resource_api["REST resources<br/>[base.py]"]
  node_response_render["Response rendering<br/>[template.py]"]
end

subgraph group_domain["Models and Plugins"]
  node_model_core["Model base<br/>[model.py]"]
  node_plugin_registry["Plugin discovery<br/>[plugins.py]"]
  node_config_model["Configuration model<br/>[config.py]"]
  node_peer_model["Peer model<br/>[peers.py]"]
  node_task_model["Task model<br/>[tasks.py]"]
  node_notification_model["Notifications<br/>[notifications.py]"]
end

subgraph group_browser["Browser Interface"]
  node_api_client["API client<br/>[wok.api.js]"]
  node_main_ui["Main interface<br/>[wok.main.js]"]
  node_data_grids["Data grids<br/>[wok.grid.js]"]
  node_lists["Lists and tables<br/>[wok.list.js]"]
  node_charts["Charts<br/>[wok.line-chart.js]"]
end

subgraph group_services["Identity and Operations"]
  node_auth["Authentication<br/>[auth.py]"]
  node_async_tasks["Async task queue<br/>[asynctask.py]"]
  node_request_log["Request logging<br/>[reqlogger.py]"]
  node_push_server["Push server<br/>[pushserver.py]"]
  node_message_errors["Errors and messages<br/>[exception.py]"]
end

node_browser_user(("Browser user"))
node_pam_ldap["PAM / LDAP"]

node_browser_user -->|"opens Wok"| node_server
node_server -->|"mounts root"| node_root
node_server -->|"creates model"| node_model_core
node_server -->|"starts logger"| node_request_log
node_root -->|"uses resources"| node_resource_api
node_resource_api -->|"renders responses"| node_response_render
node_resource_api -.->|"calls model"| node_model_core
node_root -->|"authenticates"| node_auth
node_auth -.->|"checks identity"| node_pam_ldap
node_model_core -.->|"loads plugins"| node_plugin_registry
node_task_model -->|"reads task queue"| node_async_tasks
node_notification_model -->|"sends notifications"| node_push_server
node_async_tasks -->|"records updates"| node_request_log
node_main_ui -.->|"uses API"| node_api_client
node_browser_user -.->|"uses interface"| node_main_ui
node_api_client -.->|"requests REST"| node_server
node_main_ui -.->|"displays grids"| node_data_grids
node_main_ui -.->|"displays lists"| node_lists
node_main_ui -.->|"displays charts"| node_charts

click node_server "https://github.com/kimchi-project/wok/blob/master/src/wok/server.py"
click node_root "https://github.com/kimchi-project/wok/blob/master/src/wok/root.py"
click node_resource_api "https://github.com/kimchi-project/wok/blob/master/src/wok/control/base.py"
click node_response_render "https://github.com/kimchi-project/wok/blob/master/src/wok/template.py"
click node_api_client "https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.api.js"
click node_main_ui "https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.main.js"
click node_data_grids "https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.grid.js"
click node_lists "https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.list.js"
click node_charts "https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.line-chart.js"
click node_model_core "https://github.com/kimchi-project/wok/blob/master/src/wok/model/model.py"
click node_plugin_registry "https://github.com/kimchi-project/wok/blob/master/src/wok/model/plugins.py"
click node_config_model "https://github.com/kimchi-project/wok/blob/master/src/wok/model/config.py"
click node_peer_model "https://github.com/kimchi-project/wok/blob/master/src/wok/model/peers.py"
click node_task_model "https://github.com/kimchi-project/wok/blob/master/src/wok/model/tasks.py"
click node_notification_model "https://github.com/kimchi-project/wok/blob/master/src/wok/model/notifications.py"
click node_auth "https://github.com/kimchi-project/wok/blob/master/src/wok/auth.py"
click node_async_tasks "https://github.com/kimchi-project/wok/blob/master/src/wok/asynctask.py"
click node_request_log "https://github.com/kimchi-project/wok/blob/master/src/wok/reqlogger.py"
click node_push_server "https://github.com/kimchi-project/wok/blob/master/src/wok/pushserver.py"
click node_message_errors "https://github.com/kimchi-project/wok/blob/master/src/wok/exception.py"

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_server,node_root,node_resource_api,node_response_render,node_browser_user toneBlue
class node_model_core,node_plugin_registry,node_config_model,node_peer_model,node_task_model,node_notification_model toneAmber
class node_api_client,node_main_ui,node_data_grids,node_lists,node_charts toneMint
class node_auth,node_async_tasks,node_request_log,node_push_server,node_message_errors toneRose
class node_pam_ldap toneIndigo
```

## Components

### Server and Routing

- [CherryPy server](https://github.com/kimchi-project/wok/blob/master/src/wok/server.py): `src/wok/server.py`
- [Root router](https://github.com/kimchi-project/wok/blob/master/src/wok/root.py): `src/wok/root.py`
- [REST resources](https://github.com/kimchi-project/wok/blob/master/src/wok/control/base.py): `src/wok/control/base.py`
- [Response rendering](https://github.com/kimchi-project/wok/blob/master/src/wok/template.py): `src/wok/template.py`

### Models and Plugins

- [Model base](https://github.com/kimchi-project/wok/blob/master/src/wok/model/model.py): `src/wok/model/model.py`
- [Plugin discovery](https://github.com/kimchi-project/wok/blob/master/src/wok/model/plugins.py): `src/wok/model/plugins.py`
- [Configuration model](https://github.com/kimchi-project/wok/blob/master/src/wok/model/config.py): `src/wok/model/config.py`
- [Peer model](https://github.com/kimchi-project/wok/blob/master/src/wok/model/peers.py): `src/wok/model/peers.py`
- [Task model](https://github.com/kimchi-project/wok/blob/master/src/wok/model/tasks.py): `src/wok/model/tasks.py`
- [Notifications](https://github.com/kimchi-project/wok/blob/master/src/wok/model/notifications.py): `src/wok/model/notifications.py`

### Browser Interface

- [API client](https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.api.js): `ui/js/src/wok.api.js`
- [Main interface](https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.main.js): `ui/js/src/wok.main.js`
- [Data grids](https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.grid.js): `ui/js/src/wok.grid.js`
- [Lists and tables](https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.list.js): `ui/js/src/wok.list.js`
- [Charts](https://github.com/kimchi-project/wok/blob/master/ui/js/src/wok.line-chart.js): `ui/js/src/wok.line-chart.js`

### Identity and Operations

- [Authentication](https://github.com/kimchi-project/wok/blob/master/src/wok/auth.py): `src/wok/auth.py`
- [Async task queue](https://github.com/kimchi-project/wok/blob/master/src/wok/asynctask.py): `src/wok/asynctask.py`
- [Request logging](https://github.com/kimchi-project/wok/blob/master/src/wok/reqlogger.py): `src/wok/reqlogger.py`
- [Push server](https://github.com/kimchi-project/wok/blob/master/src/wok/pushserver.py): `src/wok/pushserver.py`
- [Errors and messages](https://github.com/kimchi-project/wok/blob/master/src/wok/exception.py): `src/wok/exception.py`

### Other components

- **Browser user**
- **PAM / LDAP**

## Connections

- Browser user → CherryPy server: opens Wok (evidence: `README.md`)
- CherryPy server → Root router: mounts root (evidence: `src/wok/server.py`)
- CherryPy server → Model base: creates model (evidence: `src/wok/server.py`)
- CherryPy server → Request logging: starts logger (evidence: `src/wok/server.py`)
- Root router → REST resources: uses resources (evidence: `src/wok/root.py`)
- REST resources → Response rendering: renders responses (evidence: `src/wok/control/base.py`)
- REST resources → Model base: calls model
- Root router → Authentication: authenticates (evidence: `src/wok/root.py`)
- Authentication → PAM / LDAP: checks identity
- Model base → Plugin discovery: loads plugins
- Task model → Async task queue: reads task queue (evidence: `src/wok/model/tasks.py`)
- Notifications → Push server: sends notifications (evidence: `src/wok/model/notifications.py`)
- Async task queue → Request logging: records updates (evidence: `src/wok/asynctask.py`)
- Main interface → API client: uses API
- Browser user → Main interface: uses interface
- API client → CherryPy server: requests REST
- Main interface → Data grids: displays grids
- Main interface → Lists and tables: displays lists
- Main interface → Charts: displays charts
