Skip to content
CAI
Produce a survey ↗Verify a survey

terrastruct/d2

D2 is a diagramming tool that converts a domain-specific language into visual diagrams. It compiles text-based descriptions into various output formats, including SVG, PNG, PDF, PPTX, GIF, and ASCII art. The system supports multiple layout engines (Dagre, ELK, Grid, Sequence) and rendering styles (sketch, dark/light themes). It also provides a JavaScript/Node.js API and a WebAssembly build for browser-based usage, alongside a CLI for headless and interactive diagram generation.

57.0

Adequate · 6 August 2026

44k

lines of production code

Go

primary language

2

bus factor · 67 authors in all

3

measurements over time

CAI band scale
CAI trend line

How it got here

2022 · Architecture modernization and layout engine expansion

This period focused on a comprehensive architectural overhaul, introducing an intermediate representation for the compiler and refactoring the codebase to support complex features like sequence diagrams and nested boards. The team also expanded the rendering capabilities by integrating the ELK layout engine, adding LaTeX and sketch modes, and significantly improving the installation and release pipelines.

55 changes

2023–2025 · WebAssembly and multi-format export expansion

This period focused on extending D2's reach to web environments via a new JavaScript/Go WASM bridge, enabling browser-based diagramming and editor integration. Simultaneously, the project significantly broadened its output capabilities by introducing native support for PDF, PPTX, and ASCII art rendering, alongside a new grid-based layout engine and intermediate representation for improved compilation.

32 changes

CAI lens gauges

Survey your own repository

terrastruct/d2 was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point the surveyor at a repository you know and see whether you agree with it.

Survey a repository

About this page

  • The description of this project is derived from its own commit history, not from its README.
  • The score is its highest published measurement, taken on 6 August 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit c30239f340 — the exact code this score is about.
  • Scored under rubric rubric-2026.08.19. Score the same commit under that rubric and you get the same number.
CAI link cards