Homelab diagrams
The r/homelab network diagram from an inventory, in YAML or Python, dark or light, with an HTML page.
A homelab diagram draws a lab the way people post it on r/homelab: the path from the internet through the ISP box
and the firewall to the switch, every switch port with its VLANs, cables as thick as their negotiated speed, the
devices, and each server with its hardware, guests, storage pools and VLAN zones. You describe the lab; spinagram
places every card, port and cable. The design follows
Goblinmine/homelab-diagram (MIT), whose example lab ships as
examples/homelab/reference.yaml.
The inventory
A YAML file with type: homelab is an inventory. Every section is optional; leave one out and the others close up.
type: homelab
id: HL01
meta: {title: My Homelab, date: November 2026, watermark: u/me, domain: example.com}
redact: {domain: true, domain_placeholder: redacted.com, ssid_names: true}
vlans:
- {key: "10", name: LAN, subnet: 10.0.10.0/24, color: "#58a6ff", note: trusted}
- {key: wan, tag: ISP, name: WAN, color: "#f85149"}
internet: {note: public IPv4, speed: {down: 600 Mbit/s, up: 50 Mbit/s}, cloud_services: [{name: Cloudflare, icon: cloudflare}]}
remote: {name: Remote access, note: WireGuard, icon: wireguard}
isp: {name: Modem, type: ISP box, stub: true} # stub: a box you don't manage, no port row
firewall: {name: OPNsense, type: router/firewall, ip: 10.0.99.1, hw: [...], services: [...]}
switches:
- id: core
name: MikroTik
ports: # speed: 10G | 2.5G | 1G | 100M (the cable width)
- {name: ether1, to: firewall, speed: 2.5G, tagged: ["10", "20"]}
- {name: ether2, to: PC, speed: 1G, untagged: "10"}
devices: [{id: pc, name: PC, type: workstation, ip: 10.0.10.30, vlan: "10", icons: [linux]}]
servers:
- id: pve
name: pve
hw: [{icon: glyph-cpu, label: CPU, value: Ryzen 9 9900X, sub: 12 cores}]
guests: [{id: 133, kind: VM, name: TrueNAS, vlan: "10", pools: [...]}]
zones:
- vlan: "20"
groups: [{name: Media, guests: [{id: 152, name: Jellyfin, icons: [jellyfin], host: jellyfin}]}]
flows: [{title: Media pipeline, nodes: [...], stacks: [...], shares: [...], edges: ["seerr -> arrs: request"]}]- A port's
tonames a device, server, switch orfirewallby id or name;freeandrescuedim the port. A device or server can also name its port:port: core.ether3. A switch on another switch's port gets its own row. untaggedis the access VLAN (tall tick, cable in the VLAN colour);taggedmakes a trunk (short ticks, a light cable with a dark core).- Guests:
hostis a public name behind the reverse proxy (app.<domain>, a link in the HTML page),internalaname.internalone;exposure: localadds a LAN pill;appsmakes one card with a row per app;docker: trueadds the Docker badge to such a card. - Icons are names in the
selfhostedpack (dashboard-icons),glyph-*hardware glyphs, or anypack:name. spinagram.homelab.from_reference()converts an inventory written for the reference script.
The same lab in Python
Homelab has a verb per inventory entry and builds the same diagram:
from spinagram import Homelab
h = Homelab("HL01", "My Homelab", domain="example.com", date="November 2026")
h.vlan("10", "LAN", subnet="10.0.10.0/24", color="#58a6ff")
h.vlan("20", "DMZ", subnet="10.0.20.0/24", color="#f0883e")
fw = h.firewall("OPNsense", type="router/firewall", ip="10.0.99.1")
fw.hw("CPU", "i3-9100T", icon="glyph-cpu").service("AdGuard Home", icon="adguard-home")
sw = h.switch("core", "MikroTik", model="CRS310-8G+2S+")
sw.port("ether1", to="firewall", speed="2.5G", tagged=["10", "20"])
sw.port("sfpp2", to="terra", speed="10G", tagged=["10", "20"])
srv = h.server("terra", "terra", model="Proxmox Server", os="Proxmox VE 9.2", icons=["proxmox"])
srv.hw("CPU", "Ryzen 9 9900X", icon="glyph-cpu", sub="12 cores · 24 threads")
media = srv.zone("20", note="one LXC per service").group("Media")
for ct, name, host in [(152, "Jellyfin", "jellyfin"), (158, "Immich", "immich")]:
media.guest(ct, name, icons=[name.lower()], host=host)The whole example lab in verbs is examples/homelab/reference.py.
h.inventory() dumps it back to the YAML form; Homelab.load(path) reads one.
Dark and light
The built-in homelab theme is the dark design and the default for homelab diagrams; -t homelab-light (or
meta.mode: light) renders the light variant with the same geometry: VLAN colours are darkened until they read on
light cards and trunk cables invert. Any other -t theme still wins.
Posting it publicly
With redact:, the real domain becomes the placeholder everywhere (texts, hostnames, links, {domain}
templates) and SSIDs show their redacted names. SPINAGRAM_UNREDACTED=1 spinagram render lab.yaml renders the
real values into <name>-unredacted.*, so the private file never overwrites the shareable one.
The HTML page
spinagram render lab.yaml -f html writes one self-contained page (no external requests, opens from file://):
drag to pan, scroll to zoom, hostnames are links, and / searches every service by name, hostname, guest, server
or VLAN; picking one zooms to its card.
Building blocks in any diagram
spinagram.homelab.blocks draws the pieces into a plain, hand-placed diagram: folder_card, port_row,
ctx.cable, hw_tile, service_tile, chip, guest_card, pool, vlan_table, legend, forwards.
"""Homelab building blocks in a plain diagram: a folder-tab device card, a switch with VLAN-ticked ports, a trunk
and an access cable, hardware tiles and a service chip, placed by hand. Use them to give any network diagram the
homelab look; `spinagram.homelab.blocks` lists them all."""
from spinagram import Diagram
from spinagram.homelab import blocks as B
from spinagram.homelab.inventory import Device, Guest, Hw, Port, Switch
d = Diagram("BLOCKS01", "Homelab blocks in a plain diagram", canvas=(1500, 560), theme="homelab")
ctx = B.context(d, domain="example.com", vlans=[
{"key": "10", "name": "LAN", "color": "#58a6ff"},
{"key": "20", "name": "DMZ", "color": "#f0883e"},
])
sw = Switch(name="Core", type="switch", model="MikroTik CRS305", ip="10.0.10.2", internal="core", icons=["mikrotik"],
ports=[Port(name="sfp1", to="NAS", speed="10G", untagged="10"),
Port(name="sfp2", to="Hypervisor", speed="10G", tagged=["10", "20"]),
Port(name="sfp3", to="free"), Port(name="sfp4", to="free")])
sw_w = 320 + B.ports_width(sw) + 40
core = B.folder_card(ctx, "core", 80, 120, sw_w, 112, sw, ctx.vc("10"), stroke=ctx.c("trunk-border"))
xs = B.port_xs(sw, 80 + 320)
B.port_row(ctx, sw, xs, 150, 232, core)
nas = Device(id="nas", name="NAS", type="storage", model="Synology DS923+", ip="10.0.10.5", internal="nas",
icons=["synology"], vlan="10")
nas_w, nas_h = B.card_size(ctx, nas)
nas_card = B.folder_card(ctx, "nas", 80, 420, nas_w, nas_h, nas, ctx.vc("10"))
entry = 80 + B.tab_width(ctx, nas.name, nas.type) + 34
ctx.cable("nas", [(xs[0], 232), (xs[0], 300), (entry, 300), (entry, 420)], "10G", vlan="10",
src=ctx.anchor(core, "bottom", xs[0]), dst=ctx.anchor(nas_card, "top", entry))
ctx.tag("nas-speed", entry + 6, 411, "10G", ctx.vc("10"))
hv = Device(id="pve", name="pve", type="server", model="Minisforum MS-01", ip="10.0.10.20", internal="pve",
icons=["proxmox"], trunk=True)
hv_w, hv_h = B.card_size(ctx, hv)
hv_card = B.folder_card(ctx, "pve", 640, 420, hv_w, hv_h, hv, ctx.vc("10"), stroke=ctx.c("trunk-border"))
entry = 640 + B.tab_width(ctx, hv.name, hv.type) + 34
ctx.cable("pve", [(xs[1], 232), (xs[1], 320), (entry, 320), (entry, 420)], "10G", trunk=True,
src=ctx.anchor(core, "bottom", xs[1]), dst=ctx.anchor(hv_card, "top", entry))
for i, hw in enumerate([Hw(label="CPU", value="i9-12900H", icon="glyph-cpu", sub="14 cores"),
Hw(label="Memory", value="64 GB DDR5", icon="glyph-ram")]):
B.hw_tile(ctx, f"hw{i}", 1160, 120 + i * 64, 250, hw)
B.chip(ctx, "jellyfin", 1160, 300, 300, Guest(id="201", name="Jellyfin", icons=["jellyfin"], note="streaming",
host="tv"))
The symbols work in plain YAML too: kind: folder (with tab_w, tab_h), kind: jack, kind: sfp,
kind: disk (variant: hdd | ssd | nvme) and kind: cloud.
Credits
This diagram type is based on Goblinmine/homelab-diagram by
Goblinmine (MIT). Its design, palette, example lab and glyph icons are used under that license, which ships with
the theme (src/spinagram/themes/homelab/icons/LICENSE). The light mode follows that project's pull request
#4 by 01Petard. The HTML page follows pull request
#6 by trapplab.