> For the complete documentation index, see [llms.txt](https://specs.govstack.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://specs.govstack.global/implementation-playbook/development/implementation/design-architecture/5-b-system-architecture/5-b.3-create-component-diagram.md).

# 5-B.3 Create Component Diagram

The container diagram is a even further "zoomed-in" version of the [5-B.2 Create Container Diagram](/implementation-playbook/development/implementation/design-architecture/5-b-system-architecture/5-b.2-create-container-diagram.md#container-diagram) and shows the software architecture within a single container. You dont have to create this diagram for every container, usually it is done for containers that need to be custom-coded. This most prominently includes the frontend and backend containers as well as special components, like a batch component or an complicated adapter. A bounded context might also be implemented as its own component, if it isn't big enough to justify its own container.

Example Component Diagram:

<figure><img src="https://1561184959-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fu5bWcujHi8xQ0fq3b0rz%2Fuploads%2F9OOXgRkENFSrmDU1qage%2Fimage.png?alt=media&amp;token=e6b327c9-166f-433c-9490-d6da36a88e09" alt=""><figcaption><p>Adapted from https://c4model.com (CC BY 4.0). Changes made.</p></figcaption></figure>

Example Template:

<figure><img src="https://1561184959-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fu5bWcujHi8xQ0fq3b0rz%2Fuploads%2FXsh2lubUmfLZVnuAKsAu%2Fimage.png?alt=media&amp;token=200b41b7-d3f6-47c2-96f2-144ce48de435" alt=""><figcaption></figcaption></figure>

## Design Principles

* Modularity
  * Expanding on the ideas presented in [5-B.2 Create Container Diagram](/implementation-playbook/development/implementation/design-architecture/5-b-system-architecture/5-b.2-create-container-diagram.md#modular-design), a modular approach is also recommended within a container
  * Try to identify components and especially business components / domain components that encapsulate a specific area of concern
    * the data model is usually a good starting point informing you of areas of high cohesion
* Some commonly used design patterns for dealing with external systems include Adapter, Proxy & Facade (see [Software design pattern - Wikipedia](https://en.wikipedia.org/wiki/Software_design_pattern)).\ <br>

  <figure><img src="https://1561184959-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fu5bWcujHi8xQ0fq3b0rz%2Fuploads%2FEZDmgn0F6KoLirkjZIyM%2Fimage.png?alt=media&amp;token=49636953-1f29-4c6f-808d-bb29813e93ec" alt="" width="375"><figcaption><p>Adapted from a CC0 1.0 public-domain diagram (Wikimedia Commons). Changes were made.</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://specs.govstack.global/implementation-playbook/development/implementation/design-architecture/5-b-system-architecture/5-b.3-create-component-diagram.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
