Skip to content

Instantly share code, notes, and snippets.

@HariSekhon
Last active June 20, 2024 11:49
Show Gist options
  • Save HariSekhon/cb53b7622791718f1ee9d8709c9eec35 to your computer and use it in GitHub Desktop.
Save HariSekhon/cb53b7622791718f1ee9d8709c9eec35 to your computer and use it in GitHub Desktop.
diagrams.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowledge-Base

Diagrams

Diagrams are key for top architects and engineers.

The ability to create meaningful diagrams is the pinnacle of communication skills as an engineer

There are GUI architecture tools, but they tend to be more difficult to reproduce, you're often starting from scratch for each client.

The cutting edge is Diagrams-as-Code.

Real World Architecture Diagrams

HariSekhon/Diagrams-as-Code - ready made architecture diagrams

Mainly D2 and Python diagrams, with some MermaidJS and a little Draw.io / LucidChart.

GitHub Actions CI/CD pipelines auto-regenerate the diagrams upon any code changes and they appear directly in the rendered README.md as the resultant .png images are sourced in the markdown code.

Templates

Templates for D2 language and Python diagrams are found here, especially diagram.d2 and diagram.py.

Diagrams-as-Code Languages

Diagrams-as-Code are both cool, easier to reuse prior work and often easier to maintain.

A quick edit and they reshuffle themselves.

The lack of placement layout control (D2 issue #1285, Python Diagrams issues #44 and #819) is the main problem on more complex diagrams, for which you may want to switch to one of the top GUI tools from the next section.

  • D2 lang - excellent, easy to use DSL, my favourite
  • Python Diagrams - my prior favourite
    • good for basic Cloud Architecture diagrams with icons
  • Go Diagrams - a port of Python Diagrams
  • Cloudgram - another DSL language
  • GraphViz - the classic
    • its dot format is output by Terraform's terraform graph command
    • this is the technology under the hood of Python diagrams above which makes it easier to use for Pythonistas
  • MermaidJS - best for embedded live diagrams in GitHub READMEs
  • Structurizer - yet another DSL, limited to software models
  • MarkMap - visualize your Markdown as mindmaps, nice, can open your GitHub repo's Markdown directly, although it looks like my DevOps-Bash-tools repo is far too huge a map

Best Comparison Site (run by D2)

GUI / Online Diagrams tools

For more control and complex architecture diagrams.

  • Draw.io - mature and can export to XML
    • integrates with Confluence to embed diagrams straight into Confluence wiki pages
  • LucidChart - used this for a GCP architecture diagram for a startup interview (I got the job)
    • pre-made VPC, region, zones - quicker to start
  • CloudCraft - cloud focused diagrams
    • still only AWS and Azure diagrams as of March 2024
  • Creately - AWS, Azure and GCP diagrams
  • Excalidraw - simple whiteboard style drawings - also useful for ad-hock drawings to explain things to colleagues
  • Prezi - focused on presentations
  • Sketch
  • Cacoo
  • Gliffy
  • Visual Paradigm - enterprise, does archimate diagrams, complicated, I used this at an investment bank, not my favourite, fine for enterprise architects rather than engineers
  • Cloudairy - new, buggy UI when I tried it
  • Swimm - AI to generate diagrams from code and documentation sources

Important Icon Sets to import into D2

Python Diagrams has the best library, some highlights are below but check their adjacent categories too:

Interactive Playground Editors

GraphViz

in HariSekhon/Templates

generate .png using the dot command:

dot -T png template.gv -o file.png >/dev/null

open the generated .png file:

if uname -s | grep -q Darwin; then
  open file.png  # Mac
else
  sxiv file.png  # Linux
fi
Ported from various private Knowledge Base pages 2020+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment