@@ -31,27 +31,32 @@ To install GraphViz to your favorite OS, please, follow this link [https://graph
31
31
32
32
## Components
33
33
34
- ### A picture is worth a thousand words
34
+ > a picture is worth a thousand words
35
35
36
36
... and this is particularly true in regard to complex IT architectures.
37
37
38
38
The basic unit of each _ draft_ design is the ` component ` :
39
39
40
40
``` go
41
41
type Component struct {
42
- ID string ` yaml:"id,omitempty"` // optional - autogenerated if omitted (read more for details...)
43
- Kind string ` yaml:"kind"` // required (one of: service, gateway, queue, broker, function, storage, database)
44
- Label string ` yaml:"label,omitempty"` // optional - the component description (or scope)
45
- Provider string ` yaml:"provider,omitempty"` // optional - you can use this to specify the implementation
46
- FillColor string ` yaml:"fillColor,omitempty"` // optional - the hex code for the background color
47
- FontColor string ` yaml:"fontColor,omitempty"` // optional - the hex code for the foreground color
48
- Rounded bool ` yaml:"rounded,omitempty"` // optional - set to true if you wants rounded shapes
42
+ ID string ` yaml:"id,omitempty"` // optional - autogenerated if omitted (read more for details...)
43
+ Kind string ` yaml:"kind"` // required (one of: service, gateway, queue, broker, function, storage, database)
44
+ Label string ` yaml:"label,omitempty"` // optional - the component description (or scope)
45
+ Provider string ` yaml:"provider,omitempty"` // optional - you can use this to specify the cloud provider
46
+ Impl string ` yaml:"impl,omitempty"` // optional - you can use this to specify the implementation
47
+ FillColor string ` yaml:"fillColor,omitempty"` // optional - the hex code for the background color
48
+ FontColor string ` yaml:"fontColor,omitempty"` // optional - the hex code for the foreground color
49
+ Rounded bool ` yaml:"rounded,omitempty"` // optional - set to true if you wants rounded shapes
49
50
}
50
51
```
51
52
52
53
Draft uses a set of symbols independent from the different providers (AWS, Microsoft Azure, GCP).
53
54
54
- - you can eventually describe the implementation using the ` provider ` attribute.
55
+ Eventually you can describe...
56
+
57
+ - the implementation using the ` impl ` attribute (ie: _ impl: 'SQS'_ )
58
+ - the cloud provider using the ` provider ` attribute (ie: _ provider: AWS_ )
59
+ - 💡 components with the same provider will be 'grouped'
55
60
56
61
Below is a list of all the components currently implemented.
57
62
@@ -66,18 +71,14 @@ Below is a list of all the components currently implemented.
66
71
| ** Function** | ` function ` | ![ ] ( ./examples/fn.jpg ) | ![ ] ( ./examples/function.png ) |
67
72
| ** Database** | ` database ` | ![ ] ( ./examples/db.jpg ) | ![ ] ( ./examples/database.png ) |
68
73
69
- ## Connections
74
+ ### Notes about a component ` id `
70
75
71
- You can connect each component by arrows.
76
+ - you can define your component ` id ` explicitly (i.e. _ id: MY_SERVICE_A_ )
77
+ - or you can omit the component ` id ` attribute and it will be autogenerated
72
78
73
- To be able to connect an _ origin component _ with one or more _ target component _ you need to specify each ` componentId ` .
79
+ #### How is auto-generated a component ` id ` ?
74
80
75
- - you can define your component ` id ` explicitly
76
- - you can omit the component ` id ` attribute and it will be autogenerated
77
-
78
- ### Autogenerated ` id `
79
-
80
- An autogenerated ` id ` has a prefix and a sequential number
81
+ An auto-generated component ` id ` has a prefix and a sequential number
81
82
82
83
- the prefix is related to the component ` kind `
83
84
@@ -92,6 +93,12 @@ An autogenerated `id` has a prefix and a sequential number
92
93
| ` function ` | fn | _ fn1, fn2,..._ |
93
94
| ` database ` | db | _ db1, db2,..._ |
94
95
96
+ ## Connections
97
+
98
+ You can connect each component by arrows.
99
+
100
+ To be able to connect an _ origin component_ with one or more _ target component_ you need to specify each ` componentId ` .
101
+
95
102
A ` connection ` has the following properties:
96
103
97
104
``` go
@@ -112,191 +119,52 @@ type Connection struct {
112
119
113
120
## Example 1 - Message Bus Pattern
114
121
115
- Create the ` draft ` architecture descriptor YAML with your favorite editor:
116
-
117
- ``` yaml
118
- title : message bus pattern
119
- backgroundColor : ' #ffffff'
120
- components :
121
- -
122
- kind : service
123
- label : Producer
124
- provider : AWS EC2
125
- -
126
- kind : broker
127
- label : " Notification\n Service"
128
- provider : AWS SNS
129
- -
130
- kind : queue
131
- label : " event queue @ topic 1"
132
- provider : AWS SQS
133
- -
134
- kind : queue
135
- label : " event queue @ topic 2"
136
- provider : AWS SQS
137
- -
138
- kind : service
139
- label : " Consumer\n @ topic 1"
140
- provider : AWS EC2
141
- -
142
- kind : service
143
- label : " Consumer\n @ topic 2"
144
- provider : AWS EC2
145
- connections :
146
- -
147
- origin :
148
- componentId : ms1
149
- targets :
150
- -
151
- componentId : br1
152
- -
153
- origin :
154
- componentId : br1
155
- targets :
156
- -
157
- componentId : qs1
158
- dashed : true
159
- -
160
- componentId : qs2
161
- dashed : true
162
- -
163
- origin :
164
- componentId : qs1
165
- targets :
166
- -
167
- componentId : ms2
168
- dir : back
169
- -
170
- origin :
171
- componentId : qs2
172
- targets :
173
- -
174
- componentId : ms3
175
- dir : back
176
- ` ` `
122
+ The ` draft ` architecture descriptor YAML file is here 👉 [ ./examples/message-bus-pattern.yml] ( ./examples/message-bus-pattern.yml )
177
123
178
- Then run ` draft`:
124
+ Running ` draft ` with this command :
179
125
180
126
``` bash
181
127
draft message-bus-pattern.yml | dot -Tpng > message-bus-pattern.png
182
128
```
183
129
184
- Here the generated output :
130
+ Will generate this output:
185
131
186
132
![ ] ( ./examples/message-bus-pattern.png )
187
133
188
134
189
135
## Example 2 - AWS Cognito Custom Authentication Flow
190
136
191
- Create the draft architecture descriptor YAML with your favorite editor :
192
-
193
- ` ` ` yaml
194
- title: Amazon Cognito Custom Authentication Flow with external database
195
- backgroundColor: '#ffffff'
196
- components:
197
- -
198
- kind: client
199
- label: "Web App"
200
- -
201
- kind: client
202
- label: "Mobile App"
203
- -
204
- kind: service
205
- label: "Cognito"
206
- provider: "AWS Cognito"
207
- fillColor: '#991919'
208
- fontColor: '#fafafa'
209
- -
210
- kind: function
211
- label: "Define\n AuthChallange"
212
- provider: "AWS Lambda"
213
- -
214
- kind: function
215
- label: "Create\n AuthChallange"
216
- provider: "AWS Lambda"
217
- -
218
- kind: function
219
- label: "Verify\n AuthChallange"
220
- provider: "AWS Lambda"
221
- -
222
- kind: database
223
- label: "Users\n Repository"
224
- provider: "AWS RDS"
225
- connections:
226
- -
227
- origin:
228
- componentId: cl1
229
- targets:
230
- -
231
- componentId: ms1
232
- -
233
- origin:
234
- componentId: cl2
235
- targets:
236
- -
237
- componentId: ms1
238
- -
239
- origin:
240
- componentId: ms1
241
- targets:
242
- -
243
- componentId: fn1
244
- -
245
- componentId: fn2
246
- -
247
- componentId: fn3
248
- -
249
- origin:
250
- componentId: fn2
251
- targets:
252
- -
253
- componentId: db1
137
+ The ` draft ` architecture descriptor YAML file is here 👉 [ ./examples/aws-cognito-custom-auth-flow.yml] ( ./examples/aws-cognito-custom-auth-flow.yml )
138
+
139
+ Running ` draft ` with this command:
140
+
141
+ ``` bash
142
+ draft aws-cognito-custom-auth-flow.yml | dot -Tpng > aws-cognito-custom-auth-flow.png
254
143
```
255
144
256
- Here the generated output :
145
+ Will generate this output:
257
146
258
147
![ ] ( ./examples/aws-cognito-custom-auth-flow.png )
259
148
260
149
## Example 3 - Getting the pre-signed URL to Upload a file to Amazon S3
261
150
262
- ` ` ` yaml
263
- title: Upload file to S3 using Lambda for pre-signed URL
264
- backgroundColor: '#ffffff'
265
- components:
266
- -
267
- kind: client
268
- label: "Web App"
269
- provider: SPA
270
- -
271
- kind: gateway
272
- provider: "AWS API Gateway"
273
- -
274
- kind: function
275
- label: "Get\n Pre-Signed URL"
276
- provider: "AWS Lambda"
277
- -
278
- kind: storage
279
- label: "*.jpg\n *.png"
280
- provider: "AWS S3"
281
- connections:
282
- -
283
- origin:
284
- componentId: cl1
285
- targets:
286
- -
287
- componentId: gt1
288
- -
289
- origin:
290
- componentId: gt1
291
- targets:
292
- -
293
- componentId: fn1
294
- -
295
- origin:
296
- componentId: fn1
297
- targets:
298
- -
299
- componentId: st1
151
+
152
+ The ` draft ` architecture descriptor YAML file is here 👉 [ ./examples/s3-upload-presigned-url.yml] ( ./examples/s3-upload-presigned-url.yml )
153
+
154
+ Running ` draft ` with this command:
155
+
156
+ ``` bash
157
+ draft s3-upload-presigned-url.yml | dot -Tpng > s3-upload-presigned-url.png
300
158
```
301
159
302
- 
160
+ ![ ] ( ./examples/s3-upload-presigned-url.png )
161
+
162
+ ## Others examples
163
+
164
+ Check out the 👉 [ ./examples/] ( /examples/ ) folders for more ` draft ` architecture descriptor YAML examples.
165
+
166
+
167
+
168
+ ---
169
+
170
+ (c) 2020 Luca Sepe http://lucasepe.it . MIT License
0 commit comments