> For the complete documentation index, see [llms.txt](https://www.pranaypourkar.co.in/the-programmers-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pranaypourkar.co.in/the-programmers-guide/system-design/system-design-methodology/diagrams/uml-diagrams/plantuml/architecture-diagram.md).

# Architecture Diagram

## About

An **Architecture Diagram** represents the **high-level structure of a system**, including **components, services, and their interactions**. In a **Distributed System**, it shows how components communicate across multiple nodes.

{% hint style="success" %}
Refer to the official documentation for more details - <https://plantuml.com/archimate-diagram>
{% endhint %}

#### **Key Elements**

1. **Nodes (Servers, Databases, Clients)**&#x20;
   * Represent **physical or virtual machines** in the system.
2. **Microservices / Components**&#x20;
   * Logical groupings of **functional modules** (e.g., Authentication, API Gateway).
3. **Communication Protocols**&#x20;
   * Defines how components interact (e.g., REST, gRPC, Kafka).
4. **Load Balancers & Caches**&#x20;
   * Used for **scalability and performance optimization**.
5. **External Dependencies**&#x20;
   * Cloud services, third-party APIs, or message queues.

## 1. Web Application Deployment

This represents a **Web Application Deployment** with multiple nodes (web server, app server, database).

{% hint style="success" %}

* **Nodes (`node "Name" { }`)**: Represents physical/virtual machines.
* **Components (`[Component]`)**: Represents deployed components.
* **Connections (`-->`)**: Shows data flow.
  {% endhint %}

```plant-uml
@startuml
title Web Application Deployment

node "User" {
    [Browser]
}

node "Web Server" {
    [Nginx]
}

node "Application Server" {
    [Spring Boot App]
}

node "Database Server" {
    [PostgreSQL]
}

Browser --> Nginx : HTTP Request
Nginx --> "Spring Boot App" : Forward Request
"Spring Boot App" --> PostgreSQL : Query Data
PostgreSQL --> "Spring Boot App" : Return Data
"Spring Boot App" --> Browser : Render Response

@enduml
```

<figure><img src="/files/aiLPSczPayjjQRn1cihC" alt="" width="209"><figcaption></figcaption></figure>

## **2. Message Queue System**

This represents **a microservice-based messaging system using RabbitMQ**.

{% hint style="success" %}

* **Nodes representing services and message queues**.
* **Message flow (`-->`)**.
  {% endhint %}

```plant-uml
@startuml
title Message Queue System

node "Producer Service" {
    [Order Service]
}

node "Message Queue" {
    [RabbitMQ]
}

node "Consumer Services" {
    [Inventory Service]
    [Shipping Service]
}

"Order Service" --> "RabbitMQ" : Publish Order Event
"RabbitMQ" --> "Inventory Service" : Consume Order Event
"RabbitMQ" --> "Shipping Service" : Consume Order Event

@enduml
```

<figure><img src="/files/yFZn06aK3jitXn1choIe" alt="" width="236"><figcaption></figcaption></figure>

## **3. CI/CD Pipeline Diagram**

This represents **a GitHub Actions CI/CD pipeline for deploying a microservice**.

{% hint style="success" %}

* **Stages of CI/CD pipeline**.
* **Deployment flow (`-->`)**
  {% endhint %}

```plant-uml
@startuml
title CI/CD Pipeline - Microservice Deployment

node "Developer" {
    [Push Code]
}

node "CI/CD Server" {
    [GitHub Actions]
}

node "Cloud Deployment" {
    [Docker Build]
    [Deploy to Kubernetes]
}

"Push Code" --> "GitHub Actions" : Trigger Build
"GitHub Actions" --> "Docker Build" : Build Image
"Docker Build" --> "Deploy to Kubernetes" : Deploy

@enduml
```

<figure><img src="/files/esN1j7fpBwYWEFJ6Ll68" alt="" width="181"><figcaption></figcaption></figure>

## **4. Distributed System**

This represents **a distributed system with load balancing, microservices, and databases**.

```plant-uml
@startuml
title Distributed System Architecture

' User interacts with the system
node "User" {
    [Browser]
    [Mobile App]
}

' Entry point for requests
node "API Gateway" {
    [API gateway]
}

' Load Balancer for backend services
node "Load Balancer" {
    [Nginx]
}

' Backend Microservices
node "Backend Services" {
    [Auth Service]
    [Order Service]
    [Payment Service]
    [Notification Service]
}

' Databases for storing data
node "Databases" {
    [User DB]
    [Order DB]
    [Payment DB]
}

' Caching Layer
node "Cache" {
    [Redis]
}

' Message Queue System for async processing
node "Message Queue" {
    [Kafka]
}

' External Services
node "External APIs" {
    [Bank API]
    [Shipping API]
}

' Connections
Browser --> "API Gateway" : HTTP Request
"Mobile App" --> "API Gateway" : API Call
"API Gateway" --> Nginx : Route Request

Nginx --> "Auth Service" : Authenticate
"Auth Service" --> "User DB" : Fetch User Data
"Auth Service" --> Redis : Cache Token

Nginx --> "Order Service" : Process Order
"Order Service" --> "Order DB" : Save Order
"Order Service" --> "Message Queue" : Publish Event

Nginx --> "Payment Service" : Handle Payment
"Payment Service" --> "Payment DB" : Store Transaction
"Payment Service" --> "Bank API" : Validate Payment

"Message Queue" --> "Notification Service" : Order Update Event
"Notification Service" --> "External APIs" : Notify User

@enduml
```

<figure><img src="/files/RhlUy9VmrGo5qBljzajX" alt=""><figcaption></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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.pranaypourkar.co.in/the-programmers-guide/system-design/system-design-methodology/diagrams/uml-diagrams/plantuml/architecture-diagram.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
