TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Diagram as Code

396 pointsby delducaabout 5 years ago

28 comments

bingo_cannonabout 5 years ago
This looks really neat! Is it possible to have embedded diagrams. For example, Gitlab lets you embed a PlantUML[1] diagram in any Markdown or ADoc file using a proxy server. This makes it really easy to write and serve documentation.<p>Personally, I&#x27;m a fan of PlantUML. Having an svg served in a browser that has labels linking directly to the relevant entity (code, resource etc) is a huge plus for new hire onboarding.<p>1: <a href="https:&#x2F;&#x2F;plantuml.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;plantuml.com&#x2F;</a>
评论 #23161585 未加载
评论 #23162926 未加载
jameskrausabout 5 years ago
I was hoping this tool would support directionality&#x2F;sequencing of nodes.<p>A tool I&#x27;ve used in the past is SequenceDiagram.org for diagraming a sequence of service calls. While a bit old-school, it&#x27;s good for its purpose.<p>I&#x27;ve also used Whimsical[0] to model flows and graph-like relationships. It&#x27;s got the added benefit of allowing multiple users to view and edit the same document. Whimsical is still my favorite tool right now due to flexibility, but it&#x27;s a closed-source&#x2F;paid product, so I&#x27;m open to alternatives.<p>[0] <a href="https:&#x2F;&#x2F;whimsical.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;whimsical.com&#x2F;</a>
评论 #23158064 未加载
评论 #23161264 未加载
评论 #23161406 未加载
评论 #23156921 未加载
评论 #23159649 未加载
BiteCode_devabout 5 years ago
Slightly different, but there is now an VSCode extension to use draw.io directly in the editor.<p><a href="https:&#x2F;&#x2F;marketplace.visualstudio.com&#x2F;items?itemName=hediet.vscode-drawio" rel="nofollow">https:&#x2F;&#x2F;marketplace.visualstudio.com&#x2F;items?itemName=hediet.v...</a><p>If you don&#x27;t know draw.io, it&#x27;s an free diagram software that not only has an XML format to save them, but can also be used to save it as a PNG that EMBEDS said XML, so you can edit it again, but display it like a regular image.
heisenzombieabout 5 years ago
The author has made DSL in Python by (ab?)using context managers and the bitshift operator. It&#x27;s very interesting, and I haven&#x27;t seen anything quite like it.<p>Python can lend itself to horrific abuses through shenanigans like this. I sometimes feel that siren call myself, and usually regret it.<p>So by default I&#x27;m pretty skeptical of this kind of thing, but I&#x27;m actually on the fence about this one.
评论 #23163001 未加载
Bedon292about 5 years ago
I have been thinking about using this for some diagrams, but whats been on the back of my mind since I heard about it is how to combine it with Terraform, or Troposphere, and have your infrastructure as code also draw the diagrams automatically.
评论 #23164133 未加载
评论 #23159798 未加载
kovekabout 5 years ago
This is cool! I was hoping it would look something like:<p>‘’’ import diagrams calc_d = diagrams.new_diagram(“calculator_123”)<p>calc_d.Datum(&quot;SuperNumber&quot;) class SuperNumber(int): pass<p>@calc_d.Service(“Calculator”, “takes numbers and operations and operates”) class Calculator(object): @calc_d.Endpoint(&quot;Add&quot;, calls=[&quot;Increment&quot;], main_data={&quot;b&quot;: &quot;SuperNumber}) def add(self, a, b: SuperNumber): out = a for i in range(b): calc_d.multi(calls=[&quot;Increment&quot;]) out = self.increment(out)<p><pre><code> @calc_d.Function(&quot;Increment&quot;) def increment(self, a): return a+1 </code></pre> def integration_test(): calc_d.instantiate(&quot;Calculator&quot;) calc = Calculator() ... ‘’’<p>EDIT: Dear dang and YC Hacker News, I would love to create code blocks using surrounding triple quotes..
评论 #23158892 未加载
评论 #23161503 未加载
subhobrotoabout 5 years ago
It seems to be hyperfocused on system architecture diagrams.<p>There are some other kinds of diagrams would we like to draw that’s not system architecture diagrams, eg:<p>- algorithms<p>- decision trees<p>- UML&#x2F;ER Diagrams<p>Mermaid (JS) helps draw quality diagrams quickly - more than system architecture diagrams.<p>It would have been perfect if the development cycles that went here was used to create Mermaid templates instead.<p>Unless this also lets us draw more than just system architecture diagrams.
评论 #23155807 未加载
评论 #23155569 未加载
评论 #23158544 未加载
poloteabout 5 years ago
Why do we need a tool to draw its architecture and we don&#x27;t have a tool which auto discover the architecture and auto updates it and draw it form here ?<p>That will shrink the gap between the current architecture and the current diagram that almost always exists
评论 #23157023 未加载
delducaabout 5 years ago
I just created a Dockerfile to run: <a href="https:&#x2F;&#x2F;github.com&#x2F;skhaz&#x2F;diagrams" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;skhaz&#x2F;diagrams</a>
seph-reedabout 5 years ago
When I was ~10yrs old, I would play with a program called RPG Maker 2000. It had a really interesting code system where you could click blocks of code and it would bring up a UI for modifying them. It was always simple stuff like if&#x2F;else, for, switch.. but it merged the simplicity of clicking dropdowns and the like with the complexity of actually seeing the code and learning to read and navigate it. You could also go rogue and write custom code.<p>I still think that this solution has more life to it and would like to explore that some day.
chrisweeklyabout 5 years ago
Slight tangent, but some of the cool tools noted in the comments remind me of some of the amazing things put out by Netflix engineering in recent years, like Vizceral^1 and Flux^2.<p>1. <a href="https:&#x2F;&#x2F;github.com&#x2F;Netflix&#x2F;vizceral&#x2F;wiki" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Netflix&#x2F;vizceral&#x2F;wiki</a><p>2. <a href="https:&#x2F;&#x2F;link.medium.com&#x2F;LY2vw4Rsr6" rel="nofollow">https:&#x2F;&#x2F;link.medium.com&#x2F;LY2vw4Rsr6</a><p>(Sorry about the Medium.com link; all I could grab on the spot on phone)
nautilus12about 5 years ago
When I first read this I thought this did the inverse of what it actually does. Let you interactively draw out diagrams then it would generate the boilerplate code to achieve that diagram.
评论 #23156901 未加载
评论 #23157643 未加载
xendoabout 5 years ago
my favorite: <a href="https:&#x2F;&#x2F;plantuml.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;plantuml.com&#x2F;</a>
评论 #23160799 未加载
samsquireabout 5 years ago
I&#x27;ve got a similar project which takes a diagram of your infrastructure, such as [1] and runs the diagram to build your devops infrastructure [2].<p>[1]: <a href="http:&#x2F;&#x2F;devops-pipeline.com&#x2F;architecture.tb.png" rel="nofollow">http:&#x2F;&#x2F;devops-pipeline.com&#x2F;architecture.tb.png</a> [2]: <a href="http:&#x2F;&#x2F;devops-pipeline.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;devops-pipeline.com&#x2F;</a>
评论 #23158908 未加载
dr_hoooabout 5 years ago
I was recently looking for something similar, allowing me to draw network diagrams using text or code. I came across [0] which looks great, but has some rough corners and seems to be abandoned by he author. Does anyone have any other recommendations for more bare-metal oriented topologies?<p>[0] <a href="http:&#x2F;&#x2F;go.drawthe.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;go.drawthe.net&#x2F;</a>
arminiusreturnsabout 5 years ago
If you are interested in this kind of thing please check out the blockdiag series of tools (seqdiag, rackdiag, netdiag, etc) I haven&#x27;t looked back since I started using them other than a workplace that uses lucidchart.<p><a href="http:&#x2F;&#x2F;blockdiag.com&#x2F;en&#x2F;" rel="nofollow">http:&#x2F;&#x2F;blockdiag.com&#x2F;en&#x2F;</a>
2fast4youabout 5 years ago
Sent this to a few people at work and it spread pretty quickly. We all love it!
fold_leftabout 5 years ago
&gt; from diagrams import Diagram<p>Slightly off-topic, but I wish JavaScript&#x27;s import syntax was designed to be this way around, for better autocomplete in your editor.
评论 #23162533 未加载
评论 #23162596 未加载
eeZah7Uxabout 5 years ago
Why the obsession with product names and logos? Having a Python class for a specific product is not necessary.<p>...and then people talk about CV-driven development...
mugsieabout 5 years ago
I like this a lot - trying to store diagrams that look good, without sticking a visio file into a git repo is something I keep an eye out for.
评论 #23156980 未加载
jzer0coolabout 5 years ago
This looks pretty cool and has as nice modern look to it. I can see did a good job with the layout&#x2F;design too.<p>If you don&#x27;t mind sharing (or if anyone knows of any toolkits&#x2F;libraries): I wanted to try getting at drawing some custom diagrams and was unsure where to begin coding just project. Any know of anything that comes to mind?
iblaineabout 5 years ago
This is great. Code needs to replace more drag n drop tools, at the very least to give people options.
ktayloraabout 5 years ago
Came here half-expecting to see probabilistic programming implemented via Direct Acyclic Graphs (DAGs). This is cool, too, though.
the_arunabout 5 years ago
Thanks for sharing! This is really cool.
slackfanabout 5 years ago
So, how well does this compare to graphviz? Seems a heck of a lot more verbose.
评论 #23160389 未加载
tamiralabout 5 years ago
this is going to send me down a rabbit hole for a long long time .... there was another thread some months ago about an architecture diagraming tool that reads the code and outputs architecture based on methods.
nevesabout 5 years ago
Why is this better than Mermaid? It works in Markdown, you can version control, and Git(Hub|Lab) displays it automatically.<p>I&#x27;m really curious. Maybe for doing something programmatically, but GraphViz may be better.
评论 #23160207 未加载
评论 #23160092 未加载
评论 #23160452 未加载
muffin24about 5 years ago
cool stuff