Skip to content

Render an architecture diagram specified in JSON

Notifications You must be signed in to change notification settings

RealHacker/diajson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drawing diagrams for a software system is a boring chore, and it is hard to make everything aligned and symmetrical. This is my attempt to make diagram drawing a programmer-friendly experience. Just specify your diagram in a JSON file, and run:

python diajson.py your_diagram.json out.svg

The diagram is rendered in a .svg file, you can convert that to any image format you like.

The JSON file format includes several node types: box/cluster/layer/container/repeat, and edges between the nodes. The format is quite self-explanatory. To draw a diagram like this:

https://raw.githubusercontent.com/RealHacker/diajson/master/tests/test.png

Describe your diagram like this:

{
"node": {
	"type": "layer",
	"id": "root",
	"children":[
		{
			"type":"box",
			"id": "nginx",
			"label": "Nginx"
		},
		{
			"type":"cluster",
			"id": "webapp",
			"children": [
				{
					"type": "box",
					"id": "webapp1",
					"label": "webapp"
				},
				{
					"type": "box",
					"id": "webapp2",
					"label": "webapp"
				}
			]
		},
		{
			"type": "container",
			"id": "dbcontainer",
			"child":{
				"type":"repeat",
				"id": "db",
				"count": 16,
				"child": {
					"type": "box",
					"id": "dbbox",
					"label": "MySQL"
				}
			},
			"label": "DB Layer"
		}
	]
},
"edges": [
	{
		"src": "nginx",
		"dst": "webapp1"
	},
	{
		"src": "nginx",
		"dst": "webapp2"
	},
	{
		"src": "webapp1",
		"dst": "dbcontainer"
	},
	{
		"src": "webapp2",
		"dst": "dbcontainer"
	}
]
}

About

Render an architecture diagram specified in JSON

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages