Creating UML Diagrams in IntelliJ IDEA, PyCharm, and WebStorm
Software engineer and entrepreneur based in San Francisco.

Overview: UML Diagramming in JetBrains IDEs
JetBrains IDEs like IntelliJ IDEA Ultimate and PyCharm Professional provide built-in tools to generate UML class diagrams from source code. This relies on the "Diagrams" plugin, which is bundled and enabled by default in these editions. Community editions do not include this feature. WebStorm's diagramming is limited and does not provide full UML class diagram support for JavaScript/TypeScript.
1: Understanding Built-in UML Diagramming
JetBrains IDEs generate UML class diagrams from code. These are not general-purpose UML modeling tools and do not support designing diagrams before code ("model-first" means creating diagrams and generating code from them; JetBrains tools only generate diagrams from existing code).
1.1: What it is
The built-in UML diagramming tool generates Class Diagrams showing classes and their relationships (inheritance, dependencies) as found in your code. While the initial diagram provides a structural overview based on your source, you often need to use the diagram editor's tools to manage and populate the diagram with specific members (fields, methods) and refine connections to achieve a comprehensive view. It's a way to visualize and navigate your existing codebase rather than a design-first modeling tool.
1.2: Key Considerations
- Code-First: Diagrams reflect the current state of your code. Some refactoring (like renaming) can be performed from the diagram.
- Plugin: The "Diagrams" plugin must be enabled (Settings/Preferences > Plugins).
- Editions: Requires IntelliJ IDEA Ultimate or PyCharm Professional. WebStorm does not provide full UML class diagram support for JS/TS.
2: How to Generate UML Class Diagrams
The process for generating UML class diagrams is as follows:
2.1: IntelliJ IDEA (Java/Kotlin)
- Right-click a package, class, or multiple classes in the Project tool window.
- Select Diagrams > Show Diagram... (
Ctrl+Alt+Shift+U
on Windows/Linux,⌥⇧⌘U
on macOS). - If prompted, select Java Class Diagram.
- The diagram opens in a new editor tab.
2.2: PyCharm (Python)
- Right-click a Python file, class, or package in the Project tool window.
- Select Diagrams > Show Diagram....
- Select Python Class Diagram.
- The diagram opens in a new editor tab.
- PyCharm can also visualize database schemas (separate from UML class diagrams).
2.3: WebStorm and IntelliJ support for JavaScript/TypeScript
While WebStorm doesn't include built-in UML class diagram support for JavaScript/TypeScript, you can use the third-party plugin UML JavaScript and TypeScript to add this functionality to any IntelliJ IDE:
- Install the plugin from Settings/Preferences > Plugins > Marketplace
- Right-click a JavaScript/TypeScript file or directory in the Project tool window
- Select Diagrams > Show Diagram...
- Select JavaScript Class Diagram or TypeScript Class Diagram
- The diagram opens in a new editor tab
3: What Built-in UML Diagrams Can Do
3.1: Key Features and Capabilities
- Visualize classes, interfaces, enums, and their members (fields, methods) with visibility modifiers (requires interaction with diagram tools to display specific elements and set visibility levels).
- Show inheritance, implementation, and dependencies.
- Double-click to navigate to source code.
- Some refactorings (e.g., renaming) can be performed from the diagram.
- Toggle member visibility, filter by visibility, show/hide dependencies, rearrange layout.
- Export diagrams as images (PNG, SVG).
- Add classes to the diagram (press
Space
in the diagram editor). - Refine and manage the diagram by showing/hiding specific members, adjusting visibility levels, and manually adding or arranging elements and relationships using the diagram editor's context menu and toolbar.
- IntelliJ IDEA offers graph analysis features (focus on paths, measure node centrality).
4: Limitations of Built-in UML Tools
4.1: What to Keep in Mind
- Only visualizes existing code; not for model-first UML design.
- Only available in IntelliJ IDEA Ultimate and PyCharm Professional.
- Full built-in support is limited to Java, Kotlin, and Python. Support for other languages is available via plugins in the IntelliJ Marketplace.
- Large diagrams can be cluttered.
- Visual customization is limited.
5: Supported Languages for UML Diagramming
Support for UML class diagram generation:
5.1: Supported Languages
- Java: IntelliJ IDEA Ultimate
- Kotlin: IntelliJ IDEA Ultimate
- Python: PyCharm Professional
5.2: Not Supported or Limited
- JavaScript/TypeScript: WebStorm does not provide built-in UML class diagrams, but the UML JavaScript and TypeScript plugin adds this capability.
- Other languages: No built-in UML class diagram generation.
6: When to Look for Alternatives
If you need other UML diagram types or to design diagrams before code:
6.1: Dedicated UML Tools and Plugins
- Use dedicated UML tools for full modeling: Visual Paradigm, StarUML, Lucidchart, PlantUML, or draw.io (also sometimes referred to as diagrams.net).
- JetBrains Marketplace has plugins for additional diagram types and language support:
- UML JavaScript and TypeScript for JS/TS UML diagrams
- Other diagram plugins may be available for specific languages or diagram types
6.2: Tools for Automated Full Repository Diagramming
If your primary goal is to automatically generate comprehensive UML diagrams from an entire repository with minimal manual intervention, consider these types of tools:
- GitUML: A tool that generates UML diagrams from your Git repository. It is often free for public repositories and can be a quick way to visualize your codebase structure.
- Dedicated UML/Modeling Tools with Strong Reverse Engineering:
- Visual Paradigm: Offers robust reverse engineering features, allowing import of source code from various languages to generate detailed UML diagrams.
- Sparx Systems Enterprise Architect: A comprehensive modeling tool that can reverse engineer code from entire projects into UML models.
- StarUML: Supports reverse engineering from code to class diagrams for several languages.
- Static Analysis & Visualization Tools:
- SciTools Understand: A powerful code analysis tool that can generate various diagrams, including UML class diagrams, from large codebases.
- SourceTrail: While not exclusively UML, it provides interactive source code visualization that can help understand class structures and dependencies across a repository (Note: Development of SourceTrail has been discontinued, but it remains available). These tools are generally more specialized for in-depth code analysis and large-scale diagram generation than the built-in IDE features.
7: Easiest Ways to Generate Full UML Diagrams Today
Generating a full and detailed UML diagram often involves a combination of automated tools and manual refinement. The "easiest" way depends on your specific needs and the tools at your disposal. Here are some approaches across different environments, considering options with and without direct AI assistance:
7.1: In JetBrains IDEs (IntelliJ IDEA, PyCharm)
Without AI
- Built-in Diagrams (IntelliJ Ultimate, PyCharm Pro): As covered in section 2, use Diagrams > Show Diagram... (
Ctrl+Alt+Shift+U
or⌥⇧⌘U
). This provides an excellent starting point generated directly from your existing code. You'll then use the diagram editor tools to show specific members (fields, methods), adjust visibility, add notes, and refine relationships to build out the complete details. For many, this is the most integrated and straightforward approach. - Marketplace Plugins for Text-Based Diagrams: Install plugins for tools like PlantUML. This allows you to write UML diagrams using a simple text-based syntax, which the plugin then renders within the IDE. This method offers precise control and is great for versioning diagrams with your code.
- Language-Specific Plugins: The "UML JavaScript and TypeScript" plugin is a good example for adding specific UML capabilities for web projects.
With AI Assistance
- AI Coding Assistants (e.g., GitHub Copilot in JetBrains, JetBrains AI Assistant): While direct AI-driven UML generation into the graphical editor is still evolving, AI assistants are incredibly helpful:
- Generate Diagram-as-Code: Select a class or describe a set of interactions to your AI assistant and ask it to generate the PlantUML or Mermaid syntax. You can then paste this into a relevant file and use a PlantUML plugin (if installed) to visualize it.
- Explain Code: Ask the AI to explain complex classes, inheritance hierarchies, or relationships. This understanding can significantly speed up manual refinement of diagrams generated by the built-in tool or when creating text-based diagrams.
- Refine Diagrams: Describe what you want to see or change in a diagram, and the AI can suggest how to use the IDE's features or what PlantUML syntax to write.
7.2: In VS Code
Without AI
- PlantUML Extension: Install the official PlantUML extension. Write PlantUML syntax in
.plantuml
,.puml
, or Markdown files (using code fences), and the extension will render the diagram. This is a very popular and powerful method for creating version-controlled UML diagrams. - Mermaid Support: VS Code has excellent built-in Mermaid support in Markdown, and extensions like "Markdown Mermaid" or dedicated "Mermaid Editor" enhance this. Mermaid is often simpler for sequence or flow charts but also supports class diagrams effectively.
- Draw.io Integration: The "Draw.io Integration" extension lets you create and edit diagrams (including UML) directly within VS Code using the draw.io interface.
- Language-Specific Diagrammers: Search the VS Code Marketplace for extensions that might offer automated diagram generation from code for your specific language (e.g., Python call graphs, Java class visualizers).
With AI Assistance
- AI Coding Assistants (e.g., GitHub Copilot, Codeium, Figstack, Amazon CodeWhisperer):
- Generate PlantUML/Mermaid Code: This is a very effective use of AI in VS Code. Select a piece of code, or describe a system architecture, and ask the AI assistant to generate the PlantUML or Mermaid syntax for a class diagram, sequence diagram, etc. You can then paste this into the appropriate file or Markdown code fence for rendering.
- Explain Code for Manual Diagramming: Use the AI to get summaries of files, classes, and their interactions to accelerate manual diagramming using tools like the Draw.io extension or text-based approaches.
- Emerging AI Diagramming Extensions: The field is evolving rapidly. Keep an eye on the VS Code Marketplace for new extensions that explicitly use AI to generate or assist with UML diagrams directly from your codebase.
7.3: From a GitHub Repository (Online/Standalone Tools)
Without AI
- GitUML: As highlighted in section 6.2, this tool can generate diagrams directly from your Git repository. For public repositories, it's often free and can be one of the quickest ways to get an initial visualization of your codebase structure.
- Dedicated UML Tools with Repository Import: Tools like Visual Paradigm, StarUML, or Sparx Systems Enterprise Architect (mentioned in 6.2) can often clone or import code from a repository and offer more powerful reverse engineering capabilities to generate detailed diagrams.
- PlantUML + Scripting: Clone the repository locally. For more customized or large-scale diagram generation, you can write scripts (e.g., using Python, shell scripts) to parse your code and automatically generate PlantUML files. These can then be rendered using a PlantUML processor.
- Online Diagramming Tools (e.g., draw.io / diagrams.net, Lucidchart): Clone the repo, analyze the code structure, and then manually create diagrams. While manual, these tools are flexible and widely accessible.
With AI Assistance
- AI-Powered Code Analysis Platforms that Integrate with GitHub: Several online platforms are emerging that use AI to analyze entire repositories. They might offer UML-like diagrams, code visualizations, or generate documentation that aids in understanding structure:
- Search for terms like "AI code visualization GitHub" or "AI software architecture diagram GitHub" to find current tools. Some may directly output PlantUML or other diagram formats.
- GitUML (with potential AI features): Tools like GitUML may incorporate AI or advanced analytics to improve diagram generation and code understanding. Check their latest features.
- AI Assistants + Cloned Repository: Clone the repository to your local machine. Use an AI coding assistant within your preferred IDE (as described in sections 7.1 and 7.2) to analyze parts of the codebase and generate PlantUML/Mermaid syntax. This combines the power of local IDEs with AI for repository-wide understanding.
- Custom Scripts with LLM APIs: For advanced users, you can write scripts that use Large Language Model (LLM) APIs (like OpenAI's) to parse code from a cloned repository and generate diagram descriptions or PlantUML/Mermaid code.