@ -39,7 +39,7 @@ You should have docker installed in your system, if not click [here](https://doc
## Mac local development setup
To be able to develop and run diagrams locally on you Mac device, you should have [Python](https://www.python.org/downloads/), [Go](https://golang.org/doc/install) and [brew](https://brew.sh/) installed on your system.
To be able to develop and run diagrams locally on you Mac device, you should have [Python](https://www.python.org/downloads/), [Go](https://golang.org/doc/install), and [brew](https://brew.sh/) installed on your system.
1. Go to diagrams root directory.
@ -74,4 +74,4 @@ To be able to develop and run diagrams locally on you Mac device, you should hav
./autogen.sh
```
7. If the unit tests and the bash script `autogen.sh` is working correctly, then your system is now ready for development.
7. If the unit tests and the bash script `autogen.sh` is working correctly, then your system is now ready for development.
Diagrams lets you draw the cloud system architecture **in Python code**. It was born for **prototyping** a new system architecture design without any design tools. You can also describe or visualize the existing system architecture as well. Diagrams currently supports main major providers including: `AWS`, `Azure`, `GCP`, `Kubernetes`, `Alibaba Cloud`, `Oracle Cloud` etc... It also supports `On-Premise` nodes, `SaaS` and major `Programming` frameworks and languages.
Diagrams lets you draw the cloud system architecture **in Python code**. It was born for **prototyping** a new system architecture design without any design tools. You can also describe or visualize the existing system architecture as well. Diagrams currently supports main major providers including: `AWS`, `Azure`, `GCP`, `Kubernetes`, `Alibaba Cloud`, `Oracle Cloud` etc... It also supports `On-Premises` nodes, `SaaS` and major `Programming` frameworks and languages.
**Diagram as Code** also allows you to **track** the architecture diagram changes in any **version control** system.
@ -33,7 +33,7 @@ Diagrams lets you draw the cloud system architecture **in Python code**. It was
| ![event processing](https://diagrams.mingrammer.com/img/event_processing_diagram.png) | ![stateful architecture](https://diagrams.mingrammer.com/img/stateful_architecture_diagram.png) | ![advanced web service with on-premise](https://diagrams.mingrammer.com/img/advanced_web_service_with_on-premise.png) |
| ![event processing](https://diagrams.mingrammer.com/img/event_processing_diagram.png) | ![stateful architecture](https://diagrams.mingrammer.com/img/stateful_architecture_diagram.png) | ![advanced web service with on-premises](https://diagrams.mingrammer.com/img/advanced_web_service_with_on-premises.png) |
You can find all the examples on the [examples](https://diagrams.mingrammer.com/docs/getting-started/examples) page.
It requires **Python 3.6** or higher, check your Python version first.
**diagrams** requires **Python 3.7** or higher, check your Python version first.
It uses [Graphviz](https://www.graphviz.org/) to render the diagram, so you need to [install Graphviz](https://graphviz.gitlab.io/download/) to use **diagrams**. After installing graphviz (or already have it), install the **diagrams**.
**diagrams** uses [Graphviz](https://www.graphviz.org/) to render the diagram, so you need to [install Graphviz](https://graphviz.gitlab.io/download/) to use it.
> macOS users can download the Graphviz via `brew install graphviz` if you're using [Homebrew](https://brew.sh). Similarly, Windows users with [Chocolatey](https://chocolatey.org) installed can run `choco install graphviz`.
> macOS users using [Homebrew](https://brew.sh) can install Graphviz via `brew install graphviz` . Similarly, Windows users with [Chocolatey](https://chocolatey.org) installed can run `choco install graphviz`.
After installing Graphviz (or if you already have it), install **diagrams**:
```shell
# using pip (pip3)
@ -33,16 +35,18 @@ with Diagram("Web Service", show=False):
ELB("lb") >> EC2("web") >> RDS("userdb")
```
This code generates below diagram.
To generate the diagram, run:
```shell
$ python diagram.py
```
This generates the diagram below:
![web service diagram](/img/web_service_diagram.png)
It will be saved as `web_service.png`on your working directory.
It will be saved as `web_service.png`in your working directory.
## Next
See more [Examples](/docs/getting-started/examples) or see [Guides](/docs/guides/diagram) page for more details.
See more [Examples](/docs/getting-started/examples) or see the [Guides](/docs/guides/diagram) page for more details.
Diagram is a primary object representing a diagram.
`Diagram` is a primary object representing a diagram.
## Basic
Diagram represents a global diagram context.
`Diagram` represents a global diagram context.
You can create a diagram context with Diagram class. The first parameter of Diagram constructor will be used for output filename.
You can create a diagram context with the `Diagram` class. The first parameter of the `Diagram` constructor will be used to generate the output filename.
```python
from diagrams import Diagram
@ -19,17 +19,17 @@ with Diagram("Simple Diagram"):
EC2("web")
```
And if you run the above script with below command,
If you run the above script with the command below,
```shell
$ python diagram.py
```
It will generate an image file with single `EC2` node drawn as `simple_diagram.png` on your working directory, and open that created image file immediately.
it will generate an image file with single `EC2` node drawn as `simple_diagram.png` in your working directory and open that created image file immediately.
## Jupyter Notebooks
Diagrams can be also rendered directly inside the notebook as like this:
Diagrams can also be rendered directly inside Jupyter notebooks like this:
```python
from diagrams import Diagram
@ -42,9 +42,9 @@ diag
## Options
You can specify the output file format with `outformat` parameter. Default is **png**.
You can specify the output file format with the `outformat` parameter. The default is **png**.
> (png, jpg, svg, pdf and dot) are allowed.
> Allowed formats are: png, jpg, svg, pdf, and dot
```python
from diagrams import Diagram
@ -54,7 +54,7 @@ with Diagram("Simple Diagram", outformat="jpg"):
EC2("web")
```
The `outformat` parameter also support list to output all the defined output in one call.
The `outformat` parameter also supports a list to output all the defined outputs in one call:
```python
from diagrams import Diagram
@ -64,7 +64,7 @@ with Diagram("Simple Diagram Multi Output", outformat=["jpg", "png", "dot"]):
EC2("web")
```
You can specify the output filename with `filename` parameter. The extension shouldn't be included, it's determined by the `outformat` parameter.
You can specify the output filename with the `filename` parameter. The extension shouldn't be included, it's determined by the `outformat` parameter.
```python
from diagrams import Diagram
@ -74,7 +74,7 @@ with Diagram("Simple Diagram", filename="my_diagram"):
EC2("web")
```
You can also disable the automatic file opening by setting the `show` parameter as **false**. Default is **true**.
You can also disable the automatic file opening by setting the `show` parameter to **false**. The default is **true**.
```python
from diagrams import Diagram
@ -84,7 +84,7 @@ with Diagram("Simple Diagram", show=False):
EC2("web")
```
It allows custom Graphviz dot attributes options.
Diagrams also allow custom Graphviz dot attributes options.
> `graph_attr`, `node_attr` and `edge_attr` are supported. Here is a [reference link](https://www.graphviz.org/doc/info/attrs.html).
> Be careful when using the `-` and any shift operators together, which could cause unexpected results due to operator precedence.
> Be careful when using `-` and any shift operators together. It can cause unexpected results due to Python's operator precedence, so you might have to use parentheses.
> The order of rendered diagrams is the reverse of the declaration order.
You can change the data flow direction with `direction` parameter. Default is **LR**.
You can change the data flow direction with the `direction` parameter. The default is **LR**.
> (TB, BT, LR and RL) are allowed.
> Allowed values are: TB, BT, LR, and RL
```python
from diagrams import Diagram
@ -110,7 +112,7 @@ with Diagram("Workers", show=False, direction="TB"):
## Group Data Flow
Above worker example has too many redundant flows. In this case, you can group nodes into a list so that all nodes are connected to other nodes at once.
The above worker example has too many redundant flows. To avoid this, you can group nodes into a list so that all nodes are connected to other nodes at once:
`NOTE: It does not control any actual cloud resources nor does it generate cloud formation or terraform code. It is just for drawing the cloud system architecture diagrams.`