mkdir my-architecture
cd my-architecture
bausteinsicht init
Getting Started Tutorial
This tutorial walks you through the complete Bausteinsicht workflow in under 10 minutes.
Prerequisites
-
Bausteinsicht binary (build with
go build -o bausteinsicht ./cmd/bausteinsicht/) -
draw.io Desktop or VS Code draw.io extension
-
A text editor or IDE with JSON support (VS Code recommended)
Step 1: Initialize a Project
Create a new directory and initialize Bausteinsicht:
This creates four files:
| File | Purpose |
|---|---|
|
Your architecture model (source of truth) |
|
Generated draw.io diagram — open this in draw.io |
|
Visual style templates for element kinds |
|
Sync state file (commit to Git alongside the model) |
Step 2: Explore the Sample Model
Open architecture.jsonc in your editor. You’ll see a sample Online Shop architecture:
bausteinsicht validate
Output: Model is valid.
The model contains:
-
Elements: Customer (actor), Online Shop (system) with Frontend, REST API, and Database containers
-
Relationships: Customer uses Frontend, Frontend calls API, API reads/writes Database
-
Views: System Context, Container View, API Components
Step 3: Open the Diagram
Open architecture.drawio in draw.io. You’ll see three tabs (pages):
-
System Context — high-level view with Customer and Online Shop
-
Container View — internal structure of the Online Shop
-
API Components — components inside the REST API
New elements appear with a red dashed border as a visual marker. Drag them to arrange the layout.
Step 4: Add an Element via CLI
Add a new Email Service container to the Online Shop:
bausteinsicht add element \
--id emailservice \
--kind container \
--title "Email Service" \
--technology "Go" \
--parent onlineshop \
--description "Sends transactional emails to customers"
Output: Added element 'onlineshop.emailservice' (kind: container) to model.
Step 5: Add a Relationship
Connect the API to the new Email Service:
bausteinsicht add relationship \
--from onlineshop.api \
--to onlineshop.emailservice \
--label "sends emails" \
--kind uses
Output: Added relationship: onlineshop.api → onlineshop.emailservice (sends emails)
Step 6: Sync Model to Diagram
Run sync to update the draw.io diagram with the new element and relationship:
bausteinsicht sync
Output:
Forward (model → draw.io): 2 added, 0 updated, 0 deleted
Reload architecture.drawio in draw.io — the Email Service appears with a red dashed border.
Drag it into position inside the Online Shop boundary.
Step 7: Edit in draw.io (Reverse Sync)
Now try the other direction:
-
Open
architecture.drawioin draw.io -
Double-click the "Web Frontend" element
-
Change its title to "Web App"
-
Save the file
Run sync again:
bausteinsicht sync
Output:
Reverse (draw.io → model): 0 added, 1 updated, 0 deleted
Check architecture.jsonc — the title has been updated to "Web App".
Step 8: Validate the Model
After manual edits, validate the model:
bausteinsicht validate
If everything is correct: Model is valid.
For JSON output (useful for LLM integration):
bausteinsicht validate --format json
{
"valid": true,
"errors": []
}
Step 9: Watch Mode
For continuous synchronization while you work:
bausteinsicht watch
Output:
Watching architecture.jsonc and architecture.drawio...
Now edit either file — Bausteinsicht automatically syncs on save. Press Ctrl+C to stop.
Step 10: LLM Integration
All commands support --format json for machine-readable output:
# Add elements programmatically
bausteinsicht add element --id cache --kind container \
--title "Cache" --technology "Redis" --parent onlineshop \
--format json
# Validate and parse results
bausteinsicht validate --format json
# Sync and get structured summary
bausteinsicht sync --format json
This makes Bausteinsicht ideal for AI-assisted architecture work — an LLM can modify the model via CLI commands without parsing JSON directly.
Next Steps
-
Customize the template — Edit
template.drawioin draw.io to change colors, shapes, and sizes for your element kinds. See the Template Guide for details. -
Add custom element kinds — Define new kinds in
specification.elementsand add matching template shapes. -
Set up watch mode — Use
bausteinsicht watchduring development for automatic sync on every save. -
Export diagrams — Use
bausteinsicht exportto generate PNG/SVG images for documentation.
Command Reference
| Command | Description |
|---|---|
|
Initialize a new project with sample model and template |
|
Run one bidirectional sync cycle |
|
Validate model without syncing |
|
Continuously sync on file changes |
|
Add element to model (flags: |
|
Add relationship to model (flags: |
|
Export diagram views as PNG or SVG images (flags: |
Global Flags
| Flag | Description |
|---|---|
|
Output format (default: text) |
|
Path to model file (default: auto-detect) |
|
Path to template file |
|
Enable debug output |
|
Note
|
The --version flag is only available on the root command (bausteinsicht --version), not on subcommands.
|
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.