Kroki: Free Open Source Unified API for All Diagram Types

Quick Overview

Kroki provides a free, open-source, unified API gateway that transforms textual descriptions into over 25 different diagram types, including BlockDiag, Mermaid, and PlantUML, offering output formats like SVG, PNG, PDF, and more, which can be accessed instantly via a public API or self-hosted for integration into technical documentation, CI/CD pipelines, or any project requiring programmatic diagram generation.

Key Points: Kroki offers a unified API gateway supporting over 25 diagram types, such as BlockDiag, Mermaid, PlantUML, and Excalidraw, transforming text descriptions into visual diagrams. The service is available as a free public service (kroki.io) or as a self-managed instance using Docker or Podman. Diagrams can be generated via HTTP GET or POST requests, with content encoding required for GET requests using deflate + base64 algorithms. The platform supports multiple output formats including SVG (default), PNG, JPEG, PDF, TXT, and base64 encoding. The video demonstrates deploying Kroki on Elestio (0:55) and shows the interactive 'Try' section on the website where users can test different diagram syntaxes. The documentation provides examples for generating diagrams using cURL commands and shows how to encode diagrams for URL-based GET requests. Kroki is ideal for technical documentation, CI/CD integration, and automating diagram creation within various software projects.

Context: This video serves as a detailed introduction and tutorial for Kroki, an open-source tool that acts as a unified API gateway for generating various types of diagrams (like flowcharts, sequence diagrams, etc.) directly from text-based descriptions. The presenter walks through the public website, demonstrates the live editor, reviews the supported diagram types and output formats, and shows how to deploy a self-hosted instance via Elestio.

Detailed Analysis

Kroki functions as a free, open-source, unified API for diagram generation, accepting textual descriptions and rendering them into various visual formats. The presenter begins by showing the Kroki website's 'Try' section (0:06), where users can input code for diagram types like BlockDiag and instantly see the result, including customization options for colors. The tool supports over 25 diagram types, including BlockDiag, Mermaid, PlantUML, Excalidraw, and Graphviz, with support for generating outputs in PNG, SVG, JPEG, PDF, TXT, and base64 formats, as detailed in the 'Diagram types' table (7:34). The video then transitions to demonstrating deployment using the Elestio platform (0:55), where the user selects Kroki, chooses a service plan (e.g., MEDIUM-2C-4G for $0.0219/hour), and initiates deployment (1:22). Upon successful deployment, the user receives an email with the URL and credentials for their private instance (1:24). The documentation section explains how to use the API, emphasizing that for GET requests, the diagram source must be encoded using a deflate + base64 algorithm (2:53). The presenter demonstrates using an online Encoder/Decoder tool to manually encode a simple diagram definition (3:45) and then uses the resulting URL to render the diagram in the browser (4:17). Finally, the video highlights the extensive examples available on the Kroki website, covering common graphs, UML/C4, project management, visualization (like the Vega Word Cloud example at 6:44), and more, showcasing the tool's versatility for technical documentation.

Raw markdown version of this recap