Cloud Native 8 min read

Auto‑Generate Microservice Architecture Diagrams with Qwen3‑Coder and PlantUML

This guide walks through using the Lingma VS Code plugin with the Qwen3‑Coder model to analyze a complex microservice project, generate PlantUML architecture diagrams, refine them, and produce detailed API documentation, illustrating each step with commands and prompts.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
Auto‑Generate Microservice Architecture Diagrams with Qwen3‑Coder and PlantUML

Purpose

Demonstrate using Lingma (LLM‑powered tool) to analyze a full‑stack microservice project, generate a PlantUML system architecture diagram and API documentation.

Prerequisites

Clone the sample repository:

git clone https://github.com/duffqiu/bookinfo.git

Install Visual Studio Code (download from https://code.visualstudio.com/).

Install the Lingma extension from the VS Code marketplace.

Install the PlantUML extension (or use the online PlantUML server at https://www.plantuml.com/plantuml/).

Workflow

Open the cloned bookinfo folder in VS Code.

Start Lingma in agent mode and select the model qwen3‑code .

Prompt the model to analyse the whole project and output a PlantUML description of the system architecture:

请详细分析下工程,并用plantuml给出系统架构图的描述

Lingma returns a .puml file.

Render the .puml file with the PlantUML extension to view the diagram.

Refine the diagram to keep only microservices and the data layer: 请只保留微服务和数据层 Generate a sequence diagram that shows interactions between microservices:

请用plantuml画出各个微服务交互的时序图,输出到文件action.uml

If the initial output omits version‑specific details for the reviews service, add them with:

需要增加描述不同的reviews版本的处理过程

Select a Java source file (e.g., ReviewsResource.java) as context and ask for an API specification:

请给这个文件创建接口文档

Sample API Documentation Produced for the reviews Service

# Reviews服务API文档
## 基础URL
http://reviews:9080

### 1. 健康检查
GET /health
响应: {"status":"Reviews is healthy"}   200 OK

### 2. 获取图书评论
GET /reviews/{productId}
路径参数: productId (int)
请求头: x-request-id, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags 等
响应示例:
{
  "id":"0",
  "podname":"reviews-v1-7b4f5bd5c-2xk9m",
  "clustername":"cluster-1",
  "reviews":[
    {"reviewer":"Reviewer1","text":"...","rating":{"stars":5,"color":"black"}},
    {"reviewer":"Reviewer2","text":"...","rating":{"stars":4,"color":"black"}}
  ]
}
说明:
- v1 不返回 rating
- v2 返回 rating,color 为 "black"
- v3 返回 rating,color 为 "red"(需设置 STAR_COLOR="red"、ENABLE_RATINGS="true"、SERVICE_VERSION="v3")

### 环境变量
ENABLE_RATINGS (bool)
STAR_COLOR (string, default "black")
SERVICES_DOMAIN, RATINGS_HOSTNAME, RATINGS_SERVICE_PORT, HOSTNAME, CLUSTER_NAME

### 方法概览
- getJsonResponse(productId, starsReviewer1, starsReviewer2) → String
- getRatings(productId, requestHeaders) → JsonObject
- health() → Response
- bookReviewsById(productId, requestHeaders) → Response

Key Points

The process is fully automated: Lingma reads the codebase, produces PlantUML files, and can generate Markdown API specs.

Model qwen3‑code understands Chinese prompts and returns syntactically correct PlantUML and Markdown.

Version‑specific behaviour of the reviews microservice is controlled by environment variables and can be captured by additional prompts.

All generated artifacts (architecture diagram, sequence diagram, API docs) can be rendered directly in VS Code using the PlantUML extension.

cloud-nativeMicroservicesPlantUMLArchitecture DiagramQwen3AI code analysis
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

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.