Skip to content

Commit 19b2d3c

Browse files
authored
Merge pull request #1935 from rocketstack-matt/feat/advent-days-11-16
AOC: Update days 11 - 16
2 parents 9db8f84 + 79e7af6 commit 19b2d3c

File tree

8 files changed

+1160
-952
lines changed

8 files changed

+1160
-952
lines changed

advent-of-calm/day-11.md

Lines changed: 44 additions & 246 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
# Day 11: Generate Documentation with Docify
1+
# Day 11: Share Your Architecture with a Documentation Website
22

33
## Overview
4-
Transform your CALM architecture into browsable HTML documentation using the docify command.
4+
Generate a shareable documentation website from your CALM architecture - making your architecture knowledge accessible to anyone with a browser.
55

66
## Objective and Rationale
7-
- **Objective:** Use `calm docify` to generate comprehensive documentation website from your architecture
8-
- **Rationale:** Machine-readable architecture (JSON) needs human-readable outputs. Docify generates documentation automatically, ensuring docs stay in sync with architecture. Essential for stakeholder communication and onboarding.
7+
- **Objective:** Use `calm docify` to generate a comprehensive documentation website that can be shared across your organization
8+
- **Rationale:** Architecture knowledge locked in JSON files or local tools limits its value. By generating a static website, you can publish your architecture documentation to internal hosting, share it with stakeholders who don't have development tools, and ensure everyone has access to the same source of truth.
99

1010
## Requirements
1111

12-
### 1. Understand Docify
12+
### 1. Understand the Value of Shareable Documentation
1313

14-
The `calm docify` command generates documentation in multiple modes:
15-
- **Website mode (default):** Full HTML website with navigation
16-
- **Template mode:** Single file using custom template
17-
- **Template-dir mode:** Multiple files using template bundle
14+
Until now, viewing your architecture required either:
15+
- The VSCode Extension (requires VSCode installed)
16+
- Reading raw JSON (requires technical knowledge)
1817

19-
### 2. Generate Default Documentation Website
18+
A documentation website solves this by:
19+
- **Accessibility:** Anyone with a browser can view it
20+
- **Shareability:** Host on internal servers, GitHub Pages, or any static hosting
21+
- **Consistency:** Everyone sees the same documentation
22+
- **Self-serve:** Stakeholders can explore without asking architects
23+
24+
### 2. Generate Your Documentation Website
2025

