PlantUML Basic Syntax Cheatsheet
1. Basic Diagram Structure
All diagrams must begin with @startuml and end with @enduml.
@startuml
' diagram content goes here
@enduml
2. Defining Participants & Actors
Use actor for external users and participant for system elements.
actor User
participant "LoginService" as LS
3. Message Arrows
Used in sequence diagrams. Arrows show direction of interaction.
User -> LS : login(username, password)
LS --> User : success/failure
4. Use Case Syntax
Use case diagrams show actor interactions with system functions.
actor Admin
usecase "Add Product" as UC1
Admin --> UC1
5. Class Syntax
Classes can contain attributes and methods. Use relationships to connect.
class Product {
+id: int
+name: string
+getPrice(): float
}
Product --> Category
6. Activity Diagram Elements
Use start, stop, and actions. Decision blocks use if/else/endif.
start
:Validate Input;
if (Valid?) then (yes)
:Process Order;
else (no)
:Show Error;
endif
stop
7. Component and Interface
Used in component diagrams to show software modules.
component "UI"
PlantUML Basic Syntax Cheatsheet
component "API"
UI --> API : calls REST endpoints
8. Common Relationships
Key symbols for inheritance, aggregation, dependency, etc.
A -- B : association
A <|-- B : inheritance
A *-- B : composition
A o-- B : aggregation
A ..> B : dependency