A library of C4 model macros for PlantUML that lets you draw software architecture diagrams as plain-text code.
mingrammer/diagrams
Diagram as Code: draw cloud and system architecture diagrams by writing Python, with icons for AWS, Azure, GCP, Kubernetes and more.
Open-source alternative to:Lucidchart
Microsoft Visio
- Stars
- 42,752
- Forks
- 2,733
- Open issues
- 400
- Last commit
- 5 days ago
What is it?
Diagrams is a Python library for drawing cloud system architecture diagrams as code. Instead of dragging shapes in a design tool, you describe nodes and the connections between them in a Python script, and the library renders the result with Graphviz. Because the diagram is plain code, it can be versioned in any version control system and changed alongside the infrastructure it describes.
The library ships with icon sets for major cloud providers including AWS, Azure, Google Cloud, Kubernetes, Alibaba Cloud and Oracle Cloud, along with nodes for on-premises systems, SaaS products, programming frameworks and C4 model elements. It is aimed at prototyping new architectures or documenting existing ones. It does not connect to or manage real cloud resources, and it does not generate CloudFormation or Terraform code.
An online playground lets you try the library in the browser without installing Python or Graphviz.
Key features
- 01Define architecture diagrams as Python code that can be versioned with git.
- 02Includes icon sets for AWS, Azure, GCP, Kubernetes, Alibaba Cloud, Oracle Cloud and more.
- 03Supports on-premises, SaaS, programming and C4 node types.
- 04Renders output through Graphviz.
- 05Offers an online playground that runs in the browser.
Use cases
- Prototyping a new cloud system architecture before implementation.
- Documenting an existing cloud or Kubernetes deployment as diagrams kept alongside code.
- Generating architecture diagrams in documentation pipelines.
Quick start
- 1
Install Graphviz (macOS via Homebrew)
brew install graphviz - 2
Install the diagrams package with pip
pip install diagrams
Things to know
- Requires Graphviz to be installed separately before it can render diagrams.
- Requires Python 3.9 or higher.
- It does not control cloud resources or generate Terraform or CloudFormation code; it only draws diagrams.
Topics
FAQ
- What is diagrams?
- Diagram as Code: draw cloud and system architecture diagrams by writing Python, with icons for AWS, Azure, GCP, Kubernetes and more. Diagrams is a Python library for drawing cloud system architecture diagrams as code. Instead of dragging shapes in a design tool, you describe nodes and the connections between them in a Python script, and the library renders the result with Graphviz. Because the diagram is plain code, it can be versioned in any version control system and changed alongside the infrastructure it describes.
- Is diagrams free to use? What license does it have?
- diagrams is open source under the MIT license. Check the license terms before using it in commercial products.
- Is diagrams still maintained?
- Actively maintained. The last commit to diagrams was on Oct 17, 2026.
- What can I use diagrams for?
- Prototyping a new cloud system architecture before implementation. Documenting an existing cloud or Kubernetes deployment as diagrams kept alongside code. Generating architecture diagrams in documentation pipelines.
- How do I install diagrams?
- Install Graphviz (macOS via Homebrew): brew install graphviz Install the diagrams package with pip: pip install diagrams
- Where can I get diagrams?
- The source code and installation instructions are on GitHub: https://github.com/mingrammer/diagrams
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Generates UML and other diagrams from plain-text descriptions, covering sequence, class, activity, state, Gantt and more.
A webapp that turns plain text outlines into flowcharts and diagrams, built with React and cytoscape.js.
An agent skill that has AI coding tools draw the project's architecture, constraints and change scope as an HTML map, and wait for confirmation before editing code.
An agent skill that turns natural language and real system sources like Terraform, Kubernetes, SQL and OpenAPI into editable draw.io architecture diagrams.
A modeling language and toolchain that generates live, code-based software architecture diagrams using C4-inspired notation.