2126
```bash
2227
calm docify --architecture architectures/ecommerce-platform.json --output docs/generated/ecommerce-docs
@@ -25,11 +30,11 @@ calm docify --architecture architectures/ecommerce-platform.json --output docs/g
2530
This creates a complete HTML website with:
2631
- Index page with architecture overview
2732
- Node details pages
28-
- Relationship visualization
33+
- Relationship visualizations
2934
- Flow diagrams
3035
- Control and metadata display
3136

32-
### 3. Install and Run the Documentation Website
37+
### 3. Run the Documentation Website
3338

3439
The generated website is a self-contained application. Install dependencies and start it:
3540

@@ -45,264 +50,60 @@ This will start a local development server. Open the URL shown in your terminal
4550
- Navigate through different sections (nodes, relationships, flows, controls)
4651
- Click on nodes to see their details
4752
- View flow sequence diagrams
48-
- **Take screenshots** of the main pages
53+
- **Take screenshots** of the main pages to share
4954

5055
When done, press `Ctrl+C` to stop the server and return to your project root:
5156

5257
```bash
5358
cd ../../..
5459
```
5560

56-
### 4. Understand Handlebars Templates
57-
58-
Docify uses [Handlebars](https://handlebarsjs.com/) as its templating engine. Handlebars provides a simple way to generate text output from your architecture data using mustache-style `{{expressions}}`.
59-
60-
#### Basic Handlebars Syntax
61-
62-
| Syntax | Description | Example |
63-
|--------|-------------|---------|
64-
| `{{property}}` | Output a value | `{{metadata.version}}``1.0.0` |
65-
| `{{#each array}}...{{/each}}` | Loop over arrays | `{{#each nodes}}{{this.name}}{{/each}}` |
66-
| `{{#if condition}}...{{/if}}` | Conditional rendering | `{{#if metadata}}...{{/if}}` |
67-
| `{{#if condition}}...{{else}}...{{/if}}` | If-else | `{{#if flows}}...{{else}}No flows{{/if}}` |
68-
| `{{@key}}` | Current key when iterating objects | Used with `{{#each}}` on objects |
69-
| `{{this}}` | Current item in loop | `{{#each tags}}{{this}}{{/each}}` |
70-
| `{{this.property}}` | Property of current item | `{{#each nodes}}{{this.name}}{{/each}}` |
71-
72-
#### CALM Docify Helpers
73-
74-
CALM's docify command registers several custom Handlebars helpers to make templating easier:
75-
76-
| Helper | Description | Example |
77-
|--------|-------------|---------|
78-
| `eq` | Equality comparison | `{{#if (eq node-type "service")}}...{{/if}}` |
79-
| `or` | Logical OR | `{{#if (or hasFlows hasControls)}}...{{/if}}` |
80-
| `json` | Output as JSON | `{{json metadata}}` |
81-
| `lookup` | Dynamic property access | `{{lookup this propertyName}}` |
82-
| `kebabCase` | Convert to kebab-case | `{{kebabCase name}}` |
83-
| `kebabToTitleCase` | Convert kebab to Title Case | `{{kebabToTitleCase node-type}}` |
84-
| `isObject` | Check if value is object | `{{#if (isObject value)}}...{{/if}}` |
85-
| `isArray` | Check if value is array | `{{#if (isArray items)}}...{{/if}}` |
86-
| `notEmpty` | Check if value exists and not empty | `{{#if (notEmpty interfaces)}}...{{/if}}` |
87-
| `eachInMap` | Iterate over map/object entries | `{{#eachInMap controls}}...{{/eachInMap}}` |
88-
| `mermaidId` | Sanitize ID for Mermaid diagrams | `{{mermaidId unique-id}}` |
89-
| `join` | Join array elements | `{{join tags ", "}}` |
90-
91-
#### Common Patterns
92-
93-
**Filter nodes by type:**
94-
```handlebars
95-
{{#each nodes}}
96-
{{#if (eq node-type "service")}}
97-
- {{this.name}} is a service
98-
{{/if}}
99-
{{/each}}
100-
```
101-
102-
**Handle missing data gracefully:**
103-
```handlebars
104-
{{#if metadata.owner}}
105-
**Owner:** {{metadata.owner}}
106-
{{else}}
107-
**Owner:** Not specified
108-
{{/if}}
109-
```
110-
111-
**Iterate over object properties:**
112-
```handlebars
113-
{{#each metadata}}
114-
- **{{@key}}:** {{this}}
115-
{{/each}}
116-
```
117-
118-
### 5. Create a Custom Template
119-
120-
Now let's create custom templates using these Handlebars features.
121-
122-
**File:** `templates/architecture-summary.md`
123-
124-
**Content:**
125-
```handlebars
126-
# {{metadata.title}} Architecture Summary
127-
128-
**Version:** {{metadata.version}}
129-
**Owner:** {{metadata.owner}}
130-
131-
## Overview
132-
{{metadata.description}}
133-
134-
## Components
135-
136-
This architecture contains **{{nodes.length}}** nodes:
137-
138-
{{#each nodes}}
139-
- **{{this.name}}** ({{this.node-type}}): {{this.description}}
140-
{{/each}}
141-
142-
## Integrations
143-
144-
This architecture has **{{relationships.length}}** relationships:
145-
146-
{{#each relationships}}
147-
- **{{this.unique-id}}** ({{#each this.relationship-type}}{{@key}}{{/each}})
148-
{{#if this.relationship-type.connects}}
149-
- {{this.relationship-type.connects.source.node}} → {{this.relationship-type.connects.destination.node}}
150-
{{/if}}
151-
{{#if this.relationship-type.interacts}}
152-
- Actor: {{this.relationship-type.interacts.actor}} interacts with: {{#each this.relationship-type.interacts.nodes}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}
153-
{{/if}}
154-
{{#if this.relationship-type.deployed-in}}
155-
- Container: {{this.relationship-type.deployed-in.container}} contains: {{#each this.relationship-type.deployed-in.nodes}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}
156-
{{/if}}
157-
{{#if this.relationship-type.composed-of}}
158-
- Container: {{this.relationship-type.composed-of.container}} composed of: {{#each this.relationship-type.composed-of.nodes}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}
159-
{{/if}}
160-
{{/each}}
161-
162-
## Flows
163-
164-
{{#if flows}}
165-
{{#each flows}}
166-
### {{this.name}}
167-
{{this.description}}
168-
169-
Steps:
170-
{{#each this.transitions}}
171-
{{this.sequence-number}}. {{this.description}}
172-
{{/each}}
173-
174-
{{/each}}
175-
{{else}}
176-
No flows defined yet.
177-
{{/if}}
178-
179-
## Controls
180-
181-
{{#if controls}}
182-
{{#each controls}}
183-
### {{@key}}
184-
{{this.description}}
185-
186-
{{/each}}
187-
{{else}}
188-
No controls defined yet.
189-
{{/if}}
190-
191-
---
192-
*Generated from CALM architecture on {{metadata.created}}*
193-
```
194-
195-
### 6. Generate Documentation Using Custom Template
196-
197-
```bash
198-
calm docify \
199-
--architecture architectures/ecommerce-platform.json \
200-
--template templates/architecture-summary.md \
201-
--output docs/generated/architecture-summary.md
202-
```
203-
204-
Open `docs/generated/architecture-summary.md` - it's a markdown summary!
205-
206-
### 7. Create a Node Catalog Template
207-
208-
**File:** `templates/node-catalog.md`
209-
210-
**Content:**
211-
```handlebars
212-
# Node Catalog
213-
214-
## Architecture: {{metadata.title}}
215-
216-
Total Nodes: {{nodes.length}}
61+
### 4. When to Use the Website vs VSCode Extension
21762

218-
---
63+
| Use Case | Best Tool |
64+
|----------|-----------|
65+
| Developing/editing architecture | VSCode Extension |
66+
| Sharing with non-technical stakeholders | Documentation Website |
67+
| Architecture review meetings | Documentation Website |
68+
| Quick local preview while coding | VSCode Extension |
69+
| Publishing to team wiki/intranet | Documentation Website |
70+
| Onboarding new team members | Documentation Website |
21971

220-
{{#each nodes}}
221-
## {{this.name}}
72+
**Rule of thumb:** Use VSCode for development, use the website for sharing.
22273

223-
**ID:** `{{this.unique-id}}`
224-
**Type:** {{this.node-type}}
225-
**Description:** {{this.description}}
74+
### 5. Consider Your Publishing Strategy
22675

227-
{{#if this.interfaces}}
228-
### Interfaces
229-
{{#each this.interfaces}}
230-
- **{{this.unique-id}}**
231-
{{#if this.host}}
232-
- Host: {{this.host}}
233-
{{/if}}
234-
{{#if this.port}}
235-
- Port: {{this.port}}
236-
{{/if}}
237-
{{#if this.url}}
238-
- URL: {{this.url}}
239-
{{/if}}
240-
{{/each}}
241-
{{else}}
242-
No interfaces defined.
243-
{{/if}}
76+
Think about how you would publish this website in your organization:
24477

245-
{{#if this.controls}}
246-
### Controls
247-
{{#each this.controls}}
248-
- **{{@key}}:** {{this.description}}
249-
{{/each}}
250-
{{/if}}
78+
- **GitHub Pages:** Free, automatic from a branch
79+
- **Internal static hosting:** Copy the built files to any web server
80+
- **CI/CD integration:** Regenerate docs automatically when architecture changes
25181

252-
{{#if this.metadata}}
253-
### Metadata
254-
{{#each this.metadata}}
255-
- **{{@key}}:** {{this}}
256-
{{/each}}
257-
{{/if}}
82+
> 💡 **Tip:** Add docify to your CI/CD pipeline so documentation is always up-to-date with your architecture.
25883
259-
---
84+
### 6. Update Your README
26085

261-
{{/each}}
262-
```
263-
264-
### 8. Generate Node Catalog
265-
266-
```bash
267-
calm docify \
268-
--architecture architectures/ecommerce-platform.json \
269-
--template templates/node-catalog.md \
270-
--output docs/generated/node-catalog.md
271-
```
272-
273-
### 9. Update Your README
86+
Document Day 11 progress in your README: mark the checklist, describe the documentation website, and note where to find the generated site.
27487

275-
Document Day 11 progress in your README: mark the checklist, describe the new documentation outputs, and link to `docs/generated/README.md` or the screenshots so stakeholders know where to browse the generated sites.
276-
277-
### 10. Commit Your Work
88+
### 7. Commit Your Work
27889

27990
```bash
280-
git add templates/ docs/generated/ README.md
281-
git commit -m "Day 11: Generate documentation with docify and custom templates"
91+
git add docs/generated/ README.md
92+
git commit -m "Day 11: Generate shareable documentation website"
28293
git tag day-11
28394
```
28495

28596
## Deliverables
28697

28798
**Required:**
28899
- `docs/generated/ecommerce-docs/` - Full website documentation
289-
- `docs/generated/architecture-summary.md` - Custom summary
290-
- `docs/generated/node-catalog.md` - Custom node catalog
291-
- `templates/architecture-summary.md` - Custom template
292-
- `templates/node-catalog.md` - Custom template
293-
- Screenshots of generated documentation
100+
- Screenshots of generated documentation website
294101
- Updated `README.md` - Day 11 marked complete
295102

296103
**Validation:**
297104
```bash
298105
# Verify generated documentation exists
299106
test -d docs/generated/ecommerce-docs
300-
test -f docs/generated/architecture-summary.md
301-
test -f docs/generated/node-catalog.md
302-
303-
# Verify templates exist
304-
test -f templates/architecture-summary.md
305-
test -f templates/node-catalog.md
306107

307108
# Check tag
308109
git tag | grep -q "day-11"
@@ -311,16 +112,13 @@ git tag | grep -q "day-11"
311112
## Resources
312113

313114
- [Docify Documentation](https://github.com/finos/architecture-as-code/tree/main/cli#docify)
314-
- [Handlebars Templates](https://handlebarsjs.com/guide/)
315-
- [CALM Template Examples](https://github.com/finos/architecture-as-code/tree/main/cli/test_fixtures/template)
316115

317116
## Tips
318117

319118
- Regenerate documentation after every architecture change
320-
- Use custom templates for different audiences (executives vs. developers)
321-
- Add documentation generation to CI/CD pipeline
322-
- Templates can access all CALM properties (nodes, relationships, flows, controls)
323-
- Use `--url-to-local-file-mapping` to make local file references clickable
119+
- Add documentation generation to CI/CD pipeline for always up-to-date docs
120+
- Deploy the generated website to your internal hosting for team access
121+
- The website works great for architecture reviews and stakeholder presentations
324122

325123
## Next Steps
326-
Tomorrow (Day 12) you'll use CALM as an expert architecture advisor to improve your e-commerce platform's resilience!
124+
Tomorrow (Day 12) you'll learn how to create custom documentation using calm-widgets - the building blocks that power this website!

0 commit comments

Comments
 (0)