kroki

repository·main·Indexed 26 days ago

https://github.com/yuzutech/kroki

Kroki 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.

Tokens
13.3K
Snippets
32
Records
111
Agent score
82%

What's inside kroki

  1. Overview of Kroki benefits

    main
    Kroki 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.
  2. Overview of Kroki diagram support

    main

    Kroki 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
  3. Understand Kroki Architecture and Components

    main

    Kroki 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).
  4. Configure Server Listening Host and Port

    main

    By default, Kroki binds to 0.0.0.0 on port 8000. Use KROKI_LISTEN to specify a custom host and port.

    • IPv4/IPv6: Use [::]:1234 to 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_PORT is deprecated because it conflicts with Kubernetes/Docker environment variables. Use KROKI_LISTEN instead. If you need to explicitly set a port to avoid conflicts, use KROKI_LISTEN=0.0.0.0:PORT.

  5. Install and run the Kroki gateway server using Docker or Podman

    main

    To quickly start converting plain text diagrams to images, you can run the Kroki gateway server using the yuzutech/kroki image. By default, containers do not publish ports. To access the server from your host, use the --publish or -p flag 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/kroki

    Podman:

    podman run -p8000:8000 yuzutech/kroki

    Once running, the server is available at http://localhost:8000.

    docker run -p8000:8000 yuzutech/kroki