Skip to content

The open source diagram engine used in the initial prototype of Stack Dyno

License

Notifications You must be signed in to change notification settings

stevenplatt/dyagram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Dyagram (CLI)

Dyagram now ships as a standalone Python CLI that scans a Google Cloud project and renders an architecture diagram. There is no web UI.

What it does

  • Authenticates to GCP with a read-only service account key (Cloud Asset Viewer).
  • Discovers resources via Cloud Asset Inventory, builds a graph, and renders PNG/SVG diagrams with the diagrams library.
  • Saves everything locally under ./tmp/dyagram/<project-id> by default.

Requirements

  • Python 3.10+
  • Graphviz installed and on your PATH (required by the diagrams library)
    • macOS: brew install graphviz
    • Debian/Ubuntu: sudo apt-get install graphviz
  • Service account JSON key with Cloud Asset Viewer (and any other read-only scopes you need for Asset Inventory).

Install

cd apps/backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Usage

python -m src.cli --project-id YOUR_PROJECT_ID --sa-key-file /path/to/key.json --output-dir ./tmp/dyagram

Arguments:

  • --project-id (required): GCP project ID to scan.
  • --sa-key-file (required): Path to the service account JSON key.
  • --output-dir (optional): Directory for generated files. Defaults to ./tmp/dyagram.

Outputs (per project):

  • graph.json — discovered resources and relationships
  • diagram.png — rendered architecture PNG
  • diagram.svg — rendered architecture SVG

How it works

  1. Authenticates with the provided service account key (src/google_auth.py).
  2. Scans resources via Cloud Asset Inventory (src/scanner.py).
  3. Builds a graph and renders diagrams via the diagrams library (src/renderer.py).
  4. Writes all artifacts under the chosen output-dir.

Troubleshooting

  • Ensure Graphviz binaries are installed and on PATH (required by diagrams).
  • Verify the service account has Cloud Asset Viewer on the target project.
  • If Asset Inventory APIs are disabled, enable them in the project and retry.

Notes

  • No frontend is included; interaction is via the CLI.
  • You can change the output directory with --output-dir or by moving the generated files as needed.

About

The open source diagram engine used in the initial prototype of Stack Dyno

Resources

License

Stars

Watchers

Forks

Contributors

Languages