spinagram
Examples

Networks and homelabs

VLANs, racks, campus and data center networks with the network and selfhosted icon packs.

Use it for: network designs, VLAN plans, homelab documentation.

The network pack has device symbols (network:l3-switch, network:firewall, network:internet) and the selfhosted pack has logos for self-hosted software (selfhosted:proxmox, selfhosted:truenas, selfhosted:pihole). Groups become VLANs, racks or sites:

with d.group("VLAN 10 · edge", class_="vlan dmz", direction="down"):
    internet = d.box("Internet", text="ISP fibre", icon="network:internet")
    fw = d.box("Firewall", text="OPNsense", icon="selfhosted:opnsense")

Homelab diagrams from an inventory

The r/homelab look: folder-tab device cards, switch ports with VLAN ticks, cables as thick as their link speed, the hypervisor with its guests and storage pools. Describe the lab in a type: homelab inventory (or with the Homelab verbs) and spinagram places everything. See Homelab diagrams.

An r/homelab style network diagram drawn from an inventory: VLANs, firewall, switch ports, devices, a Proxmox server with its guests and a media pipeline
# A homelab diagram from an inventory (`type: homelab`): the example lab of Goblinmine/homelab-diagram
# (https://github.com/Goblinmine/homelab-diagram, MIT), in spinagram's homelab schema. No coordinates: spinagram
# places every card, port and cable. Render: spinagram render examples/homelab/reference.yaml -f svg,png
# Light mode: set meta.mode: light, or render with -t homelab-light.
type: homelab
id: HOMELAB01
title: My Homelab
meta: {date: November 2026, watermark: u/goblinmine, domain: example.com}
redact: {domain: true, ssid_names: true}
vlans:
- {key: '10', name: LAN, subnet: 10.0.10.0/24, color: '#58a6ff', note: trusted · may manage the other VLANs}
- {key: '20', name: DMZ, subnet: 10.0.20.0/24, color: '#f0883e', note: 'services · no access to LAN, GUEST or MGMT'}
- {key: '30', name: GUEST, subnet: 10.0.30.0/24, color: '#bc8cff', note: internet only · plus the NAS public share}
- {key: '40', name: IoT, subnet: 10.0.40.0/24, color: '#3fb950', note: internet only · HA gets a few narrow holes}
- {key: '99', name: MGMT, subnet: 10.0.99.0/24, color: '#e3b341', note: admin interfaces · only from LAN and VPN}
- {key: vpn, name: VPN, tag: WireGuard, subnet: 10.0.50.0/24, color: '#39c5cf', note: 'split tunnel · LAN-like access, no internet'}
- {key: wan, name: WAN, tag: Fritzbox, subnet: 192.168.178.0/24, color: '#f85149', note: untrusted · OPNsense's uplink to the Fritzbox}
internet:
  note: semi-static public IPv4
  speed: {down: 600 Mbit/s, up: 50 Mbit/s}
  cloud_services:
  - {name: Cloudflare, icon: cloudflare, note: 'DNS · *.{domain} · DNS-01 wildcard cert'}
  - {name: Backblaze B2, icon: backblaze, note: offsite copy of NAS data}
remote: {name: Remote access, icon: wireguard, note: phone + laptop · WireGuard VPN}
isp:
  name: FRITZ!Box
  type: ISP router
  model: AVM FRITZ!Box 6660 Cable
  ip: 192.168.178.1
  os: FRITZ!OS 8.25
  ports:
  - {name: cable, label: Cable, kind: coax, note: internet}
  - {name: lan1, label: 2.5G}
  - {name: lan2, label: 1G, note: exposed host}
  - {name: lan3, label: 1G}
  - {name: lan4, label: 1G}
  - {name: lan5, label: 1G}
  firewall_port: lan2
  icons: [fritzbox]
firewall:
  name: OPNsense
  type: router/firewall
  model: Lenovo thin client
  ip: 10.0.99.1
  internal: opnsense
  os: OPNsense 26.7
  wan_ip: '.20'
  hw:
  - {label: CPU, value: i3-9100T, icon: glyph-cpu, sub: 4 cores · 4 threads}
  - {label: MEMORY, value: 12 GB DDR4, icon: glyph-ram, sub: root on ZFS}
  - {label: NETWORK, value: dual 2.5G Intel, icon: glyph-nic, sub: LACP to the switch}
  - {label: NETWORK, value: 1G onboard, icon: glyph-nic, sub: WAN to the Fritzbox}
  services:
  - {name: AdGuard Home, icon: adguard-home, note: DNS for all VLANs}
  - {name: dnsmasq, icon: glyph-dhcp, note: DHCP + *.internal}
  - {name: WireGuard, icon: wireguard, note: wg0 · UDP 51820}
  - {name: Suricata IPS, icon: glyph-shield, note: outbound inspection}
  - {name: CrowdSec, icon: crowdsec, note: LAPI + pf bouncer}
  - {name: pf blocklist, icon: glyph-block, note: ~2.3k bad IPs on WAN}
  icons: [opnsense]
switches:
- name: MikroTik
  model: MikroTik CRS310-8G+2S+
  ip: 10.0.99.2
  internal: mikrotik
  os: RouterOS 7.20
  config: configured as pure L2 switch
  ports:
  - name: ether1
    to: firewall
    speed: 2.5G
    tagged: ['10', '20', '30', '40', '99']
  - name: ether2
    to: firewall
    speed: 2.5G
    tagged: ['10', '20', '30', '40', '99']
  - {name: ether3, to: MADCAT, speed: 2.5G, untagged: '10'}
  - name: ether4
    to: free
    tagged: ['10', '20', '40']
  - {name: ether5, to: JetKVM, speed: 100M, untagged: '10'}
  - name: ether6
    to: U7 Lite
    speed: 2.5G
    untagged: '99'
    tagged: ['10', '30', '40']
  - {name: ether7, to: SLZB-MR4, speed: 100M, untagged: '40'}
  - {name: ether8, to: rescue, untagged: '99'}
  - {name: sfpp1, to: MADCAT, speed: 10G, untagged: '10'}
  - name: sfpp2
    to: terra
    speed: 10G
    tagged: ['10', '20', '40', '99']
  icons: [mikrotik]
devices:
- id: madcat
  name: MADCAT
  type: workstation
  model: Gaming PC
  ip: 10.0.10.30 / .31
  internal: madcat
  os: CachyOS + Windows 11
  icons: [cachyos, microsoft-windows]
  vlan: '10'
- id: jetkvm
  name: JetKVM
  type: IP-KVM
  model: JetKVM
  ip: 10.0.10.11
  internal: jetkvm
  icons: [jetkvm]
  vlan: '10'
  console: terra
- id: ap
  name: U7 Lite
  type: access point
  model: UniFi U7 Lite · Wi-Fi 7
  ip: 10.0.99.62
  internal: u7lite
  icons: [unifi]
  vlan: '99'
  trunk: true
- id: slzb
  name: SLZB-MR4
  type: coordinator
  model: SMLIGHT SLZB-MR4 · Zigbee + Thread
  ip: 10.0.40.20
  internal: slzb-mr4
  icons: [glyph-antenna]
  vlan: '40'
ssids:
- {name: Home, vlan: '10', redacted: Home}
- {name: Guest, vlan: '30', redacted: Guest}
- {name: IoT, vlan: '40', redacted: IoT}
port_forwards:
- {port: '80, 443', to: Traefik, proto: TCP/UDP, what: 'every *.{domain} site'}
- {port: '22', to: Forgejo, what: 'git over SSH (→ :2222)'}
- {port: '1024', to: TrueNAS, what: key-only SFTP backups}
- {port: '51820', to: WireGuard, proto: UDP, what: remote access VPN}
- {port: '64001', to: qBittorrent, proto: TCP/UDP, what: incoming peers}
- {port: '2022, 25560-70, …', to: Pelican Wings, proto: TCP/UDP, what: game servers + SFTP}
servers:
- id: terra
  name: terra
  model: Proxmox Server
  ip: 10.0.10.20
  internal: terra
  os: Proxmox VE 9.2
  hw:
  - {label: CPU, value: Ryzen 9 9900X, icon: glyph-cpu, sub: 12 cores · 24 threads}
  - {label: MEMORY, value: 64 GB DDR5, icon: glyph-ram, sub: ~60 GB usable}
  - {label: GPU, value: Radeon iGPU, icon: glyph-gpu, sub: passthrough → Jellyfin (CT 152)}
  - {label: NETWORK, value: ConnectX-3 10G, icon: glyph-nic, sub: SFP+ · VLAN-aware bridge}
  - {label: SSD, value: Samsung 980 500 GB, icon: glyph-ssd, sub: NVMe · Proxmox OS}
  - {label: SSD, value: Crucial P5 Plus 2 TB, icon: glyph-ssd, sub: NVMe · guest disks}
  - {label: HDD, value: 7× Seagate Exos 16 TB, icon: glyph-hdd, sub: SAS + SATA · passthrough → TrueNAS}
  - {label: SSD, value: Samsung 970 EVO Plus 1 TB, icon: glyph-ssd, sub: NVMe · passthrough → TrueNAS}
  - {label: SSD, value: Samsung 470 128 GB, icon: glyph-ssd, sub: SATA · passthrough → TrueNAS}
  - {label: SSD, value: SK hynix 256 GB, icon: glyph-ssd, sub: SATA · passthrough → TrueNAS}
  guests:
  - id: '133'
    name: TrueNAS SCALE
    kind: VM
    icons: [truenas-scale]
    note: VM 133 · 6 vCPU · 16 GB
    ip: 10.0.10.10
    vlan: '10'
    internal: truenas
    pools:
    - name: Vault
      layout: 7 HDD + 2 SSD
      used: 48 % used · 44.2 TiB free · 85.6 TiB usable
      pct: 48.0
      groups:
      - {count: 7, label: data · RAIDZ1, sub: 7× Seagate Exos 16 TB, sub2: 1 disk may fail}
      - {kind: ssd, count: 2, label: special vdev · mirror, sub: Samsung 470 + SK hynix, sub2: metadata · 22 / 118 GiB used}
    - name: FasterBoy
      layout: 1 NVMe
      used: 5 % used · 857 GiB free · 903 GiB usable
      pct: 5.0
      groups:
      - {kind: nvme, label: data · single disk, sub: Samsung 970 EVO Plus 1 TB, sub2: no redundancy}
    footer: hourly snapshots · important datasets synced to Backblaze B2
  - id: '106'
    name: Home Assistant OS
    kind: VM
    icons: [home-assistant]
    note: VM 106 · 2 vCPU · 4 GB
    ip: 10.0.40.2
    vlan: '40'
    host: ha
    addons: [zigbee2mqtt, mosquitto, thread, matter, esphome]
    addons_text: Z2M · MQTT · OTBR · Matter · ESPHome
  - id: '129'
    name: UniFi OS Server
    icons: [unifi]
    note: CT 129 · manages the U7 Lite
    ip: 10.0.99.53
    vlan: '99'
    internal: unifi
  - id: '138'
    name: BlissOS
    kind: VM
    icons: [android]
    note: VM 138 · WhatsApp for Matrix
    ip: 10.0.10.155
    vlan: '10'
    internal: generic-android-x86-64
    badge: whatsapp
  zones:
  - vlan: '20'
    note: one unprivileged LXC per service · web apps behind Traefik (CT 149)
    groups:
    - name: Edge & security
      guests:
      - id: '149'
        name: Edge stack
        icons: [traefik, authentik]
        note: reverse proxy · SSO · security
        ip: '.49'
        docker: true
        apps:
        - {name: Traefik, icon: traefik, host: traefik}
        - {name: authentik, icon: authentik, host: auth}
        - {name: LDAP outpost, icon: authentik, note: LDAPS for Jellyfin}
        - {name: CrowdSec, icon: crowdsec, note: agent + AppSec WAF}
        - {name: Alloy, icon: alloy, note: access logs → Loki}
    - name: Monitoring
      guests:
      - id: '102'
        name: Grafana
        icons: [grafana]
        note: dashboards
        host: grafana
        exposure: local
      - id: '113'
        name: Prometheus
        icons: [prometheus]
        note: Traefik metrics
        internal: prometheus
      - id: '116'
        name: Loki
        icons: [loki]
        note: logs via Alloy
        internal: loki
      - id: '120'
        name: OpenSpeedTest
        icons: [openspeedtest]
        note: patched upload test
        host: speedtest
    - name: Media & photos
      guests:
      - id: '152'
        name: Jellyfin
        icons: [jellyfin]
        note: streaming (iGPU) + stats
        apps:
        - {name: Jellyfin, icon: jellyfin, host: jellyfin}
        - {name: Jellystat, icon: jellystat, host: jellystat}
      - id: '153'
        name: Seerr
        icons: [seerr]
        note: movie & series requests
        host: seerr
      - id: '154'
        name: '*arr stack'
        icons: [sonarr, radarr, prowlarr, bazarr]
        note: one CT, one Docker container per app
        ip: '.54'
        docker: true
        apps:
        - {name: Sonarr, icon: sonarr, host: sonarr}
        - {name: Sonarr-Ani, icon: sonarr, host: sonarr-ani}
        - {name: Radarr, icon: radarr, host: radarr}
        - {name: Prowlarr, icon: prowlarr, host: prowlarr}
        - {name: Bazarr, icon: bazarr, host: bazarr}
      - id: '140'
        name: qBittorrent
        icons: [qbittorrent]
        note: VueTorrent UI
        host: torrent
      - id: '130'
        name: MeTube
        icons: [metube]
        note: YouTube downloader
        host: yt
        exposure: local
      - id: '158'
        name: Immich
        icons: [immich]
        note: photo library
        ip: '.58'
        host: immich
    - name: Productivity
      guests:
      - id: '111'
        name: Paperless-ngx
        icons: [paperless-ngx]
        note: scanned documents
        host: paperless
      - id: '125'
        name: Stirling PDF
        icons: [stirling-pdf]
        note: PDF tools
        host: pdf
      - id: '132'
        name: Tandoor
        icons: [tandoor-recipes]
        note: recipes
        host: food
      - id: '103'
        name: Actual Budget
        icons: [actual-budget]
        note: finances
        host: actual
      - id: '134'
        name: Open WebUI
        icons: [open-webui, ollama]
        note: local AI
        apps:
        - {name: Open WebUI, icon: open-webui, host: ai}
        - {name: Ollama, icon: ollama, note: local models}
    - name: Gaming
      guests:
      - id: '100'
        name: Pelican Panel
        icons: [pelican-panel]
        note: game server panel
        host: pelican
      - id: '101'
        name: Pelican Wings
        icons: [pelican-panel]
        note: node2 · runs all game servers
        host: node2
    - name: Dev
      guests:
      - id: '131'
        name: Forgejo
        icons: [forgejo]
        note: git · SSH on public :22
        host: git
      - id: '119'
        name: Forgejo runner
        icons: [forgejo]
        note: CI / Actions
        internal: forgejo-runner
      - id: '118'
        name: Penpot
        icons: [penpot]
        note: design & prototyping
        host: penpot
    - name: Chat
      guests:
      - id: '142'
        name: Matrix
        icons: [matrix]
        note: chat server
        apps:
        - {name: Synapse, icon: matrix, host: matrix}
        - {name: Cinny, icon: cinny, note: web client (same host)}
        - {name: synapse-admin, icon: matrix, note: /admin · LAN only}
      - id: '117'
        name: mautrix bridges
        icons: [matrix, whatsapp]
        note: chat bridges → Matrix
        docker: true
        apps:
        - {name: WhatsApp, icon: whatsapp, note: mautrix-whatsapp}
        - {name: Signal, icon: signal, note: mautrix-signal}
        - {name: Discord, icon: discord, note: mautrix-discord}
  icons: [proxmox]
flows:
- title: Media pipeline
  note: how a request ends up in Jellyfin
  nodes:
  - {id: seerr, name: Seerr, icon: seerr, ct: '153', ip: '.153', sub: requests, host: seerr}
  - {id: prowlarr, name: Prowlarr, icon: prowlarr, ct: '154', ip: '.54', sub: indexers, host: prowlarr}
  - {id: jellyfin, name: Jellyfin, icon: jellyfin, ct: '152', ip: '.152', sub: streams · iGPU, host: jellyfin}
  - {id: qbit, name: qBittorrent, icon: qbittorrent, ct: '140', ip: '.140', sub: downloads, host: torrent}
  stacks:
  - id: arrs
    ct: '154'
    nodes:
    - {id: sonarr, name: Sonarr, icon: sonarr, ip: '.54', host: sonarr}
    - {id: sonarr-ani, name: Sonarr-Ani, icon: sonarr, ip: '.54', host: sonarr-ani}
    - {id: radarr, name: Radarr, icon: radarr, ip: '.54', host: radarr}
  shares:
  - {id: media, name: Media share, pool: Vault · 35.6 / 85.6 TiB used, mounts: CT 152 · 154, badge: TrueNAS SMB}
  - {id: torrents, name: Torrents share, pool: FasterBoy · 38 / 903 GiB used, mounts: CT 140 · 154 · 130, badge: TrueNAS SMB}
  edges: ['seerr -> arrs: request', 'prowlarr -> arrs: indexers', 'arrs -> qbit: torrent', 'qbit -> torrents: download', 'torrents ->
      arrs: pick up when done', 'arrs -> media: copy + rename', 'media -> jellyfin: library', 'jellyfin -> seerr: available']
  rows:
  - [seerr, arrs, prowlarr]
  - [jellyfin, null, qbit]
  - [media, null, torrents]
Python395 linesexamples/homelab/reference.yaml

The same inventory with -t homelab-light:

The same homelab diagram in the light theme
# A homelab diagram from an inventory (`type: homelab`): the example lab of Goblinmine/homelab-diagram
# (https://github.com/Goblinmine/homelab-diagram, MIT), in spinagram's homelab schema. No coordinates: spinagram
# places every card, port and cable. Render: spinagram render examples/homelab/reference.yaml -f svg,png
# Light mode: set meta.mode: light, or render with -t homelab-light.
type: homelab
id: HOMELAB01
title: My Homelab
meta: {date: November 2026, watermark: u/goblinmine, domain: example.com}
redact: {domain: true, ssid_names: true}
vlans:
- {key: '10', name: LAN, subnet: 10.0.10.0/24, color: '#58a6ff', note: trusted · may manage the other VLANs}
- {key: '20', name: DMZ, subnet: 10.0.20.0/24, color: '#f0883e', note: 'services · no access to LAN, GUEST or MGMT'}
- {key: '30', name: GUEST, subnet: 10.0.30.0/24, color: '#bc8cff', note: internet only · plus the NAS public share}
- {key: '40', name: IoT, subnet: 10.0.40.0/24, color: '#3fb950', note: internet only · HA gets a few narrow holes}
- {key: '99', name: MGMT, subnet: 10.0.99.0/24, color: '#e3b341', note: admin interfaces · only from LAN and VPN}
- {key: vpn, name: VPN, tag: WireGuard, subnet: 10.0.50.0/24, color: '#39c5cf', note: 'split tunnel · LAN-like access, no internet'}
- {key: wan, name: WAN, tag: Fritzbox, subnet: 192.168.178.0/24, color: '#f85149', note: untrusted · OPNsense's uplink to the Fritzbox}
internet:
  note: semi-static public IPv4
  speed: {down: 600 Mbit/s, up: 50 Mbit/s}
  cloud_services:
  - {name: Cloudflare, icon: cloudflare, note: 'DNS · *.{domain} · DNS-01 wildcard cert'}
  - {name: Backblaze B2, icon: backblaze, note: offsite copy of NAS data}
remote: {name: Remote access, icon: wireguard, note: phone + laptop · WireGuard VPN}
isp:
  name: FRITZ!Box
  type: ISP router
  model: AVM FRITZ!Box 6660 Cable
  ip: 192.168.178.1
  os: FRITZ!OS 8.25
  ports:
  - {name: cable, label: Cable, kind: coax, note: internet}
  - {name: lan1, label: 2.5G}
  - {name: lan2, label: 1G, note: exposed host}
  - {name: lan3, label: 1G}
  - {name: lan4, label: 1G}
  - {name: lan5, label: 1G}
  firewall_port: lan2
  icons: [fritzbox]
firewall:
  name: OPNsense
  type: router/firewall
  model: Lenovo thin client
  ip: 10.0.99.1
  internal: opnsense
  os: OPNsense 26.7
  wan_ip: '.20'
  hw:
  - {label: CPU, value: i3-9100T, icon: glyph-cpu, sub: 4 cores · 4 threads}
  - {label: MEMORY, value: 12 GB DDR4, icon: glyph-ram, sub: root on ZFS}
  - {label: NETWORK, value: dual 2.5G Intel, icon: glyph-nic, sub: LACP to the switch}
  - {label: NETWORK, value: 1G onboard, icon: glyph-nic, sub: WAN to the Fritzbox}
  services:
  - {name: AdGuard Home, icon: adguard-home, note: DNS for all VLANs}
  - {name: dnsmasq, icon: glyph-dhcp, note: DHCP + *.internal}
  - {name: WireGuard, icon: wireguard, note: wg0 · UDP 51820}
  - {name: Suricata IPS, icon: glyph-shield, note: outbound inspection}
  - {name: CrowdSec, icon: crowdsec, note: LAPI + pf bouncer}
  - {name: pf blocklist, icon: glyph-block, note: ~2.3k bad IPs on WAN}
  icons: [opnsense]
switches:
- name: MikroTik
  model: MikroTik CRS310-8G+2S+
  ip: 10.0.99.2
  internal: mikrotik
  os: RouterOS 7.20
  config: configured as pure L2 switch
  ports:
  - name: ether1
    to: firewall
    speed: 2.5G
    tagged: ['10', '20', '30', '40', '99']
  - name: ether2
    to: firewall
    speed: 2.5G
    tagged: ['10', '20', '30', '40', '99']
  - {name: ether3, to: MADCAT, speed: 2.5G, untagged: '10'}
  - name: ether4
    to: free
    tagged: ['10', '20', '40']
  - {name: ether5, to: JetKVM, speed: 100M, untagged: '10'}
  - name: ether6
    to: U7 Lite
    speed: 2.5G
    untagged: '99'
    tagged: ['10', '30', '40']
  - {name: ether7, to: SLZB-MR4, speed: 100M, untagged: '40'}
  - {name: ether8, to: rescue, untagged: '99'}
  - {name: sfpp1, to: MADCAT, speed: 10G, untagged: '10'}
  - name: sfpp2
    to: terra
    speed: 10G
    tagged: ['10', '20', '40', '99']
  icons: [mikrotik]
devices:
- id: madcat
  name: MADCAT
  type: workstation
  model: Gaming PC
  ip: 10.0.10.30 / .31
  internal: madcat
  os: CachyOS + Windows 11
  icons: [cachyos, microsoft-windows]
  vlan: '10'
- id: jetkvm
  name: JetKVM
  type: IP-KVM
  model: JetKVM
  ip: 10.0.10.11
  internal: jetkvm
  icons: [jetkvm]
  vlan: '10'
  console: terra
- id: ap
  name: U7 Lite
  type: access point
  model: UniFi U7 Lite · Wi-Fi 7
  ip: 10.0.99.62
  internal: u7lite
  icons: [unifi]
  vlan: '99'
  trunk: true
- id: slzb
  name: SLZB-MR4
  type: coordinator
  model: SMLIGHT SLZB-MR4 · Zigbee + Thread
  ip: 10.0.40.20
  internal: slzb-mr4
  icons: [glyph-antenna]
  vlan: '40'
ssids:
- {name: Home, vlan: '10', redacted: Home}
- {name: Guest, vlan: '30', redacted: Guest}
- {name: IoT, vlan: '40', redacted: IoT}
port_forwards:
- {port: '80, 443', to: Traefik, proto: TCP/UDP, what: 'every *.{domain} site'}
- {port: '22', to: Forgejo, what: 'git over SSH (→ :2222)'}
- {port: '1024', to: TrueNAS, what: key-only SFTP backups}
- {port: '51820', to: WireGuard, proto: UDP, what: remote access VPN}
- {port: '64001', to: qBittorrent, proto: TCP/UDP, what: incoming peers}
- {port: '2022, 25560-70, …', to: Pelican Wings, proto: TCP/UDP, what: game servers + SFTP}
servers:
- id: terra
  name: terra
  model: Proxmox Server
  ip: 10.0.10.20
  internal: terra
  os: Proxmox VE 9.2
  hw:
  - {label: CPU, value: Ryzen 9 9900X, icon: glyph-cpu, sub: 12 cores · 24 threads}
  - {label: MEMORY, value: 64 GB DDR5, icon: glyph-ram, sub: ~60 GB usable}
  - {label: GPU, value: Radeon iGPU, icon: glyph-gpu, sub: passthrough → Jellyfin (CT 152)}
  - {label: NETWORK, value: ConnectX-3 10G, icon: glyph-nic, sub: SFP+ · VLAN-aware bridge}
  - {label: SSD, value: Samsung 980 500 GB, icon: glyph-ssd, sub: NVMe · Proxmox OS}
  - {label: SSD, value: Crucial P5 Plus 2 TB, icon: glyph-ssd, sub: NVMe · guest disks}
  - {label: HDD, value: 7× Seagate Exos 16 TB, icon: glyph-hdd, sub: SAS + SATA · passthrough → TrueNAS}
  - {label: SSD, value: Samsung 970 EVO Plus 1 TB, icon: glyph-ssd, sub: NVMe · passthrough → TrueNAS}
  - {label: SSD, value: Samsung 470 128 GB, icon: glyph-ssd, sub: SATA · passthrough → TrueNAS}
  - {label: SSD, value: SK hynix 256 GB, icon: glyph-ssd, sub: SATA · passthrough → TrueNAS}
  guests:
  - id: '133'
    name: TrueNAS SCALE
    kind: VM
    icons: [truenas-scale]
    note: VM 133 · 6 vCPU · 16 GB
    ip: 10.0.10.10
    vlan: '10'
    internal: truenas
    pools:
    - name: Vault
      layout: 7 HDD + 2 SSD
      used: 48 % used · 44.2 TiB free · 85.6 TiB usable
      pct: 48.0
      groups:
      - {count: 7, label: data · RAIDZ1, sub: 7× Seagate Exos 16 TB, sub2: 1 disk may fail}
      - {kind: ssd, count: 2, label: special vdev · mirror, sub: Samsung 470 + SK hynix, sub2: metadata · 22 / 118 GiB used}
    - name: FasterBoy
      layout: 1 NVMe
      used: 5 % used · 857 GiB free · 903 GiB usable
      pct: 5.0
      groups:
      - {kind: nvme, label: data · single disk, sub: Samsung 970 EVO Plus 1 TB, sub2: no redundancy}
    footer: hourly snapshots · important datasets synced to Backblaze B2
  - id: '106'
    name: Home Assistant OS
    kind: VM
    icons: [home-assistant]
    note: VM 106 · 2 vCPU · 4 GB
    ip: 10.0.40.2
    vlan: '40'
    host: ha
    addons: [zigbee2mqtt, mosquitto, thread, matter, esphome]
    addons_text: Z2M · MQTT · OTBR · Matter · ESPHome
  - id: '129'
    name: UniFi OS Server
    icons: [unifi]
    note: CT 129 · manages the U7 Lite
    ip: 10.0.99.53
    vlan: '99'
    internal: unifi
  - id: '138'
    name: BlissOS
    kind: VM
    icons: [android]
    note: VM 138 · WhatsApp for Matrix
    ip: 10.0.10.155
    vlan: '10'
    internal: generic-android-x86-64
    badge: whatsapp
  zones:
  - vlan: '20'
    note: one unprivileged LXC per service · web apps behind Traefik (CT 149)
    groups:
    - name: Edge & security
      guests:
      - id: '149'
        name: Edge stack
        icons: [traefik, authentik]
        note: reverse proxy · SSO · security
        ip: '.49'
        docker: true
        apps:
        - {name: Traefik, icon: traefik, host: traefik}
        - {name: authentik, icon: authentik, host: auth}
        - {name: LDAP outpost, icon: authentik, note: LDAPS for Jellyfin}
        - {name: CrowdSec, icon: crowdsec, note: agent + AppSec WAF}
        - {name: Alloy, icon: alloy, note: access logs → Loki}
    - name: Monitoring
      guests:
      - id: '102'
        name: Grafana
        icons: [grafana]
        note: dashboards
        host: grafana
        exposure: local
      - id: '113'
        name: Prometheus
        icons: [prometheus]
        note: Traefik metrics
        internal: prometheus
      - id: '116'
        name: Loki
        icons: [loki]
        note: logs via Alloy
        internal: loki
      - id: '120'
        name: OpenSpeedTest
        icons: [openspeedtest]
        note: patched upload test
        host: speedtest
    - name: Media & photos
      guests:
      - id: '152'
        name: Jellyfin
        icons: [jellyfin]
        note: streaming (iGPU) + stats
        apps:
        - {name: Jellyfin, icon: jellyfin, host: jellyfin}
        - {name: Jellystat, icon: jellystat, host: jellystat}
      - id: '153'
        name: Seerr
        icons: [seerr]
        note: movie & series requests
        host: seerr
      - id: '154'
        name: '*arr stack'
        icons: [sonarr, radarr, prowlarr, bazarr]
        note: one CT, one Docker container per app
        ip: '.54'
        docker: true
        apps:
        - {name: Sonarr, icon: sonarr, host: sonarr}
        - {name: Sonarr-Ani, icon: sonarr, host: sonarr-ani}
        - {name: Radarr, icon: radarr, host: radarr}
        - {name: Prowlarr, icon: prowlarr, host: prowlarr}
        - {name: Bazarr, icon: bazarr, host: bazarr}
      - id: '140'
        name: qBittorrent
        icons: [qbittorrent]
        note: VueTorrent UI
        host: torrent
      - id: '130'
        name: MeTube
        icons: [metube]
        note: YouTube downloader
        host: yt
        exposure: local
      - id: '158'
        name: Immich
        icons: [immich]
        note: photo library
        ip: '.58'
        host: immich
    - name: Productivity
      guests:
      - id: '111'
        name: Paperless-ngx
        icons: [paperless-ngx]
        note: scanned documents
        host: paperless
      - id: '125'
        name: Stirling PDF
        icons: [stirling-pdf]
        note: PDF tools
        host: pdf
      - id: '132'
        name: Tandoor
        icons: [tandoor-recipes]
        note: recipes
        host: food
      - id: '103'
        name: Actual Budget
        icons: [actual-budget]
        note: finances
        host: actual
      - id: '134'
        name: Open WebUI
        icons: [open-webui, ollama]
        note: local AI
        apps:
        - {name: Open WebUI, icon: open-webui, host: ai}
        - {name: Ollama, icon: ollama, note: local models}
    - name: Gaming
      guests:
      - id: '100'
        name: Pelican Panel
        icons: [pelican-panel]
        note: game server panel
        host: pelican
      - id: '101'
        name: Pelican Wings
        icons: [pelican-panel]
        note: node2 · runs all game servers
        host: node2
    - name: Dev
      guests:
      - id: '131'
        name: Forgejo
        icons: [forgejo]
        note: git · SSH on public :22
        host: git
      - id: '119'
        name: Forgejo runner
        icons: [forgejo]
        note: CI / Actions
        internal: forgejo-runner
      - id: '118'
        name: Penpot
        icons: [penpot]
        note: design & prototyping
        host: penpot
    - name: Chat
      guests:
      - id: '142'
        name: Matrix
        icons: [matrix]
        note: chat server
        apps:
        - {name: Synapse, icon: matrix, host: matrix}
        - {name: Cinny, icon: cinny, note: web client (same host)}
        - {name: synapse-admin, icon: matrix, note: /admin · LAN only}
      - id: '117'
        name: mautrix bridges
        icons: [matrix, whatsapp]
        note: chat bridges → Matrix
        docker: true
        apps:
        - {name: WhatsApp, icon: whatsapp, note: mautrix-whatsapp}
        - {name: Signal, icon: signal, note: mautrix-signal}
        - {name: Discord, icon: discord, note: mautrix-discord}
  icons: [proxmox]
flows:
- title: Media pipeline
  note: how a request ends up in Jellyfin
  nodes:
  - {id: seerr, name: Seerr, icon: seerr, ct: '153', ip: '.153', sub: requests, host: seerr}
  - {id: prowlarr, name: Prowlarr, icon: prowlarr, ct: '154', ip: '.54', sub: indexers, host: prowlarr}
  - {id: jellyfin, name: Jellyfin, icon: jellyfin, ct: '152', ip: '.152', sub: streams · iGPU, host: jellyfin}
  - {id: qbit, name: qBittorrent, icon: qbittorrent, ct: '140', ip: '.140', sub: downloads, host: torrent}
  stacks:
  - id: arrs
    ct: '154'
    nodes:
    - {id: sonarr, name: Sonarr, icon: sonarr, ip: '.54', host: sonarr}
    - {id: sonarr-ani, name: Sonarr-Ani, icon: sonarr, ip: '.54', host: sonarr-ani}
    - {id: radarr, name: Radarr, icon: radarr, ip: '.54', host: radarr}
  shares:
  - {id: media, name: Media share, pool: Vault · 35.6 / 85.6 TiB used, mounts: CT 152 · 154, badge: TrueNAS SMB}
  - {id: torrents, name: Torrents share, pool: FasterBoy · 38 / 903 GiB used, mounts: CT 140 · 154 · 130, badge: TrueNAS SMB}
  edges: ['seerr -> arrs: request', 'prowlarr -> arrs: indexers', 'arrs -> qbit: torrent', 'qbit -> torrents: download', 'torrents ->
      arrs: pick up when done', 'arrs -> media: copy + rename', 'media -> jellyfin: library', 'jellyfin -> seerr: available']
  rows:
  - [seerr, arrs, prowlarr]
  - [jellyfin, null, qbit]
  - [media, null, torrents]
Python395 linesexamples/homelab/reference.yaml

A smaller lab (fiber ONT, 24 + 4 port switch) and a lab with two switches and two servers:

A smaller lab with a fiber ONT and a 24 + 4 port switch
# A smaller lab that differs from the reference: a fiber ONT the ISP manages (stub), a 24 + 4 port switch, a NAS
# with two links, no port forwards and no flow panel. Same schema, no coordinates.
type: homelab
id: HOMELAB02
title: Flat 3B lab
meta: {title: Flat 3B lab, date: December 2026, domain: lab.example.org}
vlans:
  - {key: "1", tag: VLAN 1, name: HOME, subnet: 192.168.1.0/24, color: "#58a6ff", note: "phones, laptops, TV"}
  - {key: "50", name: SERVERS, subnet: 192.168.50.0/24, color: "#f0883e", note: self-hosted services}
  - {key: "66", name: CAMERAS, subnet: 192.168.66.0/24, color: "#3fb950", note: no internet}
  - {key: "wan", tag: ONT, name: WAN, color: "#f85149", note: PPPoE to the ISP}
internet:
  note: "fiber, dynamic IPv4 + /56 IPv6"
  speed: {down: 1 Gbit/s, up: 500 Mbit/s}
isp: {name: Fiber ONT, type: ISP box, model: Nokia G-010G-T, stub: true}
firewall:
  name: pfSense
  type: router/firewall
  model: Protectli VP2420
  ip: 192.168.1.1
  internal: gw
  os: pfSense CE 2.8
  icons: [pfsense]
  hw:
    - {icon: glyph-cpu, label: CPU, value: Celeron J6412, sub: 4 cores}
    - {icon: glyph-ram, label: MEMORY, value: 8 GB DDR4}
  services:
    - {icon: pihole, name: Pi-hole, note: DNS for all VLANs}
    - {icon: tailscale, name: Tailscale, note: subnet router}
switches:
  - id: core
    name: Core
    type: switch
    model: Ubiquiti USW-Pro-24
    ip: 192.168.1.2
    internal: core
    os: UniFi 7.1
    icons: [unifi]
    ports:
      - {name: "1", to: firewall, speed: 2.5G, tagged: ["1", "50", "66"]}
      - {name: "2", to: TV, speed: 1G, untagged: "1"}
      - {name: "3", to: NAS, speed: 1G, untagged: "50"}
      - {name: "4", to: free}
      - {name: "5", to: Cam front, speed: 100M, untagged: "66"}
      - {name: "6", to: Cam back, speed: 100M, untagged: "66"}
      - {name: "7", to: AP, speed: 1G, untagged: "1", tagged: ["66"]}
      - {name: "8", to: free}
      - {name: "9", to: free}
      - {name: "10", to: free}
      - {name: "11", to: free}
      - {name: "12", to: free}
      - {name: "13", to: free}
      - {name: "14", to: free}
      - {name: "15", to: free}
      - {name: "16", to: free}
      - {name: "17", to: free}
      - {name: "18", to: free}
      - {name: "19", to: free}
      - {name: "20", to: free}
      - {name: "21", to: free}
      - {name: "22", to: free}
      - {name: "23", to: free}
      - {name: "24", to: rescue, untagged: "1"}
      - {name: sfp1, to: NAS, speed: 10G, untagged: "50"}
      - {name: sfp2, to: pve, speed: 10G, tagged: ["1", "50"]}
      - {name: sfp3, to: free}
      - {name: sfp4, to: free}
devices:
  - {id: tv, name: TV, type: media, model: LG C3, ip: 192.168.1.40, vlan: "1", icons: [jellyfin]}
  - {id: nas, name: NAS, type: storage, model: Synology DS923+, ip: 192.168.50.5, internal: nas, os: DSM 7.2,
     vlan: "50", icons: [synology]}
  - {id: cam1, name: Cam front, type: camera, model: Reolink RLC-810A, ip: 192.168.66.11, vlan: "66", icons: [reolink]}
  - {id: cam2, name: Cam back, type: camera, model: Reolink RLC-810A, ip: 192.168.66.12, vlan: "66", icons: [reolink]}
  - {id: ap, name: AP, type: access point, model: UniFi U6+, ip: 192.168.1.3, vlan: "1", trunk: true, icons: [unifi]}
ssids:
  - {name: Flat, vlan: "1"}
  - {name: Cams, vlan: "66"}
servers:
  - id: pve
    name: pve
    type: server
    model: Minisforum MS-01
    ip: 192.168.50.10
    internal: pve
    os: Proxmox VE 9.0
    icons: [proxmox]
    hw:
      - {icon: glyph-cpu, label: CPU, value: i9-12900H, sub: 14 cores}
      - {icon: glyph-ram, label: MEMORY, value: 64 GB DDR5}
      - {icon: glyph-ssd, label: SSD, value: 2x Samsung 990 Pro 2 TB, sub: ZFS mirror}
    zones:
      - vlan: "50"
        note: one LXC per service
        groups:
          - name: Media
            guests:
              - {id: 201, name: Jellyfin, icons: [jellyfin], note: streaming, host: tv}
              - {id: 202, name: Immich, icons: [immich], note: photos, host: photos}
          - name: Home
            guests:
              - {id: 210, name: Home Assistant, kind: VM, icons: [home-assistant], note: automations, host: ha}
              - {id: 211, name: Frigate, icons: [frigate], note: NVR for the cameras, internal: nvr, vlan: "66"}
          - name: Ops
            guests:
              - id: 220
                name: Monitoring
                docker: true
                note: one Docker host
                apps:
                  - {icon: grafana, name: Grafana, host: grafana}
                  - {icon: prometheus, name: Prometheus, note: metrics}
                  - {icon: uptime-kuma, name: Uptime Kuma, host: status}
Python112 linesexamples/homelab/small.yaml
An access switch under the core switch and two servers cabled through a gutter
# Two switches and two servers: an access switch hangs off the core switch with its own device row, and the server
# cables run down a gutter on the right into each server. No coordinates.
type: homelab
id: HOMELAB03
title: Two-rack lab
meta: {title: Two-rack lab, date: December 2026, domain: example.net}
vlans:
  - {key: "10", name: LAN, subnet: 10.10.10.0/24, color: "#58a6ff", note: trusted}
  - {key: "20", name: LAB, subnet: 10.10.20.0/24, color: "#f0883e", note: servers and services}
  - {key: "99", name: MGMT, subnet: 10.10.99.0/24, color: "#e3b341", note: switches and BMCs}
  - {key: wan, tag: ISP, name: WAN, color: "#f85149", note: DHCP from the ISP}
isp: {name: Cable modem, type: ISP box, model: Arris SB8200, stub: true}
firewall:
  name: OPNsense
  type: router/firewall
  model: Dell R210 II
  ip: 10.10.99.1
  os: OPNsense 26.7
  icons: [opnsense]
  services:
    - {icon: unbound, name: Unbound, note: DNS}
    - {icon: wireguard, name: WireGuard, note: remote access}
switches:
  - id: core
    name: Core
    model: MikroTik CRS326-24S+2Q+
    ip: 10.10.99.2
    os: RouterOS 7.20
    icons: [mikrotik]
    ports:
      - {name: sfp1, to: firewall, speed: 10G, tagged: ["10", "20", "99"]}
      - {name: sfp2, to: access, speed: 10G, tagged: ["10", "20", "99"]}
      - {name: sfp3, to: nas, speed: 10G, untagged: "20"}
      - {name: sfp4, to: pve1, speed: 10G, tagged: ["20", "99"]}
  - id: access
    name: Access
    model: MikroTik CRS112-8P-4S
    ip: 10.10.99.3
    os: RouterOS 7.20
    icons: [mikrotik]
    ports:
      - {name: ether1, to: desk, speed: 1G, untagged: "10"}
      - {name: ether2, to: printer, speed: 100M, untagged: "10"}
      - {name: ether3, to: ap, speed: 1G, untagged: "99", tagged: ["10"]}
      - {name: ether4, to: pve2, speed: 1G, tagged: ["20", "99"]}
      - {name: sfp1, to: core, speed: 10G, tagged: ["10", "20", "99"]}
devices:
  - {id: nas, name: NAS, type: storage, model: TrueNAS Mini X, ip: 10.10.20.5, internal: nas, vlan: "20", icons: [truenas-scale]}
  - {id: desk, name: Desk, type: workstation, model: Framework 16, ip: 10.10.10.20, vlan: "10", icons: [linux]}
  - {id: printer, name: Printer, type: printer, model: Brother HL-L2350DW, ip: 10.10.10.40, vlan: "10"}
  - {id: ap, name: AP, type: access point, model: UniFi U7 Pro, ip: 10.10.99.30, vlan: "99", trunk: true, icons: [unifi]}
ssids:
  - {name: Home, vlan: "10"}
servers:
  - id: pve1
    name: pve1
    model: Dell R730xd
    ip: 10.10.99.11
    internal: pve1
    os: Proxmox VE 9.0
    icons: [proxmox]
    hw:
      - {icon: glyph-cpu, label: CPU, value: 2x Xeon E5-2690 v4}
      - {icon: glyph-ram, label: MEMORY, value: 256 GB DDR4}
    zones:
      - vlan: "20"
        groups:
          - name: Apps
            guests:
              - {id: 101, name: Nextcloud, icons: [nextcloud], note: files, host: cloud}
              - {id: 102, name: Vaultwarden, icons: [vaultwarden], note: passwords, host: vault}
  - id: pve2
    name: pve2
    model: Lenovo M920q
    ip: 10.10.99.12
    internal: pve2
    os: Proxmox VE 9.0
    icons: [proxmox]
    hw:
      - {icon: glyph-cpu, label: CPU, value: i5-8500T}
    zones:
      - vlan: "20"
        groups:
          - name: Home
            guests:
              - {id: 201, name: Home Assistant, kind: VM, icons: [home-assistant], note: automations, host: ha}
Python86 linesexamples/homelab/multi.yaml

The building blocks in a hand-placed diagram:

Homelab building blocks placed by hand in a plain diagram
"""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"))
Python44 linesexamples/homelab/blocks.py

Homelab private cloud

A Proxmox VE cluster behind OPNsense, with TrueNAS storage and off-host backups, split into VLANs.

Homelab private cloud on Proxmox behind OPNsense, split into VLANs
"""A homelab private cloud: OPNsense at the edge, a core switch with Wi-Fi and DNS, a three-node Proxmox VE
cluster running K3s and services, TrueNAS storage and Proxmox Backup Server, split into VLANs. Self-hosted logos
from the `selfhosted` pack, network symbols from the `network` pack."""
from spinagram import Diagram


d = Diagram("HOME01", "Homelab private cloud", node_size=(196, 96),
            subtitle="Proxmox VE cluster behind OPNsense, with TrueNAS storage and off-host backups",
            layout={"engine": "flex", "direction": "right", "rank_gap": 28, "route": "ortho",
                    "area": [56, 176, 1808, 830]})
d.stylesheet("showcase.css")
d.stylesheet("homelab.css")

with d.group("VLAN 10 · edge", id="edge", class_="vlan dmz", direction="down", gap=22, padding=16):
    internet = d.box("Internet", text="ISP fibre", icon="network:internet", class_="external")
    fw = d.box("Firewall", text="OPNsense", icon="selfhosted:opnsense", class_="security")
    vpn = d.box("VPN", text="WireGuard", icon="selfhosted:wireguard", class_="security")
with d.group("VLAN 1 · core", id="core", class_="vlan", direction="down", gap=22, padding=16):
    wifi = d.box("Wi-Fi", text="UniFi APs", icon="selfhosted:unifi", class_="networking")
    switch = d.box("Core switch", text="10 GbE, L3", icon="network:l3-switch", class_="networking")
    dns = d.box("DNS", text="Pi-hole", icon="selfhosted:pihole", class_="networking")
with d.group("VLAN 20 · servers", id="servers", class_="vlan servers", direction="down", gap=24, padding=16):
    with d.group(id="nodes", class_="bare", direction="right", gap=12, padding=0):
        pves = [d.box(f"pve-{i}", text="Proxmox VE", icon="selfhosted:proxmox", class_="hypervisor",
                      id=f"pve-{i}") for i in (1, 2, 3)]
    with d.group("Workloads", id="workloads", class_="bare", direction="right", gap=12, padding=0):
        d.box("K3s", text="3 VMs", icon="selfhosted:k3s", class_="workload")
        d.box("Traefik", text="ingress, TLS", icon="selfhosted:traefik", class_="workload")
        d.box("Smart home", text="HA OS", icon="selfhosted:home-assistant", class_="workload")
with d.group("VLAN 30 · storage", id="storage", class_="vlan storage-vlan", direction="down", gap=36, padding=16):
    nas = d.box("TrueNAS", text="ZFS, NFS", icon="selfhosted:truenas-scale", class_="storage")
    pbs = d.box("Backups", text="Proxmox BS", icon="selfhosted:pbs", class_="storage")

internet.to(fw, step="Traffic enters through OPNsense")
vpn.to(fw, class_="remote-access")
fw.to(switch, step="VLANs trunk to the core switch")
switch - wifi
switch - dns
switch.to(pves[0], step="Workloads run on the cluster")
pves[2].to(nas, class_="storage-traffic", step="VMs mount storage on TrueNAS")
nas.to(pbs, class_="backup-job", step="Nightly backups to PBS")
d.callout(vpn, "The only way in from outside: WireGuard on 51820/udp, no other port open.",
          title="Remote access", kind="warning")
d.callout("traefik", "Let's Encrypt certificates and single sign-on for every service.", title="One front door",
          kind="tip")
d.add_legend()
Python46 linesexamples/showcase/homelab.py

Campus network

A redundant core, the access layer and endpoints, with the legend placed by the stylesheet.

Campus network with a redundant core and access layer
"""A campus network in three tiers: WAN edge, a redundant core and access switches serving Wi-Fi, phones and
desks, drawn with the Affinity symbols of the `network` pack in their colour and circle variants."""
from spinagram import Diagram

E = {"w": 210, "h": 80}

d = Diagram("NET01", "Campus network", node_size=(220, 92),
            subtitle="Redundant core, access layer and endpoints, left to right",
            layout={"engine": "flex", "direction": "right", "rank_gap": 64, "route": "ortho",
                    "area": [56, 176, 1808, 830]})
d.stylesheet("showcase.css")
d.stylesheet("campus.css")

with d.group("WAN edge", id="edge", class_="tier", direction="down", gap=40, align="center"):
    isp = d.box("ISP", text="2 × 10 Gb/s", icon="network:internet", class_="internet")
    router = d.box("Edge router", text="BGP, NAT", icon="network:router-red", class_="edge-gear")
    fw = d.box("Firewall", text="HA pair", icon="network:firewall-red", class_="edge-gear")
with d.group("Core", id="core", class_="tier", direction="down", gap=72, align="center"):
    core_a = d.box("Core A", text="L3, 100 Gb/s", icon="network:switch-multilayer-green", class_="core")
    core_b = d.box("Core B", text="L3, 100 Gb/s", icon="network:switch-multilayer-green", class_="core")
with d.group("Access", id="access", class_="tier", direction="down", gap=24, align="center"):
    floors = [d.box(f"Floor {i}", text="48 × 2.5 Gb/s", icon="network:switch", class_="access", id=f"floor-{i}")
              for i in (1, 2, 3)]
    wlc = d.box("Wireless LAN", text="controller", icon="network:wlc", class_="access")
with d.group("Endpoints", id="endpoints", class_="tier", direction="down", gap=24, align="center"):
    ap = d.box("Access points", text="Wi-Fi 7", icon="network:wifi-plain", class_="endpoint", **E)
    phone = d.box("IP phones", text="PoE", icon="network:ip-phone-circle", class_="endpoint", **E)
    desk = d.box("Desks", text="1 Gb/s", icon="network:client-circle", class_="endpoint", **E)
    printer = d.box("Printers", text="VLAN 40", icon="network:printer-circle", class_="endpoint", **E)

isp >> router >> fw
fw.to(core_a, class_="uplink")
fw.to(core_b, class_="uplink")
d.edge(core_a, core_b, "VSS", class_="redundant-link")
core_a.to([floors[0], floors[1]], class_="uplink")
core_b.to([floors[2], wlc], class_="uplink")
floors[0] >> ap
floors[1] >> phone
floors[2] >> desk
wlc.to(printer, "Wi-Fi")
d.callout(core_b, "Either core carries the whole campus: links and supervisors are redundant.",
          title="No single point of failure", kind="info")
d.add_legend()
Python43 linesexamples/showcase/campus_network.py

EVPN-VXLAN data center fabric

An eBGP underlay, an EVPN overlay, all-active ESI multihoming and two ISPs.

EVPN-VXLAN data center fabric with an eBGP underlay
"""An EVPN-VXLAN data center fabric: an eBGP underlay (one AS per spine layer and per leaf pair), an EVPN overlay
with VNI subnets (VNI 10010 = 10.10.0.0/24, VNI 10020 = 10.20.0.0/24), hosts multihomed to leaf pairs with
ESI-LAG, and border leaves peering eBGP with two ISPs. Spine-leaf links are anchored, so they are drawn straight."""
from spinagram import Diagram


d = Diagram("NET02", "EVPN-VXLAN data center fabric", node_size=(196, 84), edge_route="straight",
            subtitle="eBGP underlay · EVPN overlay · all-active ESI multihoming · eBGP to two ISPs",
            layout={"engine": "flex", "direction": "down", "rank_gap": 96,
                    "area": [56, 176, 1808, 830]})
d.stylesheet("showcase.css")
d.stylesheet("fabric.css")

with d.group("Spines · AS 65000 · EVPN route servers", id="spines", class_="as spine-as", direction="right",
             gap=260, align="center"):
    spines = [d.box(f"spine-{i}", text=f"lo 10.0.0.{i}/32", icon="network:switch-multilayer-green",
                    class_="spine", id=f"spine-{i}") for i in (1, 2)]
with d.group(id="pods", class_="bare", direction="right", gap=24, align="start", padding=0):
    pairs, below = {}, {}
    for key, label, cls, icon, n0 in (("border", "Border leaves · AS 65100", "as border-as", "network:switch-multilayer",
                                       11),
                                      ("a", "Rack A · AS 65101", "as", "network:switch", 21),
                                      ("b", "Rack B · AS 65102", "as", "network:switch", 31)):
        with d.group(id=f"pod-{key}", class_="bare", direction="down", gap=56, align="center", padding=0):
            with d.group(label, id=f"pair-{key}", class_=cls, direction="right", gap=16):
                pairs[key] = [d.box(f"leaf-{key}{i}" if key != "border" else f"border-{i}",
                                    text=f"VTEP 10.0.1.{n0 + i}", icon=icon,
                                    class_="border-leaf" if key == "border" else "leaf",
                                    id=f"leaf-{key}{i}" if key != "border" else f"border-{i}") for i in (1, 2)]
            if key == "border":
                with d.group("Internet transit", id="wan", class_="wan", direction="right", gap=16):
                    below[key] = [d.box(f"ISP {x}", text=f"AS {asn}", icon="network:router-cloud-red", class_="isp",
                                        id=f"isp-{x}") for x, asn in (("A", 64512), ("B", 64513))]
            else:
                vni, net, role = ("10010", "10.10.0.10", "web") if key == "a" else ("10020", "10.20.0.10", "db")
                with d.group(f"VNI {vni} · {role}", id=f"vni-{role}", class_="vni", direction="right", gap=16):
                    below[key] = [d.box(f"{role}-01", text=f"{net}, ESI-LAG", icon="network:server-circle",
                                        class_="host")]
web, db, isps = below["a"][0], below["b"][0], below["border"]

# eBGP underlay: every leaf peers with both spines (straight lines, the usual spine-leaf drawing)
leaves = (*pairs["border"], *pairs["a"], *pairs["b"])
for s, spine in enumerate(spines):
    for j, leaf in enumerate(leaves):
        d.edge(spine.at("bottom", 0.15 + 0.7 * j / (len(leaves) - 1)), leaf.at("top", 0.35 + 0.3 * s),
               class_="underlay-ebgp")
# multihoming: each host to both leaves of its pair, one Ethernet segment
for host, pair in ((web, pairs["a"]), (db, pairs["b"])):
    for leaf in pair:
        d.edge(leaf.bottom, host.top, class_="esi-multihoming")
for border, isp in zip(pairs["border"], isps):
    d.edge(border.bottom, isp.top, "eBGP", class_="wan-ebgp")

d.step("web-01 sends to db-01 over its ESI-LAG", on=web)
d.step("leaf-a1 encapsulates in VXLAN, VNI 10010 → L3 VNI", on="leaf-a1")
d.step("Spines route on the outer IP only", on="spine-1")
d.step("leaf-b1 decapsulates and delivers on VNI 10020", on="leaf-b1")
d.step("Border leaves export EVPN type-5 routes to the ISPs", on="border-1")
d.callout(db, "One Ethernet segment on two leaves: both forward, a DF election handles BUM traffic.",
          title="ESI multihoming", kind="info")
d.callout("spine-2", "Spines carry the EVPN address family but hold no VNIs: they only route between VTEPs.",
          title="Lean spines", kind="tip")
d.add_legend({".spine": "Spine (EVPN route server)", ".border-leaf": "Border leaf", ".leaf": "Leaf (VTEP)",
              ".host": "Multihomed host", ".isp": "ISP router", "edge.underlay-ebgp": "eBGP underlay",
              "edge.esi-multihoming": "ESI multihoming", "edge.wan-ebgp": "eBGP to transit"})
Python65 linesexamples/showcase/evpn_fabric.py

Symbol names, colours and shapes: Icon packs.

On this page