Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
D2 Playground (d2lang.com)
148 points by saikatsg on March 24, 2024 | hide | past | favorite | 34 comments


Those "news" (commercials in disguise) about d2 consistently fail to make it clear that even though the language itself is opensource, the primary backend for it isn't, and is actually quite expensive. There're free backends, but those have inferior capabilities.


I'm not sure where you got the impression that the paid layout engine is the primary backend for it.

We set out to make our own layout engine, which we charge for, true. However to say it outcompetes the efforts of all open-source ones including ones used by Graphviz (dagre) and university researchers (ELK) is quite the compliment, and not one that we've ever made ourselves. There are simply different use cases for each: https://d2lang.com/tour/layouts .

In fact we specifically de-weight our own layout engine, making it a separate install and not referenced anywhere in the D2 project. The vast majority of D2 users aren't paying a penny.

And like another comment says, we make it abundantly clear our own layout engine is not open-source everywhere that it's mentioned.

Your claim that this is a commercial post is also unfounded. I opened HN today as a reader and was surprised to see this post.


> I'm not sure where you got the impression that the paid layout engine is the primary backend for it.

I got this impression once I failed to reproduce the examples in your documentation with free backend.

> However to say it outcompetes the efforts of all open-source ones including ones used by

> Graphviz (dagre) and university researchers (ELK) is quite the compliment,

I did not mean to say that your engine outcompetes the open-source ones, but rather that d2 gives inferior results with them.

> Your claim that this is a commercial post is also unfounded.

I keep seeing thinly disguised d2 promos on the front page and this raises a few questions. This is fairly niche product, and far from unique in its capabilities. Why would it keep showing up among highest-ranked posts?


> I got this impression once I failed to reproduce the examples in your documentation with free backend.

This is easily verifiably false. All the examples have direct links to the playground to reproduce, except the few explicitly called out in the layout section as belonging to TALA's. If you still claim this, simply provide a link to an example that doesn't explicitly say it's made with TALA in the docs (d2lang.com).

> I did not mean to say that your engine outcompetes the open-source ones, but rather that d2 gives inferior results with them.

I'm not sure you understand the role layout engines have. All languages like PlantUML etc just abstractly represent nodes and connections and choose some styles for them. The rest is layout engine.

> Why would it keep showing up among highest-ranked posts?

You're engaging in conspiracy theories and there's nothing further I can prove short of an HN mod telling you these are legitimate unrelated posters and upvoters.


Isn't dagre dead,though?


It was unmaintained for a long time (maybe considered done implementing the algorithm it set out to), but recently a Google engineer has revived it: https://github.com/dagrejs/dagre


Pikchr https://pikchr.org/home/pikchrshow is the other general purpose one and older than d2. It is "Source-Code License: 0-clause BSD" as it says on the page.


I can't seem to find the pricing page?


The proprietary layout engine is named TALA. IMO the docs are pretty transparent about TALA being closed source and behind a paywall.

TALA docs: https://d2lang.com/tour/tala/

TALA product page: https://terrastruct.com/tala/


TALA is a separate install from D2, to keep a clean cut between 100% free and open-source D2, and proprietary, closed-source TALA.

It seems the 2 are distributed separately and D2 supports open-source layout engines also.


Also, it won't be long before ChatGPT or similar models will do the same thing. A specialized text-to-diagram generator is a pointless thing to work on, IMHO, except for the fun of it.


You might as well say that, because of the telephone, we will no longer need sound.

I think you misunderstand how ChatGPT generates images. ChatGPT can only generate text: somebody at OpenAI wrote additional software to handle images, and connected it up to ChatGPT. (I believe ChatGPT is prompting an image model based on DALL-E, though who really knows what's going on in proprietary SaaSS?)

It's not a magic box that, left alone, will inevitably and inexorably transform into the solution to all the world's problems. If ChatGPT is ever capable of producing diagrams, it will be because of systems like this.


We'll see. That's why they call it the "Bitter Lesson."

As far as telephones and sound go, it's more like when AutoCAD came along and all of a sudden it was hard to sell T-squares.


I have no doubt that it's possible to design an algorithm that can produce diagrams in a given style, given a sufficient description. But a GPT is only going to learn that sort of thing via sufficiently-many examples.

This problem is fundamentally different to (e.g.) computer chess, in that we have no algorithmic win condition. You can't brute-force a solution space when your only way of assessing whether candidates are any good is to ask a human. (Especially not when humans use heuristics to assess the quality of something at a glance, and find it tiring to process large quantities of data: that's a simple recipe for specification gaming if ever I saw one.)


