Black Friday race Join
General

Component diagram template

A web client, an API gateway and three backend services, wired together through named interfaces. Rename the parts to show how your own system is put together.

The Component diagram template

What is a component diagram?

A component diagram shows the large building blocks of a software system and the contracts between them. A component is a part you could replace as a unit: a service, a client app, a library. An interface is what one component offers and another one uses. The diagram deliberately leaves out classes, tables and servers.

The template draws a small web product. A Web client sits on top, an API gateway sits in the middle, and three services, Auth, Orders and Payments, sit together in a package named Backend services. Between them are four named interfaces.

The component diagram template: Web client above API gateway, and below them a package named Backend services holding Auth, Orders and Payments.
Requests enter at the top and work their way down into the package.

Components and the interfaces between them

Start at the top. Web client and API gateway are both components, each drawn as a box with the small component icon in its corner. Between them is a little circle labeled REST API.

The circle is an interface, and the two lines that meet it mean different things. The gateway provides the REST API: it promises to answer those calls. The Web client requires it: it cannot work without something on the other end. Because the two boxes meet only at the circle, either one can be rebuilt without touching the other, as long as the REST API stays the same.

The client depends on the interface, not on the gateway itself.

The package: grouping what belongs together

The large tabbed frame at the bottom is a package. It carries the name Backend services and holds Auth, Orders and Payments. A package is a boundary for people more than for code: it says these three are owned, deployed or reasoned about together.

Two interfaces sit just above the package’s top edge: Auth API and Orders API. Placing them at the border shows that they are the doors into the package. Payments has no door there. Its interface, Payments API, sits inside, between Orders and Payments, so only Orders can reach it.

Two interfaces face outward; the third stays inside the package.

Name every interface, and keep dependencies pointing one way

The example follows two habits worth copying. First, no line runs from box to box. Every connection passes through a named circle, so a reader always knows what is being used: the gateway calls the Auth API and the Orders API, not “the backend”.

Second, the dependencies all point down. The client needs the gateway, the gateway needs two services, and Orders needs Payments. Nothing lower down calls back up. When you add your own components, check for a loop. Two components that each require the other cannot be released or tested apart, and the diagram is the cheapest place to notice it.

The gateway reaches each service through that service’s own interface.

How to use the component diagram template

  1. Open it as a new board. Use this template puts a copy in your workspace. It is a Pro template, available on the Pro and Team plans.
  2. List your replaceable parts. Rename Web client, API gateway, Auth, Orders and Payments to the parts of your system that a team could rewrite alone. Aim for five to ten boxes.
  3. Draw the package lines. Move components in or out of Backend services, or duplicate the frame, so each package matches a team or a deployment.
  4. Label each circle with a real contract. Replace REST API and Payments API with the name your team already uses: an endpoint group, a message topic, a library.
  5. Read the lines for loops. Follow each dependency from the top. If you can return to where you started, split a component or add an interface.
Orders is the only component that uses the Payments API.

When a component diagram helps

Draw one when you plan a split into services, bring a new engineer into a codebase, or need to agree on who owns which contract. It answers the question “what are the parts and what do they promise each other?”

It does not show where things run. For servers, regions and networks, use a cloud architecture diagram. For a view that starts with users and outside systems, the C4 container diagram is close in spirit. For the classes inside a single component, switch to a UML class diagram. FlowDraw’s UML diagram maker covers the other diagram types.

Questions about the Component diagram template

What is the difference between a provided and a required interface?

A provided interface is a service the component offers to others. A required interface is one it needs from someone else. In the template the API gateway provides the REST API and the Web client requires it. One component can do both: Orders provides the Orders API and requires the Payments API.

How is a component diagram different from a class diagram?

A class diagram shows the code inside one part: classes, attributes, methods and inheritance. A component diagram stays one level up and shows whole parts and the interfaces between them. You would draw Orders as one box here and as twenty classes there.

How many components belong on one diagram?

Roughly five to twelve. Past that, readers stop following the lines. Group related components into a package, as the template does with Backend services, and draw a second diagram for the inside of any package that needs it.

Can I use it for a system that is not built from microservices?

Yes. Components are logical parts, not processes. A single application still has modules with boundaries, such as billing, search and notifications, and the interfaces between them are function calls or events instead of network requests.