Generate High Level Cloud Architecture diagrams using YAML syntax.

Overview

Draft

Go Report Card     Go Coverage     Twitter     Mentioned in Awesome Go

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.

  • "do we need a DNS?" instead of "do we need Route 53?"
  • "do we need a CDN?" instead of "do we need Cloudfront?"
  • "do we need a database? if yes? what type? Relational? No SQL" instead of "do we need Google Cloud Datastore?"_
  • "do we need some serverless function?" instead of "do we need an Azure Function"

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

format command
PNG draft input.yml | dot -Tpng > output.png
JPEG draft input.yml | dot -Tjpg > output.jpg
PostScript draft input.yml | dot -Tps > output.ps
SVG draft input.yml | dot -Tsvg > output.svg

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:

Name Required Scope Notes
id no used for the connecttions autogenerated if omitted (read more for details...)
kind yes identify the component type see all available kinds
provider no get the specific provider icon see using custom icons
label no text below the component icon can contain basic HTML tags
outline no tag to group components
impl no text above the icon can use this to specify the provider implementation
fontColor no the label text color hex color code - supports transparency too

Notes about a component id

  • you can define your component id explicitly (i.e. id: MY_SERVICE_A)
  • or you can omit the component id attribute and it will be autogenerated

How is auto-generated a component id?

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

  • the prefix is related to the component kind
    • examples waf1, ..., wafN or ser1, ..., serN etc.

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 PNG 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

  • example: DRAFT_ICONS_PATH=/draft/icons draft my-file.yml | dot > ark-aws.png

👉 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:

Attribute Type Required What is it?
origin string yes id of the starting component
targets object yes one or more destinations

Each target has the following properties:

Attribute Type Required What is it?
id string yes target component id
label string no text on the connection
labeldistance float no distance of the label from the connection tail
labelangle float no determine the label position relative to the tail
minlen float no sets the minimum connection length
num int no usefult to track an order path on your graph
color string no label color (hex color string)
dashed bool no if true the connection line will be dashed
dir string no arrows direction (forward, back, both, none)
highlight bool no if 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

Issues
  • Installation steps

    Installation steps

    Hey! Can you list somewhere how to install it? I am not a Go user, so I don't know the ecosystem and package manager. I know there is a binary and packages for some distros on the release, but I didn't find how to do it manually from the source.

    opened by jhonrocha 3
  • Building fails von MacOS BigSur

    Building fails von MacOS BigSur

    `go generate ../... /usr/local/Cellar/statik/0.23.0_3/libexec/lib/python3.9/site-packages/sqlalchemy/orm/query.py:196: SyntaxWarning: "is not" with a literal. Did you mean "!="? if entities is not (): usage: statik [-h] [-p PROJECT] [--quickstart] [--autogen] [-o OUTPUT] [--clear-output] [-s] [-w] [--host HOST] [--port PORT] [--no-browser] [--deploy {sftp,netlify}] [-v] [--quiet] [--fail-silently] [--no-colorlog] [--version] statik: error: argument -s/--safe-mode: ignored explicit argument 'rc=./assets' ../icon.go:3: running "statik": exit status 2

    which statik /usr/local/bin/statik `

    opened by omichels 2
  • Labels for all components and for connections

    Labels for all components and for connections

    What is the reasoning behind only supporting labels on a subset of the components? Would it be possible to extend label support to all of them?

    Additionally, could connections support labels as well?

    bug 
    opened by trstruth 2
  • No microsevices architecture diagram can be complete without some kind of stickman!

    No microsevices architecture diagram can be complete without some kind of stickman!

    Requesting the additional of a new kind or alteration of the cli kind to have a more visual representation of a user of the service i.e. the classic stickman

      O
     /|\  
    _/ \_
    
    enhancement 
    opened by davidhopkins 2
  • Warning: using box for unknown shape cylinder

    Warning: using box for unknown shape cylinder

    Hey, this is a great idea for a tool!

    I've run into an issue while trying to create a database component. Using the following yml input:

    title: Title
    backgroundColor: '#ffffff'
    
    components:
      -
        kind: database
        label: DB
    

    Throws a warning when I try to generate a png:

    $ draft issue.yml | dot -Tpng > repro.png
    Warning: using box for unknown shape cylinder
    

    The generated png shows the db component as a box instead of a cylinder: image

    I installed draft via something like

    go get -u https://github.com/lucasepe/draft/issues/new
    cd $GOPATH/src/github.com/lucasepe/draft/cmd
    go install
    mv $GOPATH/bin/cmd $GOPATH/bin/draft
    

    Any idea what the issue could be here?

    opened by trstruth 2
  • statik: add -f flag to override any existing statik.go

    statik: add -f flag to override any existing statik.go

    The install instructions include a 'go generate' step, but it fails b/c the statik.go already exists:

    vscode ➜ /workspace/cmd (fix_statik) $ go generate ../...
    file "statik/statik.go" already exists; use -f to overwrite
    ../icon.go:3: running "statik": exit status 1
    

    Not sure if you prefer to remove the step from the instructions, or add the -f flag per this PR.

    opened by dan0nl 0
