Creating UML Diagrams in IntelliJ IDEA, PyCharm, and WebStorm
Software engineer and entrepreneur based in San Francisco.
Software engineer and entrepreneur based in San Francisco.
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.
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).
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.
The process for generating UML class diagrams is as follows:
Ctrl+Alt+Shift+U
on Windows/Linux, ⌥⇧⌘U
on macOS). - If prompted, select Java Class Diagram. -
The diagram opens in a new editor tab.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:
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).Support for UML class diagram generation:
If you need other UML diagram types or to design diagrams before code:
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.
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:
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..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).