How to create a Technical Architecture from code with ChatGPT and PlantUML

Earlier, I used Mermaid for technical architectures. But PlantUML seems a better option for cloud architecture diagrams.

STEP 1: Copy the code

Here’s a one-liner using files-to-prompt to copy all files in the current directory:

fd | xargs uvx files-to-prompt --cxml | xclip -selection clipboard

Or, you can specify individual files:

uvx files-to-prompt --cxml README.md ... | xclip -selection clipboard

STEP 2: Extract the cloud icons

This script pulls icon macros for AWS, Azure, and GCP from PlantUML’s Standard Library into prompt-friendly files.

echo "' AWS icon macros. They all accept (e_alias, e_label, e_techn). Prefer including AWSPuml/[CATEGORY]/all.puml" > AWS.puml
echo '!define AWSPuml https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/refs/heads/main/dist' >> AWS.puml
curl https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/refs/heads/main/AWSSymbols.md \
  | grep -Po '\b[\w./-]+\.puml\b' \
  | sed 's/^/!includeurl AWSPuml\//' \
  >> AWS.puml

echo "' Azure icon macros. They all accept (e_alias, e_label, e_techn). Prefer including AzurePuml/[CATEGORY]/all.puml. Always include AzurePuml/AzureCommon.puml
" > Azure.puml
echo '!define AzurePuml https://raw.githubusercontent.com/plantuml-stdlib/Azure-PlantUML/master/dist' >> Azure.puml
curl https://raw.githubusercontent.com/plantuml-stdlib/Azure-PlantUML/refs/heads/master/AzureSymbols.md \
  | grep -Po '\b[\w./-]+\.puml\b' \
  | grep -v 'AzurePuml/' \
  | sed 's/^/!includeurl AzurePuml\//' \
  >> Azure.puml

echo "' GCP icon macros. They all accept (e_alias, e_label, e_techn). Prefer including GCPPuml/[CATEGORY]/all.puml. Always include GCPPuml/GCPCommon.puml
" > GCP.puml
echo '!define GCPPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-icons-GCP/refs/heads/master/dist' >> GCP.puml
curl https://raw.githubusercontent.com/Crashedmind/PlantUML-icons-GCP/refs/heads/master/Symbols.md \
  | grep -Po '\b[\w./-]+\.puml\b' \
  | sed 's/^/!includeurl GCPPuml\//' \
  >> GCP.puml

STEP 3: Prompt for a PlantUML diagram

PlantUML is a diagram markup language. I use this prompt with O4-Mini-High or O3:

Create a PlantUML component diagram to describe the technical architecture using the files below.
For EVERY cloud component use the icon macro ONLY from the provided list.

Then paste your copied code and the .puml for your cloud (e.g. Azure.puml).

Here is a sample conversation and the PlantUML output.

Leave a Comment

Your email address will not be published. Required fields are marked *