Kroki provides a unified API with support for BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag, RackDiag), BPMN, Bytefield, C4 (with PlantUML), D2, DBML, Diagrams.net (experimental), Ditaa, Erd, Excalidraw, GoAT, GraphViz, Mermaid, Nomnoml, Pikchr, PlantUML, SvgBob, Symbolator, UMLet, Vega, Vega-Lite, WaveDrom and WireViz… and more to come!
This section offers a basic tutorial for evaluating Kroki. More comprehensive installation instructions are in the Kroki documentation.
The repository also contains a self-hosted product layer in product/.
It adds a TypeScript/Fastify Gateway, shared project contracts, a VS Code extension,
a GitHub Action, and a Docker Compose topology in front of the Kroki rendering backend.
The Action supports read-only pull-request checks, preview artifacts, renderer annotations,
and trusted-event generation without committing automatically; see
the setup and fork-security guide.
The VS Code extension provides live preview,
Problems diagnostics, SVG/PNG export, optional render-on-save, and Gateway connection checks.
The complete local, VS Code, GitHub Action, pilot, release, and rollback procedure is in
the E2E setup and acceptance guide.
The default personal CI profile uses a trusted Windows self-hosted runner and local Gateway
for automatic internal pull-request checks and post-merge checks on main. Heavy upstream
Kroki and deployment-documentation workflows are scoped to owned paths or manual/nightly execution.
Pull requests use quick quality/Java/Extension checks; full Product Compose, container security,
performance, recovery, and upstream image smoke run on main, manual candidates, or nightly.
Install and verify the product workspace independently:
$ npm ci --prefix product $ npm run typecheck --prefix product $ npm test --prefix product $ npm run build --prefix product
With the product Compose stack running and DIAGRAM_API_KEY configured, run the renderer acceptance gate:
$ npm run test:renderers --prefix product
Phase 6 reliability gates can be run against the same reference stack:
$ npm run test:security --prefix product $ npm run test:performance --prefix product $ npm run test:soak --prefix product $ npm run test:recovery --prefix product $ npm run test:container-policy --prefix product
The Compose deployment runs Gateway, Kroki, and Mermaid as non-root containers with
read-only root filesystems, dropped capabilities, CPU/memory/PID limits, and restart
policies. Tune the *_CPU_LIMIT, *_MEMORY_LIMIT, and *_PIDS_LIMIT variables in
product/deploy/.env.example for the target host.
Kroki uses a simple algorithm (deflate + base64) to encode your diagram in the URL:
GET /plantuml/svg/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000
You can also call Kroki with POST:
POST /
{
"diagram_source": "Bob -> Alice : hello",
"diagram_type": "plantuml",
"output_format": "svg"
}In this case, you don’t need to encode your diagram.
It’s also possible to send your diagram as plain text using the Content-Type header.
The output format will be specified using the Accept header and the diagram source will be sent as the request body:
POST /plantuml
Accept: image/svg+xml
Content-Type: text/plain
Bob -> Alice : helloYou can also define the output format in the URL if you don’t want to add an Accept header:
POST /plantuml/svg
Content-Type: text/plain
Bob -> Alice : helloThe same concept applies when sending the diagram as JSON:
POST /plantuml/svg
{
"diagram_source": "Bob -> Alice : hello"
}Kroki has a modular architecture:
- server
-
A Java web server (powered by Vert.x) that acts as a gateway. Kroki server is built using Maven.
- umlet
-
A tiny Java API on top of UMlet (mini) to generate diagrams.
- nomnoml
-
A Node.js CLI on top of the Nomnoml diagram library.
- vega
-
A Node.js CLI on top of the vega diagram library. Also supports Vega-Lite concise grammar.
- mermaid
-
A companion web server written in JavaScript (powered by micro) that provides Mermaid diagram library.
- bpmn
-
A companion web server written in JavaScript (powered by micro) that provides bpmn-js diagram library.
- bytefield
-
A Node.js CLI on top of the bytefield-svg diagram library.
- wavedrom
-
A Node.js CLI on top of the wavedrom diagram library.
- excalidraw
-
A companion web server written in JavaScript (powered by micro) that provides Excalidraw.
- diagrams.net
-
A companion web server written in JavaScript (powered by micro) that provides diagrams.net.
Install task command-line: https://taskfile.dev/installation/
Building the Kroki fork requires JDK 25. The first step is to build the project using Maven:
$ task mavenBuild
On Windows, the repository wrapper can be used directly:
$ mvnw.cmd --no-transfer-progress test
To build all the Docker images, use the following command:
$ sudo task dockerBuildImages
The default build targets the runner’s native architecture and loads each image into Docker for immediate use. Nightly and release automation can opt into a multi-architecture export with BUILD_MULTIARCH=true; multi-architecture output cannot be loaded into the local Docker image store.
|
Note
|
sudo might not be needed depending on your distribution and docker configuration.
|
Once the Docker images are built, you can run Kroki using docker:
$ docker run -d -p 8000:8000 yuzutech/kroki
If you want to use one of the following diagram libraries then you will also need to start the corresponding companion container:
- yuzutech/kroki-mermaid
-
Mermaid
- yuzutech/kroki-bpmn
-
BPMN
- yuzutech/kroki-excalidraw
-
Excalidraw
- yuzutech/kroki-diagramsnet (experimental)
-
diagrams.net
You can use docker-compose to run multiple containers:
services:
core:
image: yuzutech/kroki
environment:
- KROKI_MERMAID_HOST=mermaid
- KROKI_BPMN_HOST=bpmn
- KROKI_EXCALIDRAW_HOST=excalidraw
# experimental!
- KROKI_DIAGRAMSNET_HOST=diagramsnet
ports:
- "8000:8000"
mermaid:
image: yuzutech/kroki-mermaid
expose:
- "8002"
bpmn:
image: yuzutech/kroki-bpmn
expose:
- "8003"
excalidraw:
image: yuzutech/kroki-excalidraw
expose:
- "8004"
# experimental!
diagramsnet:
image: yuzutech/kroki-diagramsnet
expose:
- "8005"$ docker-compose up -d