Home

Awesome

Draft

A commandline tool that generate High Level microservice & serverless Architecture diagrams using a declarative syntax defined in a YAML file.

Why?

I prefer to think in terms of capabilities rather than specific vendor services.

...and so on.

How draft works?

draft takes in input a declarative YAML file and generates a dot script for Graphviz

draft backend-for-frontend.yml | dot -Tpng -Gdpi=200 > backend-for-frontend.png 

Piping the draft output to GraphViz dot you can generate different output formats:

formatcommand
PNG<code>draft input.yml | dot -Tpng > output.png</code>
JPEG<code>draft input.yml | dot -Tjpg > output.jpg</code>
PostScript<code>draft input.yml | dot -Tps > output.ps</code>
SVG<code>draft input.yml | dot -Tsvg > output.svg</code>

To install GraphViz to your favorite OS, please, follow this link https://graphviz.gitlab.io/download/.

Installation Steps

To build the binaries by yourself, assuming that you have Go installed, here the steps:

Clone the repo,

git clone https://github.com/lucasepe/draft.git

Move to the 'cmd' directory:

cd draft/cmd

Generate the static assets

go generate ../...

Build the binary tool

go build -o draft

Components

The basic unit of each draft design is the component, has these attributes:

NameRequiredScopeNotes
idnoused for the connecttionsautogenerated if omitted (read more for details...)
kindyesidentify the component typesee all available kinds
providernoget the specific provider iconsee using custom icons
labelnotext below the component iconcan contain basic HTML tags
outlinenotag to group components
implnotext above the iconcan use this to specify the provider implementation
fontColornothe label text colorhex color code - supports transparency too

Notes about a component id

How is auto-generated a component id?

An auto-generated component id has a prefix and a sequential number

List of all available kinds

Draft uses a set of symbols independent from the different providers (AWS, Microsoft Azure, GCP).

Below is a list of all the components currently implemented.

Clients

Sample YAML file examples/clients.yml.

draft -impl -verbose examples/clients.yml | dot -Gdpi=110 -Tpng > examples/clients.png

Clients

Networking

Sample YAML file examples/networking.yml.

draft -impl -verbose examples/networking.yml | dot -Gdpi=110 -Tpng > examples/networking.png

Networking

Compute

Sample YAML file examples/compute.yml.

draft -impl -verbose examples/compute.yml | dot -Gdpi=110 -Tpng > examples/compute.png

Compute

Database

Sample YAML file examples/database.yml.

draft -impl -verbose examples/database.yml | dot -Gdpi=110 -Tpng > examples/database.png

Database

Storage

Sample YAML file examples/storage.yml.

draft -impl -verbose examples/storage.yml | dot -Gdpi=110 -Tpng > examples/storage.png

Storage

Security

Sample YAML file examples/security.yml.

draft -impl -verbose examples/security.yml | dot -Gdpi=110 -Tpng > examples/security.png

Security

Using custom icons

Here how to render components with specific aws, google and azure icons.

  1. Download the <u>PNG</u> icons of your cloud provider AWS, GCP, Azure

  2. Take only the icons related to the components supported by draft

  3. Make a directory with the provider name (i.e. /draft/icons/aws, /draft/icons/google, /draft/icons/azure)

  4. Rename each icon as draft components kind (i.e. dns.png, cdn.png and so on...)

  5. Run draft specifyng the icons folder using the environment variable DRAFT_ICONS_PATH

👉 I have already done all the work for points 1 to 4. So you can avoid it by copying the directory icons 👈

Connections

The arrows that join the components.

To connect an origin component with one or more targets component you need to specify at least each id.

A connection has the following properties:

AttributeTypeRequiredWhat is it?
originstringyesid of the starting component
targetsobjectyesone or more destinations

Each target has the following properties:

AttributeTypeRequiredWhat is it?
idstringyestarget component id
labelstringnotext on the connection
labeldistancefloatnodistance of the label from the connection tail
labelanglefloatnodetermine the label position relative to the tail
minlenfloatnosets the minimum connection length
numintnousefult to track an order path on your graph
colorstringnolabel color (hex color string)
dashedboolnoif true the connection line will be dashed
dirstringnoarrows direction (forward, back, both, none)
highlightboolnoif true makes the arrow thicker

Sample YAML file examples/connections.yml.

draft examples/connections.yml | dot -Gdpi=110 -Tpng > examples/connections.png

Connections

Twitter


Changelog

👉 Record of all notable changes made to a project


Examples

👉 Collection of draft architecture descriptor YAML files


(c) 2020 Luca Sepe http://lucasepe.it. MIT License