Giter VIP home page Giter VIP logo

diagram-as-code-demo's Introduction

Diagram as Code - demo

This repo contains some demo code to demonstrate the Diagrams as Code tool 'diagram'

Our goal here is to add our diagrams to our source repository for two main reasons;

  1. Source of truth
  2. We naturally get an audit log from git

Credit

Most of the code has been obtained from a great blog post by Dylan Roy, Create Beautiful Architecture Diagrams with Python, so all credits go to him.

Prerequisites

This demo requires the following tools to be installed.

  • python3
  • graphviz
  • diagram

Demo

This demo shows the steps involved to create a diagram using code.

Step 1: Creating The Diagram Workspace

This will simply render a blank diagram with the designated label.

python3 demo1.py

Step 2: Adding The Nodes

Now that we have our workspace it’s time to add the nodes that we need for our website. Each one of our nodes are pictured, and these are the “ingredients” for the architecture we want to build. The next steps will be to organise some of our nodes into logical groupings, and then link each of the nodes with edges.

python3 demo2.py

Step 3: Grouping The Nodes

For this example we will just group the load balanced web servers. In a good number of the diagrams I have created in the past this was not always necessary, but as your architecture grows grouping these nodes within clusters usually enhances readability.

python3 demo3.py

Step 4: Linking It All Together

In this final step we will not link the nodes that we have just arranged to be leveraged in our architecture. So we are defining the flow to each node with double arrows, and you are done!

python3 demo4.py

diagram-as-code-demo's People

Contributors

shaunmclernon avatar

Watchers

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