Document software architecture by writing text descriptions that auto-layout into diagrams.
Create database schema diagrams and API flow charts that stay in sync with your codebase.
Build system topology and network diagrams without manual positioning or dragging shapes.
Track diagram changes over time by storing them as text files in version control.
D2 is a diagramming tool that lets you create technical diagrams by writing text rather than dragging and dropping shapes. You write a simple description of what connects to what, for example, "user -> database", and D2 converts that text into a polished visual diagram automatically. This approach means your diagrams live as readable text files that can be version-controlled alongside your code, making it easy to track changes over time. The language is designed for software architecture, network topology, and system documentation diagrams. You can describe boxes, arrows, labels, nested groups, and custom shapes, and choose from several automatic layout engines that arrange everything visually without manual positioning. D2 supports themes, custom fonts, and can export diagrams as SVG, PNG, or PDF. You would use D2 when you need to document how parts of a software system connect, architecture overviews, database schemas, API flow charts, and similar technical diagrams. It is especially useful in developer workflows where keeping documentation in sync with code matters. It runs as a command-line tool with live preview (a browser window that updates as you edit), can be embedded as a Go library, and has editor plugins for syntax highlighting. It is written in Go.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.