Releases(v0.8.0)
Owner
Luca Sepe
𝕋𝕖𝕔𝕙 - Golang | C | [Java]. Design multi-platform pipelines, web scrapers, data ingestion tools.
Luca Sepe
A CLI for generating ER diagrams for Ent schema

enter A CLI for generating ER (entity-relationship) diagrams for Ent schema using mermaid.js.

Ariel Mashraki 86 May 1, 2022
High level CLI utility for restic

High level CLI utility for restic

Nicco 453 May 19, 2022
A CLI tool which loads data from yaml files into the Google Cloud Spanner tables

splanter A CLI tool which loads data from yaml files into the Google Cloud Spanner tables (mainly for the development).

Yuki Ito 4 Nov 29, 2021
argv - Go library to split command line string as arguments array using the bash syntax.

Argv Argv is a library for Go to split command line string into arguments array. Documentation Documentation can be found at Godoc Example func TestAr

null 33 May 7, 2022
Improved go doc with terminal syntax highlighting

GopherDoc Improved go doc with terminal syntax highlighting. This is a modification of the original go doc command that adds terminal syntax highlight

Raven Ravener 13 Mar 18, 2022
CLI shorthand syntax for Go

CLI Shorthand Syntax CLI shorthand syntax is a contextual shorthand syntax for passing structured data into commands that require e.g. JSON/YAML. Whil

Daniel G. Taylor 2 Oct 18, 2021
CLI and web app to convert HTML markup to go-app.dev's syntax.

HTML to go-app Converter CLI and web app to convert HTML markup to go-app.dev's syntax. Installation CLI Static binaries are also available on GitHub

Felix Pojtinger 7 Feb 21, 2022
GDScript Syntax Highlighting in GNU Nano

nano-gdscript GDScript Syntax Highlighting in GNU Nano. Updated regularly every minor updates. Contributions are welcomed Installation This is 100% fr

null 0 Jun 25, 2021
sleep command accepting Go duration syntax.

gsleep sleep command accepting Go duration syntax. Installation go install github.com/forestgagnon/[email protected] Usage # Sleep 5 minutes gsleep 5m #

Forest Gagnon 1 Jan 14, 2022
Run your MapReduce workloads as a single binary on a single machine with multiple CPUs and high memory. Pricing of a lot of small machines vs heavy machines is the same on most cloud providers.

gomap Run your MapReduce workloads as a single binary on a single machine with multiple CPUs and high memory. Pricing of a lot of small machines vs he

null 20 May 1, 2022
Rclone ("rsync for cloud storage") is a command line program to sync files and directories to and from different cloud storage providers.

Rclone ("rsync for cloud storage") is a command line program to sync files and directories to and from different cloud storage providers.

rclone 32.8k May 13, 2022
A component on PolarStack, a hybrid cloud Alibaba Cloud DBaaS product

What is PolarDB Stack Daemon? PolarDB Stack Daemon is a component on PolarStack, a hybrid cloud Alibaba Cloud DBaaS product, and is designed mainly fo

null 10 Nov 21, 2021
Rclone ("rsync for cloud storage") is a command-line program to sync files and directories to and from different cloud storage providers.

Website | Documentation | Download | Contributing | Changelog | Installation | Forum Rclone Rclone ("rsync for cloud storage") is a command-line progr

null 0 Nov 5, 2021
Flag is a simple but powerful command line option parsing library for Go support infinite level subcommand

Flag Flag is a simple but powerful commandline flag parsing library for Go. Documentation Documentation can be found at Godoc Supported features bool

null 120 Apr 1, 2022
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.

dasel Dasel (short for data-selector) allows you to query and modify data structures using selector strings. Comparable to jq / yq, but supports JSON,

Tom Wright 3.2k May 17, 2022
Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.

Sampler. Visualization for any shell command. Sampler is a tool for shell commands execution, visualization and alerting. Configured with a simple YAM

Alexander Lukyanchikov 10.2k May 15, 2022
YAML Incremental Digger.

yd YAML Incremental Digger. Installation $ go install github.com/skanehira/[email protected] Usage All of first, you can read yaml file as following. $ yd fil

skanehira 15 Feb 19, 2022
YAML support for the Go language

YAML support for the Go language Why a new library? As of this writing, there already exists a de facto standard library for YAML processing for Go: h

Masaaki Goshima 690 May 12, 2022
🔄 A command-line utility to export Protocol Buffers (proto) files to YAML, and JSON

proto2yaml ?? A command-line utility to export Protocol Buffers (proto) files to YAML, and JSON. Currently supported exports are for: Packages Service

Kristof Kowalski 8 Apr 23, 2022