Skip to content

Commit f3073cf

Browse files
Adds basic archetypes docs.
1 parent 0c22837 commit f3073cf

12 files changed

+138
-11
lines changed

dsl/06-archetypes.md

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
layout: default
3+
title: Archetypes
4+
parent: Structurizr DSL
5+
nav_order: 6
6+
permalink: /dsl/archetypes
7+
---
8+
9+
# Archetypes
10+
11+
The archetypes feature (from v4.0.0) provides a way to create user defined types that extend the basic element/relationship types
12+
and optionally add some defaults for descriptions, technology, tags, properties, and perspectives.
13+
The key benefits are as follows:
14+
15+
- Archetypes reduce duplication (define a type once, use it anywhere).
16+
- Archetypes lead to more concise DSL definitions.
17+
- Archetypes allow teams to build their own ubiquitous language on top of the C4 model.
18+
19+
## Element archetypes
20+
21+
For example, you could define archetypes named `application` and `datastore`
22+
that are essentially just aliases for `container`.
23+
24+
```
25+
workspace {
26+
27+
model {
28+
archetypes {
29+
application = container
30+
datastore = container
31+
}
32+
33+
softwareSystem "A" {
34+
webapp = application "Web Application"
35+
db = datastore "Database Schema"
36+
37+
webapp -> db "Reads from"
38+
}
39+
}
40+
41+
}
42+
```
43+
44+
Archetypes can have a set of defaults defined too:
45+
46+
```
47+
workspace {
48+
49+
model {
50+
archetypes {
51+
application = container {
52+
technology "Java"
53+
tag "Application"
54+
}
55+
datastore = container {
56+
technology "MySQL"
57+
tag "Data Store"
58+
}
59+
}
60+
61+
softwareSystem "A" {
62+
webapp = application "Web Application"
63+
db = datastore "Database Schema"
64+
65+
webapp -> db "Reads from"
66+
}
67+
}
68+
69+
}
70+
```
71+
72+
Archetypes can also be extended:
73+
74+
```
75+
workspace {
76+
77+
model {
78+
archetypes {
79+
application = container {
80+
technology "Java"
81+
tag "Application"
82+
}
83+
springBootApplication = application {
84+
technology "Spring Boot"
85+
}
86+
datastore = container {
87+
technology "MySQL"
88+
tag "Data Store"
89+
}
90+
}
91+
92+
softwareSystem "A" {
93+
webapp = springBootApplication "Web Application"
94+
db = datastore "Database Schema"
95+
96+
webapp -> db "Reads from"
97+
}
98+
}
99+
100+
}
101+
```
102+
103+
## Relationship archetypes
104+
105+
Relationship archetypes are also supported:
106+
107+
```
108+
workspace {
109+
110+
model {
111+
archetypes {
112+
sync = -> {
113+
tags "Synchronous"
114+
}
115+
https = --sync-> {
116+
technology "HTTPS"
117+
}
118+
}
119+
120+
a = softwareSystem "A"
121+
b = softwareSystem "B"
122+
123+
a --https-> b "Makes APIs calls using"
124+
}
125+
126+
}
127+
```

dsl/06-implied-relationships.md renamed to dsl/07-implied-relationships.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: Implied relationships
44
parent: Structurizr DSL
5-
nav_order: 6
5+
nav_order: 7
66
permalink: /dsl/implied-relationships
77
---
88

dsl/07-expressions.md renamed to dsl/08-expressions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: Expressions
44
parent: Structurizr DSL
5-
nav_order: 7
5+
nav_order: 8
66
permalink: /dsl/expressions
77
---
88

dsl/08-includes.md renamed to dsl/31-includes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: Includes
44
parent: Structurizr DSL
5-
nav_order: 8
5+
nav_order: 31
66
permalink: /dsl/includes
77
---
88

dsl/09-workspace-extension.md renamed to dsl/32-workspace-extension.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: Workspace extension
44
parent: Structurizr DSL
5-
nav_order: 9
5+
nav_order: 32
66
permalink: /dsl/workspace-extension
77
---
88

dsl/10-docs.md renamed to dsl/51-docs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: Markdown/Asciidoc documentation
44
parent: Structurizr DSL
5-
nav_order: 10
5+
nav_order: 51
66
permalink: /dsl/docs
77
---
88

dsl/11-adrs.md renamed to dsl/52-adrs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: Architecture Decision Records (ADRs)
44
parent: Structurizr DSL
5-
nav_order: 11
5+
nav_order: 52
66
permalink: /dsl/adrs
77
---
88

dsl/12-scripts.md renamed to dsl/61-scripts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: Scripts
44
parent: Structurizr DSL
5-
nav_order: 12
5+
nav_order: 61
66
permalink: /dsl/scripts
77
---
88

dsl/14-language.md renamed to dsl/71-language.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: Language reference
44
parent: Structurizr DSL
5-
nav_order: 14
5+
nav_order: 71
66
permalink: /dsl/language
77
---
88

dsl/99-faq.md renamed to dsl/81-faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: FAQ
44
parent: Structurizr DSL
5-
nav_order: 14
5+
nav_order: 81
66
permalink: /dsl/faq
77
---
88

dsl/cookbook/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Cookbook
4-
nav_order: 21
4+
nav_order: 91
55
parent: Structurizr DSL
66
has_children: true
77
permalink: /dsl/cookbook/

dsl/plugins/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Plugins
4-
nav_order: 13
4+
nav_order: 62
55
parent: Structurizr DSL
66
has_children: true
77
permalink: /dsl/plugins

0 commit comments

Comments
 (0)