kroki
repository·main·Indexed 26 days ago
https://github.com/yuzutech/krokiKroki provides a unified API for generating diagrams (such as Mermaid, PlantUML, GraphViz, and BPMN) from text-based descriptions. It utilizes a modular architecture consisting of a Vert.x-based Gateway Server and specialized companion servers for libraries like bpmn-js, Excalidraw, and diagrams.net. The system supports URL-based GET requests and POST requests, and can be deployed via Docker or Docker Compose.
What's inside kroki
- Kroki server acts as a gateway and provides a unified API on top of various diagramming libraries.
Overview of Kroki benefits
mainKroki provides a unified API to interact with a wide variety of diagramming libraries (including those written in Haskell, Python, JavaScript, Go, PHP, Java, and C) without requiring you to install their individual dependencies locally. It is a free, open-source service built with a modern architecture designed for high performance.Overview of the BPMN server
mainThe BPMN server renders BPMN 2.0 XML into SVG format. It achieves this by using a headless Chromium instance that runs thebpmn-jsviewer to perform the conversion.Overview of Kroki diagram support
mainKroki provides a unified HTTP API that converts plain text diagram definitions into images. It supports a wide variety of diagramming languages including:
- BlockDiag family: BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag, RackDiag
- Flow & Logic: BPMN, Mermaid, PlantUML, GraphViz, Structurizr, Ditaa, Erd, UMLet
- Data & Hardware: Bytefield, WaveDrom, WireViz, Vega, Vega-Lite
- Visual & Sketch: Excalidraw, Diagrams.net (experimental), SvgBob, Nomnoml, GoAT, Symbolator
Understand Kroki Architecture and Components
mainKroki uses a modular architecture consisting of a central Gateway Server and several specialized companion web servers.
- Gateway Server: The main entry point. Built with Vert.x, it routes incoming requests to the appropriate diagram services.
- Companion Servers: Specialized JavaScript-based servers (powered by micro) that provide specific diagramming capabilities:
- Mermaid: Provides the Mermaid library.
- BPMN: Provides bpmn-js for BPMN diagrams.
- Excalidraw: Provides Excalidraw rendering.
- Diagrams.net: Provides diagrams.net rendering (experimental).
Supported diagram types in Kroki
mainKroki supports a wide variety of diagramming languages and visualization formats. You can generate diagrams for UML, C4 architecture, general purpose diagrams, and data visualizations. For specific syntax examples and inspiration, visit the official Kroki examples page.Configure Server Listening Host and Port
mainBy default, Kroki binds to
0.0.0.0on port8000. UseKROKI_LISTENto specify a custom host and port.- IPv4/IPv6: Use
[::]:1234to bind to all interfaces. Use square brackets for specific IPv6 addresses:[2001:db8:1f70::999:de8:7648:6e8]:1234. - UNIX Domain Sockets: Prefix the path with
unix://, e.g.,unix:///var/run/kroki.sock.
Note on Deprecation:
KROKI_PORTis deprecated because it conflicts with Kubernetes/Docker environment variables. UseKROKI_LISTENinstead. If you need to explicitly set a port to avoid conflicts, useKROKI_LISTEN=0.0.0.0:PORT.- IPv4/IPv6: Use
Validate Kroki Kubernetes installation
mainTo verify that Kroki is running correctly after installation:
- Check pod status:
kubectl get pod. - Port-forward the service to access it locally:
kubectl port-forward service/kroki 8000:8000. - Test with a
curlrequest to a diagram endpoint (e.g.,seqdiag).
- Check pod status:
Use Kroki with Julia
mainThe
Kroki.jlpackage provides integrations for the Julia programming language, enabling diagram rendering in:Documenter.jlPluto.jlnotebooks- Julia's Visual Studio Code integration
Get help with Kroki
mainIf you encounter issues or need assistance with Kroki, refer to the official help documentation atproject/get-help.adoc.Install and run the Kroki gateway server using Docker or Podman
mainTo quickly start converting plain text diagrams to images, you can run the Kroki gateway server using the
yuzutech/krokiimage. By default, containers do not publish ports. To access the server from your host, use the--publishor-pflag to map the container's port (default 8000) to a host port.To run the server in the foreground and map port 8000:
Docker:
docker run -p8000:8000 yuzutech/krokiPodman:
podman run -p8000:8000 yuzutech/krokiOnce running, the server is available at
http://localhost:8000.docker run -p8000:8000 yuzutech/krokiRun Kroki gateway server in detached mode
mainTo run the Kroki container in the background (detached mode) so it doesn't occupy your terminal, use the
-dflag. This requires usingdocker stoporpodman stopto shut down the service later.Docker:
docker run -p8000:8000 -d yuzutech/krokiPodman:
podman run -p8000:8000 -d yuzutech/krokidocker run -p8000:8000 -d yuzutech/kroki