A homelab diagram that rebuilds itself from code
A diagram can become outdated as soon as a device or service changes. This setup keeps the diagram as a `.d2` text file inside a repository instead of maintaining it by hand as an image. When that file changes and is pushed to GitHub, automatically rebuilds the diagram.
The workflow turns the text file into an SVG using the , converts that into a PNG, and commits the updated image back to the repository. The image shown in the README is generated from the same source file, so the visible diagram is less likely to fall out of sync. Icons for tools such as Proxmox, Talos, ArgoCD, Cilium, and Falco are not stored in the repository; they are pulled from public icon sources during the build and embedded into the SVG.
The public example keeps the `.d2` source under `docs/diagrams/` and the automation file at `.github/workflows/render-diagram.yaml`.
Key points
- The diagram is stored as a `.d2` text file instead of a hand-edited image.
- rebuilds the image whenever the source file changes.
- The workflow creates SVG and PNG outputs and commits the updated image back.
- Service icons are fetched from public icon sources during the build.
- This helps keep current as the setup grows.