Nothing Special   »   [go: up one dir, main page]

Creates diagrams from textual descriptions!

Kroki provides a unified API with support for BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag, RackDiag), BPMN, Bytefield, C4 (with PlantUML), D2, DBML, Ditaa, Erd, Excalidraw, GraphViz, Mermaid, Nomnoml, Pikchr, PlantUML, Structurizr, SvgBob, Symbolator, TikZ, UMLet, Vega, Vega-Lite, WaveDrom, WireViz... and more to come!

📢 We're planning the future of Kroki, and we need your insights!

Please take a moment to fill out our short questionnaire – your feedback is crucial in helping us grow.

Features#

Ready to use
Diagrams libraries are written in a variety of languages: Haskell, Python, JavaScript, Go, PHP, Java... some also have C bindings. Trust us, you have better things to do than install all the requirements to use them. Get started in no time!
Simple
Kroki provides a unified API for all the diagram libraries. Learn once use diagrams anywhere!
Free & Open source
All the code is available on GitHub and our goal is to provide Kroki as a free service.
Fast
Built using a modern architecture, Kroki offers great performance.

Try#

MainBasemain.viewsingletonbase.componentcomponentmodelmain.ts
GET https://kroki.io/plantuml/svg/eNpljzEPgjAQhff-iguTDFQlcYMmuru5mwNO0tCWhjY6GP-7LRJTdHvv7r67d26QxuKEGiY0gyML5Y65b7GzEvblIalYbAfs6SK9oqOSvdFkPCi6ecYmaj2aXhFkZ5QmgycD2Ogg-V3SI4_OyTjgR5OzVwqc0NECNEHydtR2NGH3TK2dHjtSP3zViPmQd9W2ERmgg-iv3jGW4MC5-L-wTEJdi1XeRENRiFWOtMfnrclriQ5gJD-Z3x9beAM=

Examples#

Looking for inspiration? Visit the examples page.

Diagram types#

The following diagram types and output formats are available:

Diagram Type png svg jpeg pdf txt base64
BlockDiag ✔️ ✔️ ✔️
BPMN ✔️
Bytefield ✔️
SeqDiag ✔️ ✔️ ✔️
ActDiag ✔️ ✔️ ✔️
NwDiag ✔️ ✔️ ✔️
PacketDiag ✔️ ✔️ ✔️
RackDiag ✔️ ✔️ ✔️
C4 with PlantUML ✔️ ✔️ ️✔️ ️✔️ ✔️
D2 ✔️
DBML ✔️
Ditaa ✔️ ✔️
Erd ✔️ ✔️ ✔️ ✔️
Excalidraw ✔️
GraphViz ✔️ ✔️ ✔️ ✔️
Mermaid ✔️ ✔️
Nomnoml ✔️
Pikchr ✔️
PlantUML ✔️ ✔️ ️✔️ ️✔️ ✔️
Structurizr ️✔️ ✔️ ️✔️ ️✔️ ✔️
Svgbob ✔️
Symbolator ✔️
TikZ ✔️️ ✔️ ✔️️ ️✔️
UMlet ✔️ ✔️ ✔️
Vega ✔️ ✔️ ✔️
Vega-Lite ✔️ ✔️ ✔️
WaveDrom ✔️
WireViz ✔️ ✔️

You don't see your favorite diagram tool in this list, please let us know 👋 hello@kroki.io.

Cheat sheet#

Install#

Kroki is available as a Free Service and as a Self-Managed instance.

Self-Managed

Select this option if you want to download and install Kroki on your own infrastructure or in a cloud environment.

Please note that Kroki Self-Managed requires Linux experience to install.

Please refer to the documentation to install Kroki.

Free service

Thanks to Exoscale, which has kindly offered two servers, we can provide Kroki as a free service!
However, some parts of the infrastructure are still host on other providers, so we are still looking for sponsors to cover all the expenses.

If you are interested, please 👋 contact us.

How#

Kroki provides an HTTP API to create diagrams from textual descriptions. Kroki handles both GET and POST requests. When using GET requests, your diagram must be encoded in the URL using a deflate + base64 algorithm. But don't worry, if you're not familiar with deflate or base64 (or if you don't want to use them), you can also send your diagram as plain text using POST requests (see below).

Let's take an example with a GraphViz "Hello World":

hello.dot
digraph G {Hello->World}

Here, we are using a Python one-liner to encode our diagram using deflate + base64:

cat hello.dot | python -c "import sys; import base64; import zlib; print(base64.urlsafe_b64encode(zlib.compress(sys.stdin.read().encode('utf-8'), 9)).decode('ascii'))"
In the documentation, we provide code examples that demonstrate how to encode a diagram in Node.js, JavaScript, Java, Python and Go.

The above command will return a value that you can copy and paste at the end of the URL:

GET /graphviz/svg/eNpLyUwvSizIUHBXqPZIzcnJ17ULzy_KSanlAgB1EAjQ

And here's the result:

G Hello Hello World World Hello->World

Please note that the encoding process is lossless. As a matter of fact, you can also use a Python one-liner to decode an encoded diagram:

echo "eNpLyUwvSizIUHBXqPZIzcnJ17ULzy_KSanlAgB1EAjQ" | python -c "import sys; import base64; import zlib; print(zlib.decompress(base64.urlsafe_b64decode(sys.stdin.read())).decode('utf8'))"

The above command will return:

digraph G {Hello->World}

POST requests#

You can also call Kroki with POST:

POST /
{
  "diagram_source": "digraph G {Hello->World}",
  "diagram_type": "graphviz",
  "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 /graphviz
Accept: image/svg+xml
Content-Type: text/plain

digraph G {
  Hello->World
}

You can also define the output format in the URL if you don't want to add an Accept header:

POST /graphviz/svg
Content-Type: text/plain

digraph G {
  Hello->World
}

The same concept applies when sending the diagram as JSON:

POST /graphviz/svg
{
  "diagram_source": "digraph G {Hello->World}"
}

Please note that you can interact with the API using any HTTP client.
If you want to learn more, head to our documentation. In particular, check out the Usage section to find out how to send requests to the Kroki API using:

Sponsors#

Thanks to our sponsors listed below, we are able to provide Kroki as a free service available to everyone.

Sponsors play a critical role, without them, we won't be able to provide Kroki as a free service.
To make Kroki sustainable, we need your support. If you want to become a sponsor, please 👋 contact us.

About#

Kroki is a free service built and maintained by Yuzu tech and supported by Exoscale.

Kroki is an open source project licensed under the MIT license.
This means that Kroki is never going away; anyone can host this service with minimal resource requirements.