I think it will be long time before ChatGPT can make system diagrams of real systems. It can make a plausible diagram of a fake system, but that's basically worthless.


Pikchr https://pikchr.org/home/pikchrshow is the other general purpose one and older than d2. It is "Source-Code License: 0-clause BSD" as it says on the page.

Someone made it into wasm and put playground for pikchr here https://www.jakethaw.com/pikchr_webassembly_demo/

Can also try pikchr online here on https://kroki.io/#try which is hosting many other text to diagram tools as well.


D2 is fantastic. You can customise a lot of stuff in the diagrams with free layout engines. And it spits out SVGs which you can tweak with an editor (like Affinity Designer).

I have a bunch of styles which I always dump in D2 to generate consistent looking diagrams. Might be useful if you have a design system and you want to give your diagrams branded look and feel.

I also tried to figure out how to write a custom layout engine but apparently I need more weekends of time to work on it.


D2 lang is great.

Created a guide for it a while ago: https://victorbjorklund.com/build-diagrams-as-code-with-d2-d...


A few days ago I had to create an architectural diagram for my client. I found d2lang and liked its visual style a lot. Then I quickly found your blog entry/tutorial thanks to an old HN post which allowed me to complete the diagram in about 1 hour. Thanks a ton for having it published, I know that I will be a frequent user of d2lang now and that is also thanks to your article which contains all important instructions for a reader to successfully get started with d2lang.


While you're here: while skimming I noticed under the headline Connections one of the samples has the wrong label. Instead of `Gordon <-> Mia: ->` it should be `Gordon <-> Mia: <->`


0 chance I would have tried this without the playground. Now thinking about where I can use it. Nice tool!


I've been looking everywhere for a diagraming software that supports filter by dependency. I want to spec out all my systems and their feature responsibilities and dependencies. But the chart get's so big and busy. What If I want to look at feature A in my UI and do a directed search down to find all it's dependencies in services and db. Or I want to click some part in the server, and have it reverse that looking at all the upstream features that might be effected. Ideally it would filter out all the non-connected nodes, and re-layout.

At some point, I'd like to commit it to sourcecode and require updates for PRs. Then have CI attach an image of the affected features when adding something new.

Was hoping this might have something like that, but doesn't look that way. I've also looked at MermaidJS and Lucid charts :\


D2 looks promising, I have previously used Mermaid to visualize my ideas in my markdowns.


I also prefer d2 over mermaid, from the language perspective. But mermaid integration is currently just so much better; there is support (native or via plugins) for Google Docs, GitHub, Confluence, and many more. For me that’s the killer feature that tipped the scale for MermaidJS


Note that this is not about Dlang, the D programming language.


This is honestly pretty neat. I attempted to plot out the relationships on house md.

the_show: { management: { cuddy -> house cuddy -> foreman }

  wilson <-> management.house: friend

  management.house <- taub
  management.house <- chase
  management.house <- thirteen

  management.foreman -> management.house
  management.foreman -- thirteen: dating
}


The VSCode plugin still requires me to install software in the computer itself. Mermaid may be slightly more cumbersome to write, but the ease of setting it up everywhere and the way it integrates all over the place is much superior.

Also the pricing for the TALA engine, which is presumed to be where the future of d2 and whatever future differentiating features it may get, is pretty crazy for personal use.


Mermaid solves the problem for me for now.


Looks really useful. I can see myself using it.


Related - Mermaid, another web diagram language, recently raised 7.5 million USD https://techcrunch.com/2024/03/20/mermaid-chart-a-markdown-l...


Best part about Mermaid is you can include it directly in GitHub markdown, e.g. README files: https://github.blog/2022-02-14-include-diagrams-markdown-fil...


We added it to Notion a few months before it showed up in GitHub


[flagged]


Even ignoring the rude name-calling, I usually find that these kind of comments are poorly thought-out and come from an unrealistic idea of name ownership. I wasn’t familiar with any other D2 and want to give the benefit of the doubt, so I went through a few pages of search results for “D2 language”. Didn’t see any other projects. Are you thinking of the D3 JavaScript charting library?





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: