Back to blog

How to Write a Software Architecture Document (2026)

A practical template for writing software architecture documents (SAD) and architecture decision records (ADR). Includes structure, examples, and how AI diagrams fit in.

R
Ryan·Senior AI Engineer
·

A software architecture document (SAD) is a written record of a system's structural decisions — how components are organized, how they communicate, why key trade-offs were made, and what constraints the system operates under. Done well, an architecture document is the single artifact that accelerates onboarding, de-risks design reviews, satisfies compliance audits, and prevents future engineers from repeating past mistakes.

Done poorly — or not done at all — architecture documents become the reason new engineers spend their first month reverse-engineering a system from the source code, and why teams keep relitigating the same architectural decisions in every quarterly planning cycle.

What goes in a software architecture document?

The best architecture documents are opinionated and concise — not encyclopedic. A 5-page SAD that engineers actually read is worth more than a 50-page document that sits in Confluence untouched. Aim for these sections:

1. Executive summary (1 paragraph)

What does this system do? Who are its users? What problem does it solve? Written for a non-technical stakeholder who needs to understand scope without reading further.

2. System context (with diagram)

Show the system as a black box and its relationships to external actors: users, third-party services, upstream/downstream systems. This is the C4 model's Context diagram. It answers: "What is this system and what does it talk to?"

Prompt for a system context diagram:"C4 Context diagram for an e-commerce platform. Users: customers (web + mobile), merchants (admin dashboard), operations team (internal tools). External systems: Stripe (payments), SendGrid (email), Twilio (SMS), Google Analytics (tracking), Shopify (merchant data sync). The platform handles: product catalog, shopping cart, order management, inventory, fulfillment. Show the system as a single box with all users and external systems as actors connected by labeled arrows."

3. Container view (with diagram)

Zoom into the system and show the major deployable units: web app, API, background workers, databases, message queues. This is the C4 Container diagram. It answers: "What are the major components and how do they communicate?"

Prompt for a container diagram:"C4 Container diagram for the e-commerce platform: React SPA (Vercel), iOS app, Android app all talk to an API Gateway. API Gateway routes to: Product Service (Node.js), Order Service (Go), Inventory Service (Go), Notification Service (Python). Each service has its own PostgreSQL database. Services communicate async via Kafka topics. Redis shared cache. Elasticsearch for product search. Show each container with its technology label and the communication protocols (REST, gRPC, Kafka)."

4. Key architecture decisions (ADRs)

Architecture Decision Records (ADRs) document why the system is built the way it is. Each ADR should cover:

  • Title: ADR-001: Use PostgreSQL as primary datastore
  • Status: Accepted / Deprecated / Superseded by ADR-XXX
  • Context: Why was this decision necessary? What constraints existed?
  • Options considered: What alternatives were evaluated?
  • Decision: What was chosen and why?
  • Consequences: What does this decision make easier or harder?

Store ADRs as markdown files in the repository (e.g., docs/adr/001-postgres-primary-datastore.md) so they're versioned alongside the code they describe.

5. Quality attributes (non-functional requirements)

State the system's targets explicitly. Vague goals like "it should be fast and reliable" help no one. Concrete targets drive architectural choices:

  • Availability: 99.9% uptime (8.7 hours downtime/year allowed)
  • Performance: API P95 latency < 200ms at 1000 req/s
  • Scalability: support 10x current load with no architectural changes
  • Security: SOC 2 Type II compliant, data encrypted at rest and in transit
  • Recovery: RPO < 1 hour, RTO < 4 hours

6. Deployment architecture (with diagram)

Show how the software runs in production: which cloud, which services, network topology, scaling groups, multi-region setup. This is where AWS/Azure/GCP-specific diagrams belong — distinct from the logical architecture views above.

7. Known risks and open questions

Every architecture has weak points. Documenting them explicitly — rather than hiding them — prevents future engineers from being blindsided. "Single point of failure: Redis. If Redis goes down, the cart service fails. Mitigation: ElastiCache Multi-AZ. Priority: Q3."

How to keep an architecture document current

The #1 problem with architecture documents is that they go stale within months of being written. Three practices prevent this:

  • Diagrams as code — store Mermaid or draw.io XML in the repo, not screenshots. Diagrams in the repo get reviewed in PRs and updated alongside code changes. See diagram as code explained.
  • Regenerate, don't edit — when the architecture changes, regenerate the affected diagram from a prompt rather than trying to edit the existing one. AI makes regeneration cheap enough that "update the diagram" takes 2 minutes instead of 30.
  • Assign ownership — designate a specific engineer (usually the tech lead) responsible for keeping the SAD current. Without ownership, it silently rots.

Architecture document templates

Several well-established templates exist. Choose the one that fits your context:

  • C4 model — four levels (Context, Container, Component, Code). Best for software-heavy systems. Created by Simon Brown.
  • arc42 — 12-section template covering context, constraints, solution strategy, building block view, runtime view, deployment view, cross-cutting concepts, decisions, quality requirements, risks. Comprehensive for enterprise systems.
  • RFC (Request for Comments) — lightweight, decision-focused. Popular at tech companies for proposing and documenting significant changes. GitHub, Rust, and Ember all use RFC processes.
  • ADR (Architecture Decision Record) — single-decision format, not a whole-system view. Best used alongside C4 or arc42.

Frequently asked questions

What is a software architecture document?

A software architecture document (SAD) is a written record of a system's structural decisions: how it's organized, how components communicate, what trade-offs were made, and why. It typically includes diagrams, decision records, and quality attribute requirements.

What is the difference between a SAD and an ADR?

A Software Architecture Document (SAD) describes the entire system architecture. An Architecture Decision Record (ADR) documents a single architectural decision. ADRs are components of a SAD, not a replacement for it. Most teams maintain a SAD with system-wide views plus a collection of ADRs for individual decisions.

How long should a software architecture document be?

Target 3–10 pages for most systems. A document longer than 10 pages rarely gets read in full. Use diagrams to convey structure (a good diagram replaces 500 words of prose) and link to detailed ADRs for readers who need the full decision rationale.

What diagramming tool should I use for architecture documents?

For AI-generated first drafts, use ArchitectureDiagram.ai — describe your system in plain English and get a diagram in under a minute. Export as draw.io XML for further editing, or Mermaid for embedding directly in Confluence, Notion, or GitHub markdown files.

Try it

Generate the diagrams for your architecture document in ArchitectureDiagram.ai. See also: C4 model diagrams, how to document software architecture, diagram as code.

Ready to try it yourself?

Start Creating - Free