d2lang/d2-playground

An online runner to play, learn, and create with D2, the modern diagram scripting language that turns text to diagrams.

JavaScript

128

34 commits

updated Oct 5, 2026

See the code

See what people are saying

SourceMessageScoreDate

https://play.d2lang.com/?script=Ks5ILEi1UihOLSxNzUtOjU_JTEwv... Okay, we'll put those sequence diagram improvements in our sprint for next release.

on D2 (text to diagram tool) now supports ASCII renders

0

Aug 20, 2025

Hello fellow devs. Just wanted to share a new feature we added this morning, though it's very alpha stage (already someone's filed a github issue for it hah) If you want to skip the blog post and poke around directly: https://play.d2lang.com/?script=qlDQtVOotFLIyFTwSEzOTi1S8Est... For a bigger…

on D2 (text to diagram tool) now supports ASCII renders

0

Aug 19, 2025

https://play.d2lang.com/ loads https://play.d2lang.com/d2.wasm so presumably "all done"

on Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

0

May 24, 2025

I'm curious what you prefer instead? I find that tools like Mermaid are pretty invaluable, especially when editing very large processes. Draw.io diagrams tend to get pretty unwieldy as they scale and editing inter process stuff if you forgot something quite frustrating. Sequence diagrams are…

on Show HN: Mermaid Chart VS Code Plugin: Mermaid.js Diagrams in Visual Studio Code

0

Apr 2, 2025

https://mermaid.live/ ! Mostly because it lets me generate my diagrams in code rather than drawing them out by hand, which means I can version control them, as well as generate said code from human-language descriptions given to ChatGPT. Sequence diagrams are an especially favorite of mine. There…

on Ask HN: What do you use to create diagrams?

0

Mar 13, 2025

We make (and sell) one, you can play with it here: https://play.d2lang.com/?script=qlDQtVOo5AIEAAD__w%3D%3D&lay... Bigger example: https://play.d2lang.com/?script=rJLfavMwDMXv_RR6gYbvo3ce7FWG... (I don't like to self promo on competitor posts, but since Mermaid doesn't compete in making its own…

on Show HN: GUI for editing Mermaid class diagrams

0

Jan 17, 2025

Other than Graphviz (can try one of its other visual editors[3]), other generic text to diagram tools/langs in this space are Pikchr[1] and D2[2]. UPDATE: Just realized that Vizdom here is not a new language, but a Graphviz editor. [1]: https://pikchr.org/home/pikchrshow [2]:…

on Vizdom: Diagrams as Code

0

Sep 1, 2024

D2 Playground

148

Mar 24, 2024

Curated list of solutions: - excalidraw - https://github.com/alswl/excalidraw-collaboration - revezone - excalidraw + tldraw - https://github.com/revezone/revezone - code2flow - code - https://app.code2flow.com - zenuml - code - https://app.zenuml.com - bpmn sketch miner -…

on How to draw software architecture diagrams (2022)

0

Oct 27, 2023

https://play.d2lang.com/?script=qlDQtVOo5AIEAAD__w%3D%3D&ske... I was going to ask why you don't have a web version but you already do. I'm going to play with this more today. Have you thought about an "auto compile"/live mode where it changes as you edit the text? I think this adds a level of…

on The Unreasonable Effectiveness of Sequence Diagrams in MermaidJS

0

Jul 24, 2023

README

D2 Playground

An online runner to play, learn, and create with D2, the modern diagram scripting language that turns text to diagrams.

ci daily discord license Vercel OSS Program

Notice: This is not the repository for the D2 language. That can be found here.

Table of Contents

FAQ

What is this written in?

Vanilla HTML, CSS, and Javascript.

How does it work?

d2.js compiles and renders Dagre, ELK, and TALA layouts entirely within the browser.

Can I run it locally?

Yes. Just clone and follow the instructions in the Development section below.

Development

Run ./ci/dev.sh.

Prerequisites

Deploying to Vercel

Vercel hosts the production playground at https://play.d2lang.com and https://playground.d2lang.com. Connect this repository with the repository root as the Root Directory, Node.js 24, and master as the Production Branch. Pull requests receive preview deployments. The checked-in vercel.json installs the JavaScript dependencies, builds the static site, and serves dist. No environment variables are required.

To build the same output locally, initialize the submodules, run npx --yes [email protected] -- yarn --cwd src/js install --frozen-lockfile, then run ./ci/vercel-build.sh. The build requires Node.js and npm, uses pinned Yarn 1.22.22 and esbuild 0.16.3, and preserves the dependency versions in the Yarn lockfile. JavaScript and CSS remain uncompressed in dist so Vercel can serve them with the appropriate content encoding. Unhashed static filenames revalidate on each request so browser caches do not retain assets from an older release.

Vercel deploys production changes from master; the previous AWS deployment workflow and script have been removed. The GitHub CI and daily workflows continue checking the Go development server. Roll back a release by promoting a previous production deployment in Vercel.

The existing same-origin Plausible routes are preserved: /js/script.js proxies the analytics script and /api/event proxies event submissions to plausible.io.

Contributing

Contributions are welcome!

Dependencies

External dependencies are kept to a minimum. Currently they are:

  1. Monaco Editor for text editing features.
  2. Panzoom for SVG navigation.

Both are not ideal. Monaco is unnecessarily heavy and Panzoom lacks scrolling. The plan is to replace these one day.

If you're a contributor, please do not add any dependencies without discussing first.

diagramming
diagrams
text-to-diagrams

d2lang/d2-playground

