For years I've been using C4 diagrams to document my architecture. The reasons are too long to list here, but for me it's just the easiest way to see the various levels.
I also used the C4 DSL SDK so that I could make diagrams-as-code. That is C# code that describes my system, which is version controlled and reviewed for each change.
The images that were generated were then used directly inside of our documentation system for easy access.
Example C4 Diagram
SDK Challenges
There was a problem though, the person maintaining all of the SDKs didn't have enough time to keep up the .NET SDK, so it fell out of date, both in versioning and dependencies - and with new features available in the C4 DSL.
Worse, it was archived, so any issues would never get resolved.
As I don't like using unsupported software I need to do something, either look at what other options were available, or make my own!
Introducing C4.Net
But not from scratch... After all I wanted to make sure that the API matched with the old Structurizr SDK so that all we needed to do was change the namespace to get it working.
First things first - all of the dependencies were pulled up to date, ensuring that the code is secure again.
Support for .NET 8, 9, 10 and 11 is included in the package, and as new versions become available (even at preview stage) they will be supported.
For now I am not removing old .NET versions until it becomes an issue in itself. I know that .NET 8 is almost out of support, but I don't want to stop giving security updates to people who have not yet migrated.
Structurizr Integration
The original integration with Structurizr is included with the package, so if you have a workflow that needs to upload workspaces, this will work for you.
New Functionality
That said, with the change to Structurizr it is no longer a viable system for me to use for my diagrams.
As I only need the ability to create a diagram and use it in documentation, hosting my own instance and the license cost isn't economically viable.
So as well as the Client and Core packages that were there before, there are now 2 new packages.
Renderer
This turns the workspace into SVG images that can then be saved to disk. If you have a workspace and images already, then these will remain as they are with only new workspace changes being applied.
Editor
And because the diagrams always need to be cleaned up a little, there is a Razor Library that you can host in a Blazor application to edit the documents and save to disk.
This is not a replacement for the tools in Structurizr; it is a small application to do the minimal editing of images and saving them to disk.
Next Steps
This is still very new! The packages are live, and already being used - with over 1,000 downloads altogether (thank you to whoever has already started using them!).
Not only do I still need to bring the packages up to parity with the latest DSL features, but the editor is very, very rudimentary. And, whilst I am not looking to add oodles of features, it should be pleasant to use in a way that it isn't. Yet...
I need help!
If you are looking for a diagrams-as-code solution that you can run on premise, or if you use Structurizr and need a .NET SDK, I'd love feedback on where to focus improvements, and see what you miss from the DSL, the editor, and definitely from the documentation.
Please feel free to add PRs with your comments - it would be awesome for this to become a community effort!
You can find more information here:
