Skip to content

Commit

Permalink
feat(c4-model-v2): full rewrite of c4-model based on the new PlantUML…
Browse files Browse the repository at this point in the history
… preprocessor
  • Loading branch information
tmorin committed Feb 4, 2020
1 parent 02aa825 commit 5f77012
Show file tree
Hide file tree
Showing 11 changed files with 625 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@

Set of libraries for [PlantUML](http://plantuml.com).

- [C4 Model](c4model/README.md)
- [C4 Model V2](c4model-v2/README.md)
- [EventStorming](eventstorming/README.md)

Deprecated libraries:

- [C4 Model](c4model/README.md)
167 changes: 167 additions & 0 deletions c4model-v2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# C4 Model V2

Library implementing elements respecting the [C4 Model](https://c4model.com).

## Install

To include every thing:
```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
@enduml
```

## Elements

### Person

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
Person("p1", "A person", "An optional description.")
@enduml
```

![person](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=0&person)

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
ExternalPerson("ep1", "An external person", "An optional description.")
@enduml
```

![external person](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=1&external_person)

### Software System

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
System("s1", "A system", "An optional description.")
@enduml
```

![system](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=2&system)

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
ExternalSystem("es1", "An external system", "An optional description.")
@enduml
```

![external system](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=3&external_system)

### Container

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
Container("c1", "A container", "An optional description.", "optional technology")
@enduml
```

![container](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=4&container)

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
Database("d1", "A database", "An optional description.", "optional technology")
@enduml
```

![database](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=5&database)

### Component

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
Component("c1", "A component", "An optional description.", "optional technology")
@enduml
```

![component](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=6&component)

### Boundary

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
Enterprise("e1", "An enterprise") {
SystemBoundary("s1", "A system") {
ContainerBoundary("c1", "A container") {
note "the container area" as NC
}
note "the system area" as NS
}
note "the enterprise area" as NE
}
@enduml
```

![boundaries](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=7&boundary)

### Relationship

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
Person("p1", "A person")
System("s1", "A system")
p1 -> s1 : Relationship("an optional name", "optional technology")
@enduml
```

![relationship](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=8&relationship)

## Layout

### Title

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
showTitle("the name of the diagram", "an optional date", "an optional version")
@enduml
```

![title](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=9&title)

### Legend

```plantuml
@startuml
!includeurl https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/c4-all.puml
showLegend()
@enduml
```

![legend](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/README.puml&idx=10&legend)

## Views

### Level 1: System Context diagram

You will find more information about the System Context diagram on [c4model.com](https://c4model.com/#SystemContextDiagram).

![example system context diagram](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/example-lvl1-SystemContext.puml)

The source: [example-lvl1-SystemContext.puml](example-lvl1-SystemContext.puml)

### Level 2: Container diagram

You will find more information about the Container diagram on [c4model.com](https://c4model.com/#ContainerDiagram).

![example container diagram](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/example-lvl2-Container.puml)

The source: [example-lvl2-Container.puml](example-lvl2-Container.puml)

### Level 3: Component diagram

You will find more information about the Container diagram on [c4model.com](https://c4model.com/#ComponentDiagram).

![example component diagram](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/c4model-v2/example-lvl3-Component.puml)

The source: [example-lvl3-Component.puml](example-lvl3-Component.puml)
98 changes: 98 additions & 0 deletions c4model-v2/README.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
@startuml(id=person)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
Person("p1", "A person", "An optional description.")
@enduml

@startuml(id=external_person)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
ExternalPerson("ep1", "An external person", "An optional description.")
@enduml

@startuml(id=system)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
System("s1", "A system", "An optional description.")
@enduml

@startuml(id=external_system)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
ExternalSystem("es1", "An external system", "An optional description.")
@enduml

@startuml(id=container)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
Container("c1", "A container", "An optional description.", "optional technology")
@enduml

@startuml(id=database)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
Database("d1", "A database", "An optional description.", "optional technology")
@enduml

@startuml(id=component)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
Component("c1", "A component", "An optional description.", "optional technology")
@enduml

@startuml(id=boundary)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
left to right direction
Enterprise("e1", "An enterprise") {
SystemBoundary("s1", "A system") {
ContainerBoundary("c1", "A container") {
note "the container area" as NC
}
note "the system area" as NS
}
note "the enterprise area" as NE
}
@enduml

@startuml(id=relationship)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
Person("p1", "A person")
System("s1", "A system")
p1 -> s1 : Relationship("an optional name", "optional technology")
@enduml

@startuml(id=title)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
showTitle("the name of the diagram", "an optional date", "an optional version")
@enduml

@startuml(id=legend)
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-all.puml
' !include c4-all.puml
showLegend()
@enduml
12 changes: 12 additions & 0 deletions c4model-v2/c4-all.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@startuml
' remote inclusions
!global $C4_LIB_BRANCH="master"
!global $C4_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/"+$C4_LIB_BRANCH+"/c4model-v2"
!includeurl $C4_LIB_BASE_URL/c4-constants.puml
!includeurl $C4_LIB_BASE_URL/c4-functions.puml
!includeurl $C4_LIB_BASE_URL/c4-styles.puml
' local inclusions
' !include c4-constants.puml
' !include c4-functions.puml
' !include c4-styles.puml
@enduml
29 changes: 29 additions & 0 deletions c4model-v2/c4-constants.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@startuml
!global $NAME_FONT_SIZE="12"
!global $TECH_FONT_SIZE="10"
!global $DESC_FONT_SIZE="11"

!global $ARROW_COLOR="#747A80"
!global $ELEMENT_COLOR_TEXT="White"

!global $BOUNDARY_COLOR_TEXT="#46494D"
!global $BOUNDARY_COLOR_BORDER="#46494D"

!global $PERSON_COLOR_BG="#08427B"
!global $PERSON_COLOR_BORDER="#05284A"

!global $SYSTEM_COLOR_BG="#396895"
!global $SYSTEM_COLOR_BORDER="#223E59"

!global $CONTAINER_COLOR_BG="#6B8EB0"
!global $CONTAINER_COLOR_BORDER="#40556A"

!global $COMPONENT_COLOR_BG="#9CB3CA"
!global $COMPONENT_COLOR_BORDER="#5E6B79"

!global $EXTERNAL_PERSON_COLOR_BG="#747A80"
!global $EXTERNAL_PERSON_COLOR_BORDER="#46494D"

!global $EXTERNAL_SYSTEM_COLOR_BG="#747A80"
!global $EXTERNAL_SYSTEM_COLOR_BORDER="#46494D"
@enduml
Loading

0 comments on commit 5f77012

Please sign in to comment.