Vizdom: Diagrams as Code
vizdom.dev
vizdom.dev
To be clear, you don’t need an account to use the npm package which has all of the functionality to perform layout and rendering. An account is only needed if you want to sync the graph and have a web page to view renderings. This is useful if you’ve instrumented a long lived application with Vizdom, but don’t want to produce a local layout/rendered image because you can’t really “view” it if the service is running in the cloud.
DOT parsing isn’t part of the npm package, but I’m not totally opposed to include it! It may add 1-2Mb more to the wasm bundle.
Just so you know, I find this terribly confusing. You see the homepage with your code, then you think "oh, I'll try this editor here..." and then it turns out it's Dot? All examples are written in Dot? Why? Didn't it say "no DSLs"? Didn't it show some TypeScript in the homepage?
It can very easily make people get the wrong idea about what your project is.
Edit: It seems to have almost 100% feature overlap with graphviz, but it is a paid SaaS? I don't get it...
Edit 2: This has to be a troll post. "Up to 3 graphs" for free --are you kidding me? I can run `dot` a million times in a second for free
You can create and render as many graphs as you like with the package offline - only the real-time sync is limited.
Why wouldn't I just use graphviz then?
Really good feedback and I’m being serious. Wish I saw that earlier.
What's up with that? How much of this is original work vs pulling together tools in a new way or improving their API?
However, that is now resolved. The latest distribution has license mentions for:
- Dagrejs
- NotoSans Font
- *Others (an html file generated via `cargo about` that list all deps used in the final dist)
That being said, I did want to point out that I did take significant influence from Dagrejs which is why you see that the layouts produced look very similar - it is a rough translation into rust. There are changes to some DFS traversals, other optimizations that are rust-specific, and countless bug fixes. I actually spent a lot of time attempting to reproduce the layouts that Dagre generates, but there are some examples that do not produce the same results. At this point, I think it is close enough and would rather spend time writing a new set of algos for better edge crossing minimization and cluster support.
DLS-based diagramming tools like Terrastruct, mermaid, or graphviz definitely have their perks and are very well established for manual graph curation. But I found the lack of programmatic tooling (except terrastruct) a bit of a pain point.
- https://terrastruct.com/blog/post/generate-diagrams-programm...
Hi, creator of Ilograph[0] here. I agree with this if the DSL doesn't provide an IDE with autocomplete and instant-rendering (which I think applies to the technologies you mentioned).
With auto-complete and instant-rendering, I think a DSL is much preferable to Python (the most common "diagrams-as-code" language). Python is a programming language for writing, well, programs. It feels like complete overkill for creating static diagrams.
For me (and my narrow use-case), I just couldn’t find a simple tool to sync my graph to somewhere that I could view it easily - especially after I’ve instrumented my application and deployed to the cloud.
The example drop down should either have names instead of Example 1..n. Or it should be changeable via keyboard. I have reached example 10 so far I think, but I have to keep track of example number in my head, open the dropdown, scroll the list and click the next number every single time. Edit: Yup, can't just go through all examples like this.
I definitely need to update that at some point.
Maybe my landing page is terrible, but you don’t need an account to download the npm package and start doing things locally.
That being said, I’m more interested in helping individuals who want to programmatically generate graphs - hundred+ updates to them per day, similar to how an APM/telemetry libs work. You instrument once and get the benefits of a real-time graph.
It’s about 25k lines of rust code compiled to do the following:
- Layout/position a directed graph
- Compute a bounding box for text labels and produce font glyphs for the rendering engine
- Generate an SVG
- Optionally, sync to a Vizdom account
Fun fact, the majority of that wasm blob is what is powering the web application itself. You can see it in action using the editor view/diff on the site.
UPDATE: Just realized that Vizdom here is not a new language, but a Graphviz editor.
I’d say my premise isn’t that “DSLs are bad”, but more along the lines of if a DSL isn’t what you’re looking for, I may have something for you. Particularly if you need your application to generate a view of a graph _during runtime_ so that it is your real-time source of truth.
I find that DSLs and “as code” solutions for several products have their own niche. Take for example Terraform vs Pulumi.
Diagramming is a domain, and within diagramming are any number of diagram type domains, leading to concise code for particular niches.
Compare 25+ of these niches here: https://kroki.io/
So, the examples are open source (and the README). https://github.com/vizdom-dev/vizdom
Not to mention the act of performing layout (obtaining positioning data) is relatively expensive for non-trivial graphs. When syncing to a Vizdom account, your application doesn't need to spend cycles to position/render anything. Instead, your graph is positioned and rendered in the dashboard in your browser upon loading (technically, it is also rendered on the server due to my global SSR config).
Also a few of the JS wrappers don't come with a build of Graphviz that allows memory growth, so for somewhat medium/large graphs, the WebAssembly panics. For all other wrappers, it works just fine I'd assume - mainly an issue with not passing the correct build args to Emscripten.
Read more here: https://leptos.dev/
It’s kind of hard to write up a fair comparison - it’s apples to oranges.
I can say that vizdom performs very fast hierarchical layouts (currently the only supported type). Example 14 in the live editor runs in about 1 second on my M1 Mac - but if you refresh the page it CloudFront will complain since the graph state is all in the URL and it’s too long.
> the Rust WebAssembly binary included in this library is closed-source.
Any chance icons can be included? I want to design AWS diagrams and use service logos.
It’s definitely something I want to support.
It's pretty good - uses Graphviz under the hood, but supports many cloud icons/logos. Not completely sure if it allows you to provide any icon, but it wouldn't surprise me.