-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic support for C4 model primitives. #508
Conversation
@mingrammer Any thoughts on this? |
@mbruggmann |
Would be great to see c4 support in diagrams. @mbruggmann implementation looks promising, it has everything what is important |
With the record shape we used before, graphviz would trip over edges that set constraint=False.
This makes the code more DRY, but also allows to add company- specific extensions more easily. One need we have is to slightly adapt the terminology. At Spotify, we happen to call `Container` a `Component` for example. This is now easier to implement on top of the shared `C4Node`.
@mbruggmann I dont know diagrams capabilities much but is it possible to make those components clickable and animated? So lets say you have your internet banking system as system boundary, one box. You double click it and it expands to more granular version like we see on screenshot you attached? |
@BBartosz have a look at https://graphviz.org/doc/info/attrs.html#d:URL |
@BBartosz I don't know of any native animation capability in graphviz or the wrapper libraries. Have a look at this library which uses d3 to animate https://github.com/magjac/d3-graphviz#examples I have not tested, but it looks like to create your graphs with this library, save the dot files, then use the magjac/d3-graphviz animation library on the dot files. |
@BBartosz What we do is roughly like this:
Currently this is set up using PlantUML but I don't see a reason why it wouldn't work using diagrams in a similar fashion. I haven't tried though. |
@mbruggmann Thats also possibility. Just have CI to generate graphs and put them into static page manually/have a script to do this. Something similar is done here: https://adrianvlupu.github.io/C4-Builder/#/?id=overview |
Great. I'll review this feature soon. |
@mingrammer are you able to review this. I would love to see this feature asap |
Is the "view" part strictly separated from the "model"? I.e. can you create exactly one model and derive different views from that? |
@venthur At the moment, no. The suggested implementation is purely about rendering one view. So if you wanted to model entities/relationships, you'd need to do that outside of diagrams and just use this in the rendering path. |
@mingrammer Any way we can help get this PR over the line as would love to use this natively? |
Looking forward to this feature! I just bought @mingrammer 5 coffees. Maybe a little caffeine is all that's needed to help get this across the finish line. 😉 |
I'll review this feature this week!! Sorry for the really late review. |
Hi @mingrammer, any chance to review and merge it soon? 😄 It would be awesome! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Sorry for the really late review. Thanks for the great contributions! ❤️
But, I have the last suggestion. Could you please add the documentation for C4 model support to diagrams docs, and update the README?
@mingrammer Cool, no worries. Documentation added! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for great contributing!
I'm on work time. I'll release the new version tomorrow morning. (KST) |
[email protected] is now released. |
* Basic support for C4 model primitives. * Use the "rect" shape for nodes With the record shape we used before, graphviz would trip over edges that set constraint=False. * Adopt C4 terminology: Rename Dependency -> Relationship * Adopt C4 terminology: Rename type -> technology * Extract a shared C4Node This makes the code more DRY, but also allows to add company- specific extensions more easily. One need we have is to slightly adapt the terminology. At Spotify, we happen to call `Container` a `Component` for example. This is now easier to implement on top of the shared `C4Node`. * Add "C4" shield to the README * Document how to produce a C4 diagram
* Basic support for C4 model primitives. * Use the "rect" shape for nodes With the record shape we used before, graphviz would trip over edges that set constraint=False. * Adopt C4 terminology: Rename Dependency -> Relationship * Adopt C4 terminology: Rename type -> technology * Extract a shared C4Node This makes the code more DRY, but also allows to add company- specific extensions more easily. One need we have is to slightly adapt the terminology. At Spotify, we happen to call `Container` a `Component` for example. This is now easier to implement on top of the shared `C4Node`. * Add "C4" shield to the README * Document how to produce a C4 diagram
C4 is a model for visualizing software architecture. It defines a common terminology and a few core diagrams at different abstraction levels. We primarily use the System Landscape, System Context and Container diagrams so I started with just the entities needed for those.
For a definition like this:
It produces a diagram like this:
The implementation is a bit different from the other resources which are auto-generated based on images as far as I understand. If you'd prefer a different approach or would rather not have this upstream in diagrams, let me know! I also wasn't sure how to best integrate this in the documentation, but we could figure something out if this is a feature you'd like to see.
Original discussion in #489.