Component Diagrams
A Component Diagram shows the physical components of a system, their interfaces, and the dependencies between them. Components are modular, replaceable units of the system that encapsulate their contents and whose behavior is defined through provided and required interfaces.
Component Diagram Notation:
Component:
ββββββββββββββββββββββββββ
β Β«componentΒ» β
β ComponentName β
ββββββββββββββββββββββββββ€
β β
ββββββββββββββββββββββββββ
Provided Interface (lollipop):
βββββββββ
"This component provides this interface"
Required Interface (socket):
βββββββββ
"This component needs this interface"
Port:
ββββββββββββββββββββββββββ
β [P]ββββββββ β
β Component β
β [P]ββββββββββ
ββββββββββββββββββββββββββ
Example: Web Application Components
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Β«componentΒ» β
β Web Application β
β β
β βββββββββββββββββ βββββββββββββββββ β
β β Β«componentΒ» β β Β«componentΒ» β β
β β Frontend ββββββΆβ API Gateway β β
β β (React SPA) β β (Express.js) β β
β βββββββββββββββββ βββββββββ¬ββββββββ β
β β β
β βββββββββββββΌββββββββββββ β
β βΌ βΌ βΌ β
β ββββββββββββββββ ββββββββββββββββ ββββββββββ β
β β Β«componentΒ» β β Β«componentΒ» β βΒ«compΒ» β β
β β Order Serviceβ β User Service β β Paymentβ β
β β (Node.js) β β (Node.js) β βService β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ βββββ¬βββββ β
β β β β β
β ββββββββββββββββββΌββββββββββββββ β
β βΌ β
β ββββββββββββββββββββββββ β
β β Β«componentΒ» β β
β β Database (PostgreSQL) β β
β ββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Interfaces:
Order Service provides: OrderAPI
Order Service requires: Database, MessageQueue
User Service provides: UserAPI
User Service requires: Database, EmailService
Payment Service provides: PaymentAPI
Payment Service requires: PaymentGateway, Database
Deployment Diagrams
A Deployment Diagram shows how software components are deployed on hardware (nodes). It models the physical architecture of the system β servers, devices, and how software maps to them.
Deployment Diagram Notation:
Node (3D box):
ββββββββββββββββββββββββββ
β Β«deviceΒ» β
β ServerName β
ββββββββββββββββββββββββββ€
β β
ββββββββββββββββββββββββββ
Artifact (rectangle with document icon):
ββββββββββββββββββββββββββ
β Β«artifactΒ» β
β app.js β
ββββββββββββββββββββββββββ
Communication Path:
NodeA ββββββββββββββββ NodeB
Shows how nodes are connected
Example: Cloud Deployment
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Β«deviceΒ» β
β Client Device (Browser) β
β ββββββββββββββββββββββββββ β
β β Β«artifactΒ» β β
β β React SPA Bundle β β
β ββββββββββββββββββββββββββ β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ
β HTTPS
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Β«deviceΒ» β
β Load Balancer (nginx) β
β ββββββββββββββββββββββββββ β
β β Β«artifactΒ» β β
β β nginx.conf β β
β ββββββββββββββββββββββββββ β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ
β HTTP
βββββββββββ΄ββββββββββ
βΌ βΌ
ββββββββββββββββββββββββ ββββββββββββββββββββββββ
β Β«deviceΒ» β β Β«deviceΒ» β
β Web Server 1 β β Web Server 2 β
β (AWS EC2) β β (AWS EC2) β
β β β β
β ββββββββββββββββββ β β ββββββββββββββββββ β
β β Β«artifactΒ» β β β β Β«artifactΒ» β β
β β Node.js App β β β β Node.js App β β
β ββββββββββββββββββ β β ββββββββββββββββββ β
ββββββββββββ¬ββββββββββββ ββββββββββββ¬ββββββββββββ
β β
ββββββββββββββ¬ββββββββββββ
β
βββββββββββ΄ββββββββββ
βΌ βΌ
ββββββββββββββββββββββββ ββββββββββββββββββββββββ
β Β«deviceΒ» β β Β«deviceΒ» β
β App Server 1 β β App Server 2 β
β (AWS EC2) β β (AWS EC2) β
β ββββββββββββββββββ β β ββββββββββββββββββ β
β β Β«artifactΒ» β β β β Β«artifactΒ» β β
β β API Server β β β β API Server β β
β ββββββββββββββββββ β β ββββββββββββββββββ β
ββββββββββββ¬ββββββββββββ ββββββββββββ¬ββββββββββββ
β β
ββββββββββββββ¬ββββββββββββ
β
βββββββββββ΄ββββββββββ
βΌ βΌ
ββββββββββββββββββββββββ ββββββββββββββββββββββββ
β Β«deviceΒ» β β Β«deviceΒ» β
β Database Server β β Cache Server β
β (AWS RDS) β β (Redis) β
β ββββββββββββββββββ β β ββββββββββββββββββ β
β β Β«artifactΒ» β β β β Β«artifactΒ» β β
β β PostgreSQL β β β β Redis β β
β ββββββββββββββββββ β β ββββββββββββββββββ β
ββββββββββββββββββββββββ ββββββββββββββββββββββββ
When to Use Each Diagram
Component Diagrams β Use When:
β Showing the major building blocks of the system
β Documenting system architecture for new team members
β Planning which components to develop or replace
β Identifying interface contracts between teams
Deployment Diagrams β Use When:
β Planning infrastructure and hosting
β Documenting production environment
β Showing redundancy and failover architecture
β Planning scaling strategies
Both Diagrams Together:
β’ Component diagram = what software pieces exist
β’ Deployment diagram = where they run
β’ Together = complete picture of the physical system