How to Create Remote Team Architecture Documentation Using Diagrams as Code
The best approach for remote teams is using Mermaid or PlantUML to store diagrams as text files in your repository, enabling Git-based collaboration and eliminating merge conflicts that plague binary diagram tools. This guide shows you how to implement diagrams as code with practical examples, CI/CD integration strategies, and workflows that scale across time zones without requiring real-time synchronization.
Why Diagrams as Code for Remote Teams
Traditional diagramming tools create binary files that don’t merge well in version control. When team members across different time zones work on the same diagram, you encounter constant merge conflicts and lost changes. Diagrams as code treats your architecture drawings as plain text files that integrate smoothly with Git workflows.
The benefits extend beyond version control. Your diagrams become refactorable, testable, and reproducible. Teams can review diagram changes through pull requests, adding the same rigor to architecture decisions as code reviews.
For remote teams specifically, diagrams as code solves the asynchronous communication problem. Instead of scheduling a screen-share to walk colleagues through a whiteboard sketch, you commit a diagram file. Team members in different time zones can review it on their own schedule, leave comments inline, and suggest changes through standard pull request tooling.
Popular Diagrams as Code Tools
Several tools fit well for remote team documentation. Mermaid.js offers the lowest barrier to entry—it renders diagrams from text directly in Markdown files. PlantUML provides more advanced diagramming capabilities with enterprise features. Structurizr combines architecture diagrams with C4 model compliance.
For most remote teams, starting with Mermaid provides immediate value without additional tooling. You can embed diagrams directly in GitHub README files, Notion pages, or any Markdown-supporting platform.
Here is a quick comparison to help you choose:
| Tool | Hosting Required | Best For | Learning Curve |
|---|---|---|---|
| Mermaid.js | No (GitHub native) | Flowcharts, sequences, ERDs | Low |
| PlantUML | Yes (Java) | UML, complex enterprise diagrams | Medium |
| Structurizr | Yes (Docker/SaaS) | C4 model, architecture portfolios | High |
| D2 | No (CLI) | Modern syntax, auto-layout | Low |
Getting Started with Mermaid
Mermaid integrates directly with Markdown. Create a file named architecture.md and add your first diagram:
flowchart TD
A[Client] --> B[Load Balancer]
B --> C[API Gateway]
C --> D[Auth Service]
C --> E[Business Logic]
E --> F[Database]
E --> G[External API]
This flowchart renders automatically in platforms supporting Mermaid. The syntax reads like code—easy to write, review, and modify in pull requests.
Documenting Service Architecture
For microservices architectures, sequence diagrams clarify service interactions. Here’s how to document an API request flow:
sequenceDiagram
participant User
participant API as API Gateway
participant Auth as Auth Service
participant Order as Order Service
participant DB as Database
User->>API: POST /orders
API->>Auth: Validate Token
Auth->>API: Token Valid
API->>Order: Create Order
Order->>DB: INSERT order
DB->>Order: Order Created
Order->>API: Order Response
API->>User: 201 Created
This sequence diagram shows exactly how requests flow through your system. Remote team members can read the flow without needing a live demo or screen share.
Infrastructure Documentation
Document cloud infrastructure using deployment diagrams:
graph TB
subgraph AWS
subgraph VPC
subgraph Public Subnet
LB[Load Balancer]
end
subgraph Private Subnet
EC1[EC2 Instance 1]
EC2[EC2 Instance 2]
RDS[(RDS Database)]
end
end
end
LB --> EC1
LB --> EC2
EC1 --> RDS
EC2 --> RDS
Infrastructure diagrams in code enable Infrastructure as Code practices. When your Terraform changes, update the diagram to match—keeping documentation synchronized with reality.
C4 Model for Architecture Context
The C4 model provides a standardized approach to architecture documentation. Structurizr supports C4 through DSL:
workspace {
model {
person = person "User" "Uses the system"
softwareSystem = softwareSystem "E-Commerce Platform" "Online store"
container = container "Web App" "React SPA" "Serves pages"
containerAPI = container "API" "Node.js API" "Business logic"
containerDB = container "Database" "PostgreSQL" "Stores data"
person -> softwareSystem "Visits"
softwareSystem -> container "Delivers"
container -> containerAPI "API Calls"
containerAPI -> containerDB "Reads/Writes"
}
views {
systemContext softwareSystem "SystemContext" {
include *
autoLayout
}
container softwareSystem "Container" {
include *
autoLayout
}
}
}
Remote teams benefit from C4’s standardized levels. New team members start with the context diagram, then drill into containers and components as needed.
Git Workflow for Diagram Collaboration
Treat diagram files like source code in your workflow:
- Create a branch for diagram updates
- Write or modify diagram code in a feature branch
- Submit pull request with diagram changes
- Review changes like code—check accuracy and style
- Merge after approval
This workflow ensures architecture changes receive proper scrutiny. Teams often require diagram updates alongside code changes for new features.
A practical way to enforce this is adding a PR template checklist item: “Architecture diagram updated if this PR changes service boundaries or data flows.” That single line prevents documentation drift across a distributed team.
Embedding Diagrams in Documentation
Jekyll sites support Mermaid through plugins or CDN includes. Add this to your layout:
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true });
</script>
Your Markdown files then render diagrams automatically. This approach works with GitHub Pages, Netlify, or any static hosting.
For internal documentation wikis, Confluence has a Mermaid plugin. Notion renders Mermaid in code blocks natively. GitLab renders Mermaid inline. This broad platform support means your diagrams travel with your documentation regardless of where your team prefers to work.
Best Practices for Remote Teams
Maintain diagram quality across distributed teams by following these practices:
Keep diagrams small. Large diagrams become unreadable. Break complex systems into multiple smaller diagrams showing specific aspects.
Use consistent styling. Establish naming conventions, color schemes, and layout patterns. Consistent diagrams are easier to understand quickly.
Version diagrams with code. When services change, update diagrams in the same PR. This prevents documentation drift.
Write diagram descriptions. Add context explaining what the diagram shows and any assumptions. Future readers—including future you—will appreciate the clarity.
Review diagrams in PRs. Treat diagram changes as code reviews. Check for accuracy, clarity, and consistency with existing documentation.
Assign diagram ownership. For each major system area, designate a team member responsible for keeping diagrams current. Ownership prevents the tragedy of the commons where everyone assumes someone else will update the docs.
Automating Diagram Generation
For dynamic architectures, generate diagrams from code:
def generate_deployment_diagram(services):
mermaid = "graph TD\n"
for service in services:
mermaid += f' {service["name"]}[{service["label"]}]\n'
for dep in service.get('dependencies', []):
mermaid += f' {service["name"]} --> {dep}\n'
return mermaid
Automated generation keeps documentation synchronized with deployed services. Run generation as part of your CI pipeline to ensure diagrams always reflect current state.
You can extend this approach to generate diagrams from your infrastructure-as-code definitions. Parse Terraform output or Kubernetes manifests to produce topology diagrams automatically. When the infrastructure changes, the diagram updates on the next CI run without any manual intervention.
CI/CD Integration for Diagram Validation
Add a CI step to validate diagram syntax before merging:
# .github/workflows/validate-diagrams.yml
name: Validate Diagrams
on: [pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install mmdc
run: npm install -g @mermaid-js/mermaid-cli
- name: Validate all Mermaid diagrams
run: |
find docs -name "*.md" -exec grep -l "```mermaid" {} \; | while read f; do
mmdc -i "$f" -o /tmp/test.svg && echo "OK: $f" || echo "FAIL: $f"
done
This CI step catches syntax errors before they reach main. For remote teams where async review is the norm, automated validation reduces round-trip time on pull requests—reviewers don’t need to manually check that diagram syntax is valid.
Onboarding New Team Members with Diagrams
Architecture documentation built on diagrams as code becomes a self-service onboarding resource. New engineers can clone the repository and immediately see system topology without scheduling calls. A well-structured docs/architecture/ directory with a README explaining the C4 levels gives any new hire a path from high-level context to component detail.
Create an architecture tour document that links diagrams in sequence: start with the system context, move to containers, then highlight the two or three sequence diagrams that describe the most critical user flows. New team members across time zones can complete this tour independently in their first week.
Related Articles
- How to Create Remote Team Architecture Decision Record
- How to Create Remote Team Career Ladder Documentation for
- How to Create Remote Team Compliance Documentation
- Example: Find pages not modified in the last 180 days using
- Project Kickoff: [Project Name]
Built by theluckystrike — More at zovo.one