5 PlantUML Diagram Templates (Copy-Paste Ready)

puml.online

Same as the intro post — AI-assisted sample. The templates themselves are ready to run; feel free to rewrite the prose.

1. Sequence diagram

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
@startuml
title User login flow
actor User
participant "Frontend" as FE
participant "API Gateway" as GW
participant "Auth Service" as Auth
participant "User Service" as UserSvc

User -> FE: enter credentials
FE -> GW: POST /login
GW -> Auth: validate token
Auth -> UserSvc: query user
UserSvc --> Auth: return user data
Auth --> GW: token valid
GW --> FE: 200 OK + JWT
FE --> User: redirect home
@enduml

Tip: alias long participant names with as; -> is a solid arrow, --> is a dashed reply.

2. Class diagram

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
@startuml
class User {
-id: Long
-email: String
-createdAt: DateTime
+login(): boolean
+logout(): void
}

class Order {
-id: Long
-userId: Long
-total: BigDecimal
-status: OrderStatus
+pay(): void
+cancel(): void
}

User "1" --> "*" Order : places
Order ..> User : belongs to
@enduml

Tip: - / + / # mean private / public / protected; --> is association, <|-- inheritance, *-- composition, o-- aggregation, ..> dependency.

3. Usecase diagram

1
2
3
4
5
6
7
8
9
10
11
12
13
14
@startuml
left to right direction
actor "User" as U
actor "Admin" as A

rectangle System {
U --> (Browse products)
U --> (Place order)
U --> (View orders)
(Place order) ..> (Pay) : include
A --> (Manage products)
A --> (Process refunds)
}
@enduml

Tip: include means a mandatory sub-usecase, extend means an optional one.

4. State diagram

1
2
3
4
5
6
7
8
9
10
@startuml
title Order state machine
[*] --> PendingPayment : order created
PendingPayment --> Paid : payment ok
PendingPayment --> Cancelled : user cancel / timeout
Paid --> Shipped : merchant ships
Shipped --> Delivered : user confirms
Delivered --> [*]
Cancelled --> [*]
@enduml

Tip: use [*] for start/end states; add notes with note right of StateName : text.

5. Activity diagram

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
@startuml
title Article publish flow
start
:write draft;
:spell check;
if (passed?) then (yes)
:save draft;
:notify reviewer;
else (no)
:show errors;
stop
endif
:reviewer approves?;
if (approved?) then (yes)
:publish article;
else (no)
:send back;
stop
endif
stop
@enduml

Tip: if (...) then (...) else (...) endif is the branch construct; switch / while / repeat all exist.


How to preview these

  • This site’s online editor (coming soon): paste and preview live on the right
  • VSCode: install the PlantUML extension, press Alt+D to preview
  • CLI: plantuml -tpng diagram.puml produces a PNG

Need more templates (ER, component, mind map)? Leave a comment.

  • Title: 5 PlantUML Diagram Templates (Copy-Paste Ready)
  • Author: puml.online
  • Created at : 2026-07-15 16:35:00
  • Updated at : 2026-08-14 21:34:29
  • Link: https://puml.online/blog/plantuml-templates-en/
  • License: This work is licensed under CC BY-NC-SA 4.0.