An online runner to play, learn, and create with D2, the modern diagram scripting language that turns text to diagrams.

JavaScript

128

34 commits

updated Oct 5, 2026

See the code

See what people are saying

SourceMessageScoreDate

https://play.d2lang.com/?script=Ks5ILEi1UihOLSxNzUtOjU_JTEwv... Okay, we'll put those sequence diagram improvements in our sprint for next release.

on D2 (text to diagram tool) now supports ASCII renders

0

Aug 20, 2025

Hello fellow devs. Just wanted to share a new feature we added this morning, though it's very alpha stage (already someone's filed a github issue for it hah) If you want to skip the blog post and poke around directly: https://play.d2lang.com/?script=qlDQtVOotFLIyFTwSEzOTi1S8Est... For a bigger…

on D2 (text to diagram tool) now supports ASCII renders

0

Aug 19, 2025

https://play.d2lang.com/ loads https://play.d2lang.com/d2.wasm so presumably "all done"

on Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

0

May 24, 2025

I'm curious what you prefer instead? I find that tools like Mermaid are pretty invaluable, especially when editing very large processes. Draw.io diagrams tend to get pretty unwieldy as they scale and editing inter process stuff if you forgot something quite frustrating. Sequence diagrams are…

on Show HN: Mermaid Chart VS Code Plugin: Mermaid.js Diagrams in Visual Studio Code

0

Apr 2, 2025

https://mermaid.live/ ! Mostly because it lets me generate my diagrams in code rather than drawing them out by hand, which means I can version control them, as well as generate said code from human-language descriptions given to ChatGPT. Sequence diagrams are an especially favorite of mine. There…

on Ask HN: What do you use to create diagrams?

0

Mar 13, 2025

We make (and sell) one, you can play with it here: https://play.d2lang.com/?script=qlDQtVOo5AIEAAD__w%3D%3D&lay... Bigger example: https://play.d2lang.com/?script=rJLfavMwDMXv_RR6gYbvo3ce7FWG... (I don't like to self promo on competitor posts, but since Mermaid doesn't compete in making its own…

on Show HN: GUI for editing Mermaid class diagrams

0

Jan 17, 2025

Other than Graphviz (can try one of its other visual editors[3]), other generic text to diagram tools/langs in this space are Pikchr[1] and D2[2]. UPDATE: Just realized that Vizdom here is not a new language, but a Graphviz editor. [1]: https://pikchr.org/home/pikchrshow [2]:…

on Vizdom: Diagrams as Code

0

Sep 1, 2024

D2 Playground

148

Mar 24, 2024

Curated list of solutions: - excalidraw - https://github.com/alswl/excalidraw-collaboration - revezone - excalidraw + tldraw - https://github.com/revezone/revezone - code2flow - code - https://app.code2flow.com - zenuml - code - https://app.zenuml.com - bpmn sketch miner -…

on How to draw software architecture diagrams (2022)

0

Oct 27, 2023

https://play.d2lang.com/?script=qlDQtVOo5AIEAAD__w%3D%3D&ske... I was going to ask why you don't have a web version but you already do. I'm going to play with this more today. Have you thought about an "auto compile"/live mode where it changes as you edit the text? I think this adds a level of…

on The Unreasonable Effectiveness of Sequence Diagrams in MermaidJS

0

Jul 24, 2023

README

D2 Playground

An online runner to play, learn, and create with D2, the modern diagram scripting language that turns text to diagrams.

ci daily discord license Vercel OSS Program

Notice: This is not the repository for the D2 language. That can be found here.

Table of Contents

FAQ

What is this written in?

Vanilla HTML, CSS, and Javascript.

How does it work?

d2.js compiles and renders Dagre, ELK, and TALA layouts entirely within the browser.

Can I run it locally?

Yes. Just clone and follow the instructions in the Development section below.

Development

Run ./ci/dev.sh.

Prerequisites

Deploying to Vercel

Vercel hosts the production playground at https://play.d2lang.com and https://playground.d2lang.com. Connect this repository with the repository root as the Root Directory, Node.js 24, and master as the Production Branch. Pull requests receive preview deployments. The checked-in vercel.json installs the JavaScript dependencies, builds the static site, and serves dist. No environment variables are required.

To build the same output locally, initialize the submodules, run npx --yes [email protected] -- yarn --cwd src/js install --frozen-lockfile, then run ./ci/vercel-build.sh. The build requires Node.js and npm, uses pinned Yarn 1.22.22 and esbuild 0.16.3, and preserves the dependency versions in the Yarn lockfile. JavaScript and CSS remain uncompressed in dist so Vercel can serve them with the appropriate content encoding. Unhashed static filenames revalidate on each request so browser caches do not retain assets from an older release.

Vercel deploys production changes from master; the previous AWS deployment workflow and script have been removed. The GitHub CI and daily workflows continue checking the Go development server. Roll back a release by promoting a previous production deployment in Vercel.

The existing same-origin Plausible routes are preserved: /js/script.js proxies the analytics script and /api/event proxies event submissions to plausible.io.

Contributing

Contributions are welcome!

Dependencies

External dependencies are kept to a minimum. Currently they are:

  1. Monaco Editor for text editing features.
  2. Panzoom for SVG navigation.

Both are not ideal. Monaco is unnecessarily heavy and Panzoom lacks scrolling. The plan is to replace these one day.

If you're a contributor, please do not add any dependencies without discussing first.

diagramming
diagrams
text-to-diagrams

Significant stargazers

GuangTao Zhang

155 followers · starred May 2023