DEV Community

Rushikesh Surve
Rushikesh Surve

Posted on

9

How to use Claude AI + draw.io to Create Architecture Diagrams for Projects

Introduction

In technical engineering projects, especially those involving software system designs, professional diagrams play a critical role in simplifying complexity and enhancing communication.

In this blog, I'll walk you through how I combine Claude AI with draw.io to create clean, structured, and visually appealing diagrams for complex codebases.

We’ll demonstrate using a slightly complex system:

βœ… Online Course Registration System (with Admin + Payment integration).


Why Visual Diagrams Are Essential for Engineers

  • πŸ“ˆ Improve project documentation quality
  • 🧠 Clarify system architecture and workflows
  • πŸ–ΌοΈ Impress during project evaluations, internships, and freelancing
  • πŸ› οΈ Save time during collaboration and debugging

Whether it’s API design, microservices, database flow, or user journey, good diagrams are crucial.


πŸ“‹ Problem Statement

Design a backend flow for an Online Course Registration System.

Key Components:

  • Student browses available courses
  • Admin manages courses
  • Student selects course β†’ payment gateway integration β†’ enrollment confirmation
  • Admin can approve or reject course creation requests
  • System should handle payment failure cases

πŸ›€οΈ Step-by-Step Walkthrough


Step 1: Write a Detailed System Description

Before jumping into tools, clearly understand what you want to visualize. Draft a logical description of how the system components interact. This involves:

  • Analyzing the source: For example, a source-code, pseudocode, or algorithm.
  • Writing a short description: Explain the logic or flow in simple language.
  • Identifying elements: Note down components like processes, inputs/outputs, functions, or actors that should be part of the diagram.

πŸ“Œ Tip: This step can be manual or done in collaboration with AI by summarizing the core logic of your code/process.

Description Example:

  1. Student browses available courses.
  2. Student selects a course β†’ proceeds to payment.
  3. System connects to Payment Gateway API.
  4. If payment is successful β†’ student enrollment confirmed.
  5. If payment fails β†’ show error and retry option.
  6. Admin manages course creation, edits, deletions.
  7. Admin can approve/reject newly created course entries.

Step 2: Ask Claude to Generate draw.io XML Code

Once you have the logical structure ready, use a detailed prompt to ask Claude AI to generate an XML-based diagram compatible with draw.io.
Claude AI is better at generating longer, cleaner code blocks compared to ChatGPT.

Example Claude Prompt:


β€œGenerate draw.io-compatible XML code for a system flow diagram of an Online Course Registration System.
Show entities like Student, Admin, Payment Gateway.
Include success/failure flows and Admin approval flows clearly.
Arrange elements logically and label all edges. The diagram should be visually appealing. The flow is like this-

  1. Student browses available courses.
  2. Student selects a course β†’ proceeds to payment.
  3. System connects to Payment Gateway API.
  4. If payment is successful β†’ student enrollment confirmed.
  5. If payment fails β†’ show error and retry option.
  6. Admin manages course creation, edits, deletions.
  7. Admin can approve/reject newly created course entries.”

🎯 Claude responds with a complete XML.

Claude’s output showing XML code

πŸ“Œ Tip: You can even provide entire source code, if it is single file. Claude will automatically figure out the flow of program.


Step 3: Create and Save the .drawio File

Steps:

  • Copy the XML output.
  • Open a text editor.
  • Paste XML content.
  • Save as: πŸ“ course_flow.drawio

Saving XML as a  raw `.drawio` endraw  file.

⚠️ Make sure to select All Files type when saving.


Step 4: Import into draw.io

There are two ways to do this:

1. Via Web App:

βœ… Your system diagram should now appear automatically!

Importing  raw `.drawio` endraw  file into draw.io

2. Via Desktop App: If you have the draw.io desktop application installed, simply open the file using it.


Step 5: Manual Adjustments for Visual Appeal

The imported diagram often needs cleanup for a professional look:

  • Align boxes horizontally and vertically
  • Color-code actors (Student, Admin, Payment Gateway)
  • Label edges (e.g., "If Payment Fails", "Admin Approves")
  • Use consistent shape sizing

After manually adjusting the layout

🎨 Design Tips:

  • Use different shapes for different entity types (rectangles for processes, diamonds for decisions).
  • Stick to 2–3 soft colors (sky blue, light green, soft grey).
  • Leave good spacing between elements.
  • Add a plain rectangle as a background, to enable appropriate exporting of complete image(as png/jpg etc).

Step 6: Export the Final Diagram

Once finalized:

  • File β†’ Export As β†’ PNG / PDF
  • Enable "Include a copy of my diagram" for backup.
  • Set high resolution for better quality.

Image description


🎯 Final Result

βœ… A professional system diagram ready for:

  • Project documentation
  • Presentations
  • Freelance portfolios
  • Technical blogs

⚠️ Notes on AI Limitations

  • Code Length: ChatGPT has a limit on how much XML code it can generate. For complex or very large diagrams, consider alternatives like Claude AI, which can handle longer outputs.

  • Split Diagrams: For large systems, divide the diagram into smaller parts and generate/import them separately.

  • Verification: Always cross-check the logic and flow; AI may introduce small inconsistencies.


Extra Bonus Tip: What to Do Next?

  • πŸ’¬ Add internal comments inside draw.io diagrams
  • πŸ”„ Use this workflow for ER diagrams, UMLs, flowcharts, API flows

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (2)

Collapse
 
prathamesh_chaughule_1455 profile image
PRATHAMESH CHAUGHULE β€’

Very useful guide! Loved the idea of combining Claude AI with draw.io for quick architecture diagrams.

Collapse
 
rushier profile image
Rushikesh Surve β€’

Thank you for appreciation!!❀️

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more