Fundamentals 8 min read

PlantUML Tutorial: Installation, Usage, Diagram Types, and Practical Example

This article introduces PlantUML, explains how to install its plugins for IDEs, demonstrates various diagram types such as activity, class, component, and sequence, and provides a practical code example for modeling authentication flows, making it a comprehensive guide for creating UML diagrams efficiently.

Top Architect
Top Architect
Top Architect
PlantUML Tutorial: Installation, Usage, Diagram Types, and Practical Example

Background

UML is essential for technical documentation, and creating sequence diagrams for ASPICE DD documents can be time‑consuming with traditional tools. PlantUML offers a fast, code‑like way to generate UML diagrams, supporting many diagram types and integrating with VSCode and IDEA.

PlantUML Installation

Search for the PlantUML plugin in IDEA, install it, and restart the IDE to start using the tool.

PlantUML Usage

Right‑click → New → PlantUML to create a new diagram file.

Supported Diagram Types

Activity Diagram: https://plantuml.com/activity-diagram-beta

Class Diagram: https://plantuml.com/class-diagram

Component Diagram: https://plantuml.com/component-diagram

Deployment Diagram: https://plantuml.com/deployment-diagram

Gantt Diagram: https://plantuml.com/gantt-diagram

Mind Map: https://plantuml.com/mindmap-diagram

Object Diagram: https://plantuml.com/zh/object-diagram

Sequence Diagram: https://plantuml.com/zh/sequence-diagram

State Diagram: https://plantuml.com/state-diagram

Use Case Diagram: https://plantuml.com/zh/use-case-diagram

Salt Wireframe Diagram: https://plantuml.com/zh/salt

WBS Diagram: https://plantuml.com/zh/wbs-diagram

YAML Diagram: https://plantuml.com/zh/yaml

Practical Example

The following PlantUML code models a typical authentication flow between a third‑party caller, an authentication center, and a business service:

@startuml
autonumber

第三方调用者 -> 认证中心: 采用携带车机账号(vin码)、signature签名、nonce随机字符串、APIKey、APISecret请求鉴权服务
认证中心  <--  第三方调用者: 返回Access_token、车机账号(vin码)以及Token有效期(expire_time)
第三方调用者 -> 业务接口服务: 请求的Header中携带Access_token、车机账号(vin码)以及签名signature进行业务请求,涉及自定义的签名算法

认证中心 -> 业务接口服务: 校验签名signature有效性(更新token过期时间)
业务接口服务  <-- 认证中心: 校验成功
业务接口服务 -> 第三方调用者:返回业务结果

@enduml

This example demonstrates how PlantUML can be used to clearly express sequence diagrams for complex interactions.

Conclusion

PlantUML provides a lightweight, code‑driven approach to creating a wide range of UML diagrams, integrates with popular IDEs, and helps improve documentation efficiency for software architects and developers.

code generationPlantUMLsoftware designUMLTutorialdiagram
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.