← All templates · Developer tools
Deploy Kroki in one click
Diagrams from text: PlantUML, Mermaid, Graphviz and more
What is Kroki?
Kroki is an open-source diagrams-as-code server: you send it the text of a diagram and it returns the image. One HTTP API covers PlantUML, Mermaid, Graphviz, D2, C4, Structurizr, Vega-Lite, WaveDrom and many more. Every type comes out as SVG, and many as PNG or PDF too. MkDocs, Sphinx, MediaWiki and plugins for VS Code and IntelliJ take the server's address and draw diagrams through it.
People self-host Kroki so diagrams of their internal systems stay on their own server instead of going to the free public kroki.io. One server also means no laptop or CI runner has to install the libraries themselves, which are written in several languages. It suits teams that keep their docs as code. The catch: there is no editor, only the API, so diagrams are written in an editor or docs tool of your own.
Hosting Kroki on Pethost
- You sign in to Pethost with a passkey, GitHub or Google. No machine yet? You pick a plan, and the link waits until it is ready.
- New project opens at Kroki, and you click Create project.
- In a minute or two Kroki is live at its own address with HTTPS. Its secrets are made at random, and its data is in the nightly backup.
- It is a project like any other: you or your agent can change it, roll it back or restore it.
Questions about Kroki
Is Kroki free and open source?
Yes. Kroki is released under the MIT license, with its code on GitHub at yuzutech/kroki. Its server and companion images are on Docker Hub, free to run on a machine of your own.
How do I send a diagram to the Kroki API?
POST the source as plain text to /<type>/<format>, such as /graphviz/svg, or POST JSON with diagram_source, diagram_type and output_format to /. For a GET link, deflate the source, encode it as URL-safe base64 and append it.
How do I connect GitLab to a self-hosted Kroki server?
On GitLab Self-Managed, an administrator selects Admin, then Settings > General, expands Kroki, selects Enable Kroki and enters the server's address as the Kroki URL. GitLab then draws diagram blocks in Markdown, AsciiDoc, reStructuredText and Textile.
Does Kroki have authentication?
No. Kroki has no login, users or API keys, so whoever knows its address can render diagrams on it. Its default SECURE mode does stop a diagram from reading files from the server's disk or the network.
Does Kroki render Mermaid, BPMN and Excalidraw?
Yes, through companion servers: Mermaid, BPMN, Excalidraw and the experimental diagrams.net each run in a container of their own beside the main kroki one. This template starts only the Mermaid companion, so BPMN and Excalidraw diagrams are not available.
How much memory and disk does Kroki need?
Kroki is moderate: about 800 MB of memory, most of it the browser that draws Mermaid, and it keeps nothing on disk. On Pethost the Starter plan is enough for it, with room for other apps beside it.
Kroki Docker Compose file
The template is this compose.yaml and the variables written into the project’s .env as it is created. Pethost runs the file as it is written.
Containers: kroki (yuzutech/kroki:0.33.0), mermaid (yuzutech/kroki-mermaid:0.33.0).
services:
kroki:
image: yuzutech/kroki:0.33.0
restart: unless-stopped
environment:
KROKI_MERMAID_HOST: mermaid
depends_on:
- mermaid
# Mermaid is drawn in a browser, in a container of Kroki's own. BPMN and Excalidraw would
# need two more, of about 300 MB each at rest, so they are left out.
mermaid:
image: yuzutech/kroki-mermaid:0.33.0
restart: unless-stopped
More in Developer tools
- GiteaGit hosting with pull requests and issues
- code-serverVS Code in the browser
- CoderRemote development environments from Terraform templates, opened in VS Code, JetBrains, a browser or over SSH
- HasuraInstant GraphQL and REST APIs over a Postgres database, with permissions, events and a web console
- InsForgeA backend for apps that coding agents build: Postgres, auth, storage and edge functions
- LibreDB StudioA SQL IDE in the browser for PostgreSQL, MySQL, SQLite, MongoDB, Redis and more
