Code Monkey home page Code Monkey logo

kroki-server's Introduction

Kroki

Travis build status GitHub Actions build status Zulip chat

Kroki provides a unified API with support for BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag, RackDiag), BPMN, Bytefield, C4 (with PlantUML), Diagrams.net (experimental), Ditaa, Erd, Excalidraw, Gnuplot, GraphViz, Mermaid, Nomnoml, Pikchr, PlantUML, SvgBob, UMLet, Vega, Vega-Lite and WaveDrom…​ and more to come!

Quickstart

This section offers a basic tutorial for evaluating Kroki. More comprehensive installation instructions are in the Kroki documentation.

Usage

Kroki uses a simple algorithm (deflate + base64) to encode your diagram in the URL:

GET /plantuml/svg/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000

You can also call Kroki with POST:

POST /
{
  "diagram_source": "Bob -> Alice : hello",
  "diagram_type": "plantuml",
  "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 /plantuml
Accept: image/svg+xml
Content-Type: text/plain

Bob -> Alice : hello

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

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

Bob -> Alice : hello

The same concept applies when sending the diagram as JSON:

POST /plantuml/svg
{
  "diagram_source": "Bob -> Alice : hello"
}

Project layout

Kroki has a modular architecture:

server

A Java web server (powered by Vert.x) that acts as a gateway. Kroki server is built using Maven.

umlet

A tiny Java API on top of UMlet (mini) to generate diagrams.

nomnoml

A Node.js CLI on top of the Nomnoml diagram library.

vega

A Node.js CLI on top of the vega diagram library. Also supports Vega-Lite concise grammar.

blockdiag

A companion web server written in Python (powered by Flask and Gunicorn) that provides BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag and RackDiag diagrams libraries.

mermaid

A companion web server written in JavaScript (powered by micro) that provides Mermaid diagram library.

bpmn

A companion web server written in JavaScript (powered by micro) that provides bpmn-js diagram library.

bytefield

A Node.js CLI on top of the bytefield-svg diagram library.

wavedrom

A Node.js CLI on top of the wavedrom diagram library.

excalidraw

A companion web server written in JavaScript (powered by micro) that provides Excalidraw.

diagrams.net

A companion web server written in JavaScript (powered by micro) that provides diagrams.net.

Build

Gateway Server

The first step is to install the local dependencies in your local repository using make:

$ make installLocalDependencies

Then you can build the project using Maven:

$ make buildServer

Docker Images

To build all the Docker images, use the following command:

$ sudo make buildDockerImages
Note
sudo might not be needed depending on your distribution and docker configuration.

Run

Once the Docker images are built, you can run Kroki using docker:

$ docker run -d -p 8000:8000 berkus/kroki-server

Companion Containers

If you want to use one of the following diagram libraries then you will also need to start the corresponding companion container:

yuzutech/kroki-blockdiag

BlockDiag, ActDiag, NwDiag, SeqDiag, PacketDiag, RackDiag

yuzutech/kroki-mermaid

Mermaid

yuzutech/kroki-bpmn

BPMN

yuzutech/kroki-excalidraw

Excalidraw

yuzutech/kroki-diagramsnet (experimental)

diagrams.net

You can use docker-compose to run multiple containers:

docker-compose.yml
version: "3"
services:
  core:
    image: berkus/kroki-server
    environment:
      - KROKI_BLOCKDIAG_HOST=blockdiag
      - KROKI_MERMAID_HOST=mermaid
      - KROKI_BPMN_HOST=bpmn
      - KROKI_EXCALIDRAW_HOST=excalidraw
    ports:
      - "8000:8000"
  blockdiag:
    image: yuzutech/kroki-blockdiag
    expose:
      - "8001"
  mermaid:
    image: yuzutech/kroki-mermaid
    expose:
      - "8002"
  bpmn:
    image: yuzutech/kroki-bpmn
    expose:
      - "8003"
  excalidraw:
    image: yuzutech/kroki-excalidraw
    expose:
      - "8004"
  # experimental!
  diagramsnet:
    image: yuzutech/kroki-diagramsnet
    expose:
      - "8005"
$ docker-compose up -d

kroki-server's People

Contributors

amirabramovich avatar anb0s avatar arukiidou avatar bauglir avatar berkus avatar cmorty avatar dependabot-preview[bot] avatar dependabot[bot] avatar derlin avatar ggrossetie avatar gjacquenot avatar groovytron avatar hason avatar jamietanna avatar jerojasro avatar lind avatar marcelstoer avatar marcelwaldvogel avatar marvst avatar mikaello avatar nejch avatar nekator avatar plause avatar sladkoff avatar solariz avatar ssaraswati avatar stephenc avatar sturtison avatar tkfu avatar torstenberg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.