Software architecture diagrams, explained.
An architecture diagram shows the parts of a system and how they connect, so a new teammate, a reviewer or your future self can understand it without reading every file. This guide covers the main types, a worked example, how to draw one well, and which parts you can generate from the code.
What is a software architecture diagram?
A software architecture diagram is a picture of a system's structure: its parts, what each part is responsible for, and how they talk to each other. Boxes are parts, such as applications, services, databases or modules. Arrows are the connections between them, labelled with what flows along them.
One diagram cannot show everything. The useful ones pick an audience and one level of detail, and leave the rest to other diagrams.
Types of architecture diagrams
The C4 model is a common way to organise them: four levels of zoom, each its own diagram. The first three types below are its levels; the rest answer different questions.
System context diagram
The widest view. Your system is one box in the middle, surrounded by the people who use it and the other systems it depends on, such as a payment provider or an email service. Anyone in the company should be able to read it.
Container or application architecture diagram
One level in. It shows the applications and data stores inside the system, such as a web front end, an API, a background worker and a database, and how they communicate. This is the diagram most teams mean by "our architecture".
Component diagram
Inside one application: its main modules or services and their dependencies, such as the order service, the payment module and the repository that writes to the database.
Deployment diagram
Where everything runs: servers, containers, cloud services, regions and the network between them. It answers operations questions rather than design ones.
Data flow and sequence diagrams
A data flow diagram follows data through the system. A sequence diagram shows the order of calls for one scenario, such as signing in. Both describe behaviour rather than structure, so they sit well beside the structural diagrams above.
Conceptual, logical and physical diagrams
- A conceptual diagram shows what the system does for the business, in terms anyone understands: customers, orders, payments. No technology.
- A logical diagram shows the parts and their responsibilities, still without naming technologies: an order service, a payment service, an order store.
- A physical diagram names the real things: a Next.js app on Vercel, a Node.js API, PostgreSQL, Stripe.
An example
Here is the container level of a small online shop, written in Mermaid so it can live in the repository and change with the code. GitHub, GitLab and most documentation tools render Mermaid as a diagram.
flowchart LR
customer([Customer]) -->|browses, orders| web[Web app<br/>Next.js]
web -->|JSON over HTTPS| api[API<br/>Node.js]
api -->|reads and writes| db[(Orders database<br/>PostgreSQL)]
api -->|charges cards| stripe[Stripe]
api -->|queues emails| worker[Email worker]
worker -->|sends| email[Email service]The system context version of the same shop would have only three boxes: the customer, the shop, and the outside services it uses. A component diagram would open up the API box.
How to draw a good one
- Decide who it is for. A diagram for a new engineer and one for a security review need different detail.
- Keep one level per diagram. Mixing services and individual classes on one page makes both unreadable.
- Name boxes by what they do, and add the technology underneath when it matters.
- Label every arrow with what flows along it and, where it helps, how: HTTP, a queue, a database query.
- Add a title and a key if you use colours or shapes to mean something.
- Keep it where the code is, as diagrams as code, so it gets updated in the same pull request as the change.
Tools for drawing architecture diagrams
- Whiteboard-style editors: draw.io (diagrams.net), Excalidraw and Lucidchart. Fast for a first sketch.
- Diagrams as code: Mermaid and PlantUML turn text into a diagram, so it can be reviewed and versioned with the code.
- Structurizr: a tool built around the C4 model, where one model of the system produces every level of diagram.
The catch
Every drawn diagram is only as current as the last person who updated it. Most architecture diagrams in a repo are out of date within months, because nobody's change requires touching them.
Generating the parts that live in the code
The component and code levels can be generated instead of drawn, because the code already says what depends on what. A generated view cannot go stale.
Nodeway is a desktop app, free to start, that builds that view of a repository on your own computer. It maps packages and folders down to functions and components, with the imports and calls between them, the routes requests arrive at and the database tables the code reads and writes. You can trace one request from its route to its tables, which is the sequence diagram for that request, drawn from the real code.

It does not draw deployment or cloud diagrams, or the business context around the system; those still belong in a drawn diagram. To read what it does draw, see the guides on dependency graphs and call graphs, or what the code map shows.
Questions
What should a software architecture diagram include?
The parts of the system, what each one is responsible for, and how they talk to each other: the arrows, labelled with what flows along them. Add a title, a key for any colours or shapes, and keep each diagram at one level of detail.
What is the C4 model?
A way of drawing software architecture at four levels of zoom, created by Simon Brown: system context, containers, components and code. Each level is its own diagram, so a reader can start wide and zoom in.
What is the difference between a system and an application architecture diagram?
A system architecture diagram shows the whole system and what is around it: users, other systems, and the main parts. An application architecture diagram zooms into one application and shows its services, data stores and how they connect.
Can you generate an architecture diagram from code?
The parts of the architecture that live in the code can be: modules, components, the calls between them, routes and database tables. Deployment, infrastructure and the business context still need drawing, because they are not in the source.