This is an open source visualization for the C4 model for visualising software architecture.

Related tags

GUI c4viz
Overview

c4viz: C4 Visualization

This is an open source visualization for the C4 model for visualising software architecture. It expects input in the form of a workspace.dsl from the Structurizr project, e.g. like this big bank example.

It allows you to view workspace.dsl files but does not provide the ability to directly edit the .dsl files. However, if you edit and save the .dsl source file and then hit refresh in the browser, it will render the updated .dsl file, so you can use that workflow to edit .dsl files.

Getting Started

Demo Server

You can see this running on my demo server. Be nice to it, it is a tiny cheap server. There are no guarantees that it will stick around, do don't rely on it being online forever, but host your own server if you need it.

Run as docker container

The easiest is to run this from a docker container:

docker-compose up

or

docker run \
    --rm -it \
    -v $PWD/sourceDir:/sourceDir \
    -p 9000:9000 \
    -e SERVER_PORT=9000 \
    -e C4VIZ_SOURCE=big-bank-plc.dsl \
    -e C4VIZ_SOURCE_DIR=/sourceDir \
    -u $(id -u):$(id -g) \
    pmorch/c4viz:latest

You'll need a big-bank-plc.dsl file in the ./sourceDir or modify C4VIZ_SOURCE (and perhaps C4VIZ_SOURCE_DIR) to point to your workspace.dsl file. After all, if you don't have your own .dsl file, you probably don't need this project...

Now access http://localhost:9000, and you're good to go!

If you want rendering of the original image to survive restarts of the image, mount the cache as a volume with -v c4cache:/var/cache/c4viz (or as a a local directory).

The above docker command mounts a local directory, which is useful for local development and for editing of .dsl files. You can also build your own docker image directly containing your .dsl file(s) so it is self-contained.

The pmorch/c4viz is this docker hub image. In the above example, it uses the :latest tag but you might want to pick a fixed version.

Run from command line

You'll need these installed:

  • java 11+
  • node 10+
  • task

Now:

task serve-backend

This will build and start the backend with an embedded frontend.

Again, access http://localhost:9000, and you're good to go!

Using a ?source=$url Query Parameter

If you specify a source query parameter, you can render other .dsl documents too.

source as a file name

If you put multiple .dsl files in your C4VIZ_SOURCE_DIR folder, you can render other files in that folder using: http://localhost:9000?source=otherfile.dsl . For security reasons, the filename must be in that folder and may not contain e.g. the / character.

source as a URL

In addition to the sources as files in the C4VIZ_SOURCE directory, you can also specify URLs like: http://localhost:9000?source=https://raw.githubusercontent.com/structurizr/dsl/master/examples/deployment-groups.dsl

NOTE: This only works for self-contained .dsl-s. Some, e.g. test.dsl expects logo.png to exist in the same directory, and so the using that as a source will yield an error like this: logo.png does not exist at line 182: icon logo.png. Patches to overcome this are welcome, but are not a priority for me.

Environment Variables

You can set these environment variables:

Environment Variable Default Value
SERVER_PORT null
C4VIZ_SOURCE null
C4VIZ_SOURCE_DIR Cmdline: none, Docker image: /sourceDir
C4VIZ_CACHE Cmdline: /tmp, Task: /tmp/c4vizCache Docker image: /var/cache/c4viz

The web server is only started and the C4VIZ_* environment varibles only come into play if SERVER_PORT is set.

Without a value for SERVER_PORT, both the docker image and the command line jar file will convert a .dsl file into values useful for the frontend as in:

$ task build-backend
...
$ mkdir output
$ java -jar backend/build/libs/c4viz-${version}.jar ./sourceDir/big-bank-plc.dsl output
...
$ ls -l output
-rw-r--r-- 1 peter peter 162880 Dec 19 12:16 c4.viz.json
-rw-r--r-- 1 peter peter   4172 Dec 19 12:16 Components.puml
-rw-r--r-- 1 peter peter  25077 Dec 19 12:16 Components.svg
...

