Kroki
Open Source Java API to Create Diagrams from Text
Free Java Library that enables software developers to create diagrams from textual description. It supports Block Diagram, Sequence Diagram, Activity Diagram, Network Diagram & more.
Kroki is an open source MIT licensed unified Java API that enables software developers to create diagram from textual description inside their Java apps. It is a very stable unified API for all the diagram libraries that can be used anywhere. The library is following a modular architecture and has provided different modules such as a Java web server act as gateway, Umlet Java API for generating diagrams, a Node.js CLI and more.
The library has provided support for several important diagram types such as Block Diagram, BPMN, Bytefield, Sequence diagram, Activity diagram, Network diagram, Packet diagram, RackDiag, C4 (with PlantUML), Ditaa, Erd, GraphViz, Mermaid, Nomnoml, PlantUML, SvgBob, UMLet, WaveDrom & many more. The library can be exported into the following formats PNG, SVG, JPEG, PDF, Base64, and more.
The library offers great performance and speed. You can easily interact with the library using any HTTP client. It provides an HTTP API to create diagrams from textual descriptions and can handle both GET and POST requests. It supports a diagram encoding facility and allows users to use deflate + base64 algorithm with GET request.
Getting Started with Kroki
The recommended way to install Kroki is using Docker. Please use the following command for a smooth installation.
Install Kroki using Docker
docker run yuzutech/kroki
Clone Kroki git Repository
git clone https://github.com/yuzutech/kroki.git
Block Diagram Creation via Java API
A block diagram represents a very specialized, high-level flowchart used in engineering, which shows the principal parts or functions represented by blocks and interconnected by lines shows the relationship of the blocks. The open source Kroki library allows software developers to create block diagram inside their own applications using Java commands. You can also easily modify the existing diagram with ease.
Create New Block Diagram via Java
blockdiag {
blockdiag -> generates -> "block-diagrams";
blockdiag -> is -> "very easy!";
blockdiag [color = "greenyellow"];
"block-diagrams" [color = "pink"];
"very easy!" [color = "orange"];
}
Sequence Diagram Creation
The open source Java library Kroki allows software developers to create and manage sequence diagrams inside their own applications. The library allows to easily add new elements in a diagram and automatically arranging the created elements. The library easily controls the flow of activities and gives users the capability to easily insert or update titles for activities, delete an activity, rearrange actives and more
Create New Sequence Diagram via Java API
seqdiag {
browser -> webserver [label = "GET /index.html"];
browser <-- webserver;
browser -> webserver [label = "POST /blog/comment"];
webserver -> database [label = "INSERT comment"];
webserver <-- database;
browser <-- webserver;
}
Export Diagram to SVG or PDF via Java
The Kroki library gives software developers the capability to create various kinds of diagrams inside their Java applications. The library offers great performance and speed while creating diagrams. Once created you can export it to several supported file formats, such as PNG, SVG, PDF, JPEG and many more. You can specify the output format using the Accept header or can define the output format in the URL as well.