Package: diagrams-yaml
Diagrams as code: declarative configurations usingYAMLfor drawing cloud system architectures.Table of content:IntroductionRoadmapGetting StartedHow to InstallExamplesSyntax HighlightingPyCharmUsageCommand Line InterfaceDisclaimerIntroductionDiagrams as codeis essentially the process of managing diagrams through code rather than interactively drawing them
on specific web services such asdraw.io. It lets you generate the cloud system architecture
in adeclarativeway with widely usedYAMLsyntax (which is de facto a standard for infrastructure and
configurations).Declarative method of describing things means that a user simply describes the solution they need, how it should look,
and everything that would be in the state of the final solution, leaving the process for the software to decide.Diagrams as codebrings you the following benefits comparing to drawing architecture on your own, it:Does not require any knowledge about how to properly draw an architecture diagram. Basically, you just define a set of
resources, compose them into groups and set relationships, the rest is done for you.Allows you to track an architecture diagram changes with a version control systems such asGit.Moves collaboration to the next level: updating an architecture diagram through a pull request with a code review
instead of a video session and/or screen sharing.Reduces costs on further updating of an initial architecture diagram. Basically, when you create an image on a web
service you have to eventually store two files:PNG-like to put into your documentation andXMLto be able to
adjust your image in the future. So, there is no need to care aboutXMLanymore.Backups you in case of losingXMLfiles asYAMLfiles are always stored in a repository.Improves consistency as now a diagram is stored along the code in a repository, the place you visit and work on
frequently, and it is easier to keep it up-to-date.Currently, the following components are provided:Major cloud providers: AWS, Azure, GCP, IBM, Alibaba, Oracle, OpenStack, DigitalOcean and so on.On-Premise, Kubernetes, Firebase, Elastic, SaaS.Programming languages and frameworks.RoadmapAdd support ofC4.Add support ofCustom.Add IDEs plugins and/or web user interface for live editing.Research Confluence integration to update images from the CI-builds directly.Research ChatGRT integration.Getting StartedHow to installAs the project usesGraphvizto render the diagram, you need to install it:ForLinux—https://graphviz.gitlab.io/download/#linuxForWindows—https://graphviz.gitlab.io/download/#windowsFormacOS—https://graphviz.gitlab.io/download/#macAfter, you can install the project itself with the following command usingpip3:$pip3installdiagrams-yamlExamplesYou can find examples ofYAMLconfigurations in theexamplesfolder. Below are placed are few of them (click on the name to redirect to the configurations file).Web Services on AWSWeb Services On-PremiseExposed Pods on KubernetesMessage Collecting on GCPEvents Processing on AWSWorkers on AWSSyntax HighlightingWhen you will be writing your ownYAMLfiles, you likely need a syntax highlighting. Currently, there is no mapping
of theYAMLfiles to a specific schema to enable the syntax highlighting automatically. So, there is a need for
manual operation here.PyCharmForPyCharm, open the settings and proceed toLanguages & Framworks, then toScheams and DTDs, then toJSON Schema Mappings. After, create a new schema, name itDiagrams as code, chooseJSON Schema version 7, pastehttps://raw.githubusercontent.com/dmytrostriletskyi/diagrams-yaml/main/json-schemas/0.0.1.jsonto theSchema file or URLfield and clickApply:Open IllustrationRight after then, open aYAMLfile and click onNo JSON schemaat to bottom-right corner:Open IllustrationIt will open a panel where you can choose the newly created schema with nameDiagrams as code:Open IllustrationAs the result, you will experience the syntax highlighting when typing:Open IllustrationUsageCommand Line InterfaceTo draw an architecture, calldiagrams-yamlcommand line interface, providing a path to aYAMLfile with
configurations. The drawing will be saved in the folder the command line interface was executed from.$diagrams-yamlexamples/web-services-aws.yamlDisclaimerdiagrams-yamlis a wrapper around originaldiagrams. The originaldiagramslets you draw the cloud system architecture inPythoncode. It was born for prototyping a new system architecture
design without any design tools. Under the hood,diagrams-yamlparse aYAMLfile and map to specific set ofdiagrams's functions and classes, and executes them in proper order.But you don't have to worry aboutdiagramsbecausediagrams-yamlis self-contained and encapsulates it well.