> ## Documentation Index
> Fetch the complete documentation index at: https://iso-topology.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture diagrams from code: an evidence-first workflow

> Turn repository evidence into an editable architecture diagram. Separate code analysis, architectural decisions, and rendering instead of assuming automatic reverse engineering.

You can use an agent to read a repository and author an architecture diagram, then use iso-topology to validate, edit and render that diagram. **iso-topology does not itself crawl a repository or infer its architecture.** Its input is a diagram document, not an arbitrary source-code directory.

This distinction matters when searching for an open-source code-to-architecture tool: rendering a supplied model, extracting dependencies and deciding what a diagram should communicate are different jobs. [Read in Chinese](https://iso-topology.mintlify.site/zh/guides/architecture-diagrams-from-code.md).

## Decide which question the diagram answers

Pick one view before collecting evidence:

| Reader's question | Evidence to inspect | Do not assume |
| - | - | - |
| What runs, and where? | Deployment manifests, service entry points, environment configuration | Every source package is a separately deployed service. |
| What handles a request? | Route registration, handlers, calls to storage or downstream clients | Every available client is used on this request path. |
| How is the code organized? | Module boundaries, imports, public interfaces, architecture tests | An import graph is a complete runtime architecture. |
| How does data move? | Producers, consumers, persistence calls and relevant configuration | A connection means both a synchronous call and asynchronous delivery. |

A useful first diagram might cover one request path or a few deployed components. Expanding it to every file usually adds detail without answering the original question.

## Keep an evidence note beside the diagram

Before drawing, record the source revision, the files inspected and the statements each file supports. A small Markdown table is enough:

```text theme={"system"}
Revision: <the commit you inspected>
View: request path for <one endpoint or operation>

Component or edge | Evidence path/symbol | Observation | Open question
<API -> store>    | <actual file:line>   | <actual call> | <unresolved config>
```

Replace the placeholders with real observations. Distinguish an implemented path from a configured deployment, and label proposed components as proposed. If the repository does not show an external system's internals, represent the boundary rather than inventing its implementation.

Keep this note outside the diagram DSL. A documentation convention is not an extra schema field, and adding arbitrary evidence fields to YAML can cause validation errors.

## Give an agent a bounded task

With an agent that has authorized access to the repository and the CLI or [MCP tools](https://iso-topology.mintlify.site/agent/MCP.md), adapt this task:

```text theme={"system"}
Create a diagram for this specific question: <question>.
Inspect the current repository and record its revision.
Identify the relevant components and relationships with file/symbol evidence.
List unresolved assumptions separately; do not invent services or edges.
Consult the running renderer's capabilities before authoring YAML.
Save one editable authoring file and a separate evidence note.
Validate the source, render it, and inspect labels and arrow directions.
Report what the code supports and what still needs human confirmation.
For later changes, read the latest authoring file before editing it.
```

The agent supplies code-reading and reasoning abilities. iso-topology supplies a diagram contract and drawing tools. Neither an attractive image nor a clean validation result proves that the inferred architecture is correct.

## Render the confirmed model

Start from the [first-scene guide](https://iso-topology.mintlify.site/getting-started/02-first-scene.md) or an existing [sample](https://iso-topology.mintlify.site/agent/SAMPLES.md). Give components stable IDs and define what arrows mean in the accompanying document. Once the model is saved as `architecture.yaml`, use:

```bash theme={"system"}
isotopo validate architecture.yaml
isotopo render architecture.yaml ./out
isotopo serve architecture.yaml
```

Inspect validation output before continuing: the CLI returns 0 for clean input, 2 for warnings and 3 for errors. Inspect `out/topology.svg` after rendering. The final command starts the local editor; parseable source edits save to the bound file. Render again when you want an updated published SVG.

For a language-independent example of the finished source-to-image workflow, use the [CI reference repository](https://github.com/NexusFox88/iso-topology-diagrams-example). It renders an authored model; it does not automatically extract that model from application code.

## Keep it current without inventing automatic synchronization

When code changes, update the evidence note and the affected diagram source in the same review. CI can regenerate the image from YAML, but this only synchronizes **diagram source to image**. It does not establish that application code and diagram source still agree.

Use a reviewer who understands the changed subsystem to check that relationship. Retain the source revision and unresolved questions so the next contributor can repeat the reasoning.

[Choose a diagram tool](https://iso-topology.mintlify.site/guides/open-source-architecture-diagram-tools.md) · [Agent handoff](https://iso-topology.mintlify.site/agent/workflow.md) · [Local rendering and data boundaries](https://iso-topology.mintlify.site/guides/local-rendering-and-data.md)

Need to distinguish applications from deployment instances? [Choose an architecture view](https://iso-topology.mintlify.site/guides/choose-architecture-view.md) before asking an agent to draw.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.