Structure of this project

There is a separate Spring Boot backend (in ./backend) and a Vue frontend (in ./frontend/).

During the build process, the frontend is built and copied into backend/build/resources/main/static.

So when run, http://localhost:9090/index.html (or just http://localhost:9090) is the frontend where everything else is the backend.

All the magical incantations to do various development tasks are visible in Taskfile.yaml, to be used with task.

Frontend Development Setup

The process of ./gradlew build for every frontend change is tedious, so there is another option.

./frontend/vue.config.js is configured to proxy the backend calls to http://localhost:9000.

So to develop the frontend, first start the spring backend on port 9000, then start the frontend. Now accessing http://localhost:3000 will access the Vue development server, but any backend requests will be proxied to spring boot. So:

Terminal 1 for the backend:

# Either using task
task serve-backend

# Or by hand
cd backend
./gradlew build
SERVER_PORT=9000 java -jar build/libs/c4viz-$VERSION.jar

Terminal 2 for the frontend:

# Either using task
task serve-frontend

# Or by hand
cd frontend
npm run serve -- --port 3000
Comments
  • Embedded newlines make the PlantUML source invalid

    Embedded newlines make the PlantUML source invalid

    Embedded newlines like

    myUI = container "Xsys UI\nsomething" "Provides a UI for..." "SPA"
    

    cause the generated PlantUML to break.

    Otherwise a nice utility!

    opened by hindsholm 4
  • Replace logo and favicon

    Replace logo and favicon

    I cheated and used the ones from Structurizr, and Simon from that project would like me to use a separate icon, see: https://github.com/structurizr/cli/issues/58#issuecomment-997672869

    opened by pmorch 0
  • Spelling mistake -

    Spelling mistake - "environment varibles only come"

    Small issue in the read me file - "environment varibles only come..." (line 112) should be "environment variables only come..." "

    opened by tzafrirben 0
  • Upgrades structurizr dependencies in order to support newest dsl features

    Upgrades structurizr dependencies in order to support newest dsl features

    I wanted to use the child element versions of description, technology and tags that were added to structurizr dsl in January, so have upgraded the structurizr dependencies to the latest versions.

    OutputGenerator needed some imports updating since the structurizr packages have moved. Also needed to explicitly require the apache httpclient dependency.

    opened by gilesp 0
  • svg direct links not refreshed when source updated

    svg direct links not refreshed when source updated

    If a source points to a http hosted file and the file changes, a refresh of the browser when looking at the main user interface causes the updated file to be picked up, rerendered and the new visualization is shown.

    But if one is looking at a direct svg link, then a refresh of the browser does not automatically cause a the new version to be picked up and rerendered. The old version is still shown.

    opened by pmorch 0
Owner
Peter Valdemar Mørch
Peter Valdemar Mørch
Flow Visualization Library for JavaFX and VRL-Studio

VWorkflows Interactive flow/graph visualization for building domain specific visual programming environments. Provides UI bindings for JavaFX. See htt

Michael Hoffer 274 Dec 29, 2022
Directory tree model for JavaFX that watches the filesystem for changes.

LiveDirsFX LiveDirsFX is a combination of a directory watcher, a directory-tree model (for TreeView) and a simple asynchronous file I/O facility. The

Tomas Mikula 44 Oct 23, 2022
null 4 Oct 21, 2022
PostgreSQL is the world's most advanced open source database. Also, PostgreSQL is suitable for Event Sourcing. This repository provides a sample of event sourced system that uses PostgreSQL as event store.

Event Sourcing with PostgreSQL Introduction Example Domain Event Sourcing and CQRS 101 State-Oriented Persistence Event Sourcing CQRS Advantages of CQ

Evgeniy Khyst 146 Dec 20, 2022
An open source application to make your own android applications without coding!

Stif An Open source project for building Android Application at a go both with and without coding. This project was inspired from Scratch and Sketchwa

Nethical org 5 Aug 28, 2021
WavesFX an open-source Waves wallet for Windows, macOS and Linux

WavesFX WavesFX is an open-source Waves wallet for Windows, macOS and Linux. Telegram Chat Releases can be found on the release list. How to build Wav

WavesFX 22 Apr 15, 2022
MaterialFX is an open source Java library which provides material design components for JavaFX

MaterialFX MaterialFX is an open source Java library which provides material design components for JavaFX Explore the wiki » Download Latest Demo · Re

Alessadro Parisi 744 Jan 3, 2023
Solution for rapid development of specific enterprise software

Open-Lowcode Lowcode framework for enterprises Open Lowcode allows organizations develop quickly specific applications, and scale them with a minimum

Open Lowcode 176 Nov 28, 2022
Ghidra is a software reverse engineering (SRE) framework

Ghidra Software Reverse Engineering Framework Ghidra is a software reverse engineering (SRE) framework created and maintained by the National Security

National Security Agency 36.5k Dec 28, 2022
Project for "Software Engineering" Course, University of Macedonia (UoM).

CovIDetect CovIDetect is a dashboard application for universities that aims to facilitate the process of managing covid cases and provide statistical

null 12 Dec 21, 2022
Yet another very simple java 3D software renderer using only standard 2D libraries (Java2D, AWT & Swing). Video: https://youtu.be/hWUX1t9f6zE

Another very simple 3D software renderer Another very simple 3D software renderer implemented in java using only standard libraries (java 2D, AWT & Sw

Leo 13 Oct 17, 2022
an open souece, lightWeight and beautiful GUI for VPN Usage

free, open source, lightweight and beutiful GUI for vpn usage , this Project is part of my #100DaysOfCode challenge in twitter : @My_Terminal Dependen

Mohammad Esmaeili 21 Nov 9, 2022
The open Transportation Control System

openTCS Homepage: https://www.opentcs.org/ Changelog: changelog.adoc openTCS (short for open Transportation Control System) is a free platform for con

openTCS 158 Jan 8, 2023
Open API demo for CloudQuery

open-api-demo This project is an example for CloudQuery Community, which can assist community users in code development such as organizational structu

ToolsLab-BinTools 12 Jan 4, 2023
an android app to browse urls before open

link eye - kuesji koesnu - 8/8/2021 an android app to browse urls before open try to open a link, select link eye and choose always to start using

kuesji koesnu 25 Dec 31, 2022
Open Weather Map API wrapper for Java.

Java Open Weather API Wrapper Open Weather Map API wrapper for Java. This project allows you to seamlessly implement the Open Weather Map API into you

Will 2 Feb 6, 2022
FOSSLight source code repository

[Kor] FOSSLight FOSSLight is an integrated system that can efficiently process the open source compliance process. Features Compliance Workflow It can

FOSSLight 116 Dec 7, 2022
Source Code for 'More Java 17' by Kishori Sharan and Peter Späth

Apress Source Code This repository accompanies More Java 17 by Kishori Sharan and Peter Späth (Apress, 2021). Download the files as a zip using the gr

Apress 8 Oct 27, 2022
Archinsight project tends to implement architecture-as-code definition of a standard c4 architecture model

Archinsight project tends to implement architecture-as-code definition of a standard c4 architecture model. This project offers a new Insight language designed in such way that an Architect can focus on architecture definition, not visualization. Compared to UML, the Insight language is more specific and is unable to describe an arbitrary entity, but shorter and probably easier to use.

null 25 Nov 24, 2022
DataCap is integrated software for data transformation, integration and visualization.

DataCap (incubator) DataCap is integrated software for data transformation, integration and visualization. Require Must-read for users: Be sure to exe

EdurtIO 184 Dec 28, 2022