A lightning fast automatic UML diagram generator that uses tree-sitter to parse source code and generate Mermaid class diagrams.
- Multi-language support: Rust, Java, JavaScript, TypeScript, C++, C#, Objective-C, Dart, and Kotlin.
- Single file analysis: Generate UML diagrams from individual source files.
- Repository-scale analysis: Process entire directories and merge diagrams across multiple files.
- Remote Analysis: Clone and analyze remote git repositories directly.
- Type resolution: Automatically resolves types across files in multi-file projects.
- Automatic language detection: Detects the programming language from file extensions.
cargo install auto-umlOr alternatively to build from source.
cargo install --git https://github.com/EthanDGee/Auto-UML.git# Analyze current directory (auto-detect language)
auto-uml
# Single file mode (language auto-detected)
auto-uml --source-code path/to/file.rs
# Analyze current directory with a specified language
auto-uml --lang <lang> (e.g rust)
# Directory mode (entire repository)
auto-uml --source-code path/to/project
# Remote git repository
auto-uml --git https://github.com/user/repo.git
# Specify destination (defaults to UML.md)
auto-uml --destination my_diagram.md
# Output raw Mermaid (without markdown code block)
auto-uml --no-mermaid| Flag | Description |
|---|---|
--list-languages |
List available programming languages |
-l, --lang <LANG> |
Programming language (optional, auto-detected if omitted) |
-s, --source-code <PATH> |
Path to the local source file or directory (defaults to current directory) |
--git <URL> |
Remote git repository URL to clone and analyze |
--no-mermaid |
Outputs raw Mermaid syntax without markdown code blocks |
-d, --destination <FILE> |
Write destination file [default: UML.md] |
| Language | Extensions |
|---|---|
| cpp | .cpp, .cc, .cxx, .hpp, .h |
| rust | .rs |
| java | .java |
| javascript | .js |
| typescript | .ts, .tsx |
| csharp | .cs |
| objective-c | .m, .h |
| dart | .dart |
| kotlin | .kt |
The tool generates Mermaid class diagrams. You can render them with:
- Mermaid Live Editor
- VS Code with Mermaid extension
- GitHub
- Parsing: Uses tree-sitter to build abstract syntax trees (AST) from source code.
- Extraction: Traverses the AST to extract classes, functions, methods, and variables using language specific config.
- Stitching: For multi-file projects, merges diagrams and resolves types across files to create one diagram.
- Generation: Outputs into a Mermaid.js class diagram.
Input (Rust):
struct User {
name: String,
email: String,
}
impl User {
fn new(name: String, email: String) -> User {
User { name, email }
}
fn greet(&self) -> String {
format!("Hello, {}!", self.name)
}
}Output (Mermaid):
classDiagram
class User {
+name: String
+email: String
+new(name: String, email: String) User
+greet() String
}
Auto-UML is designed from the ground up to be extremely fast. Since it works with a per-file LR representation that is merged recursively it can also work on extremely large code bases. Most code bases can be done in milliseconds with the larger ones taking seconds. Making it a great addition to your CI/CD pipeline or for personal use.
Disclaimer: All benchmarks were performed on the latest main branch as of June 22, 2026.
All of the following tests were done using hyperfine with 100 runs.
-
This Codebase - As is tradition for many analysis programs it is fitting that this program is used to analyze itself.
-
CoreUtils - A rust rewrite of the GNU core utils. As a result it is a rather large code base made up of 1280 files, 610 being rust with 233,223 lines of code total.
-
Chart.js - A popular JavaScript charting library. Contains approximately 200 JavaScript files totaling around 30,000 lines of code. Tests done using the JavaScript parser.
-
BuildCLI - A Java CLI framework. Contains approximately 150 Java files.
-
faker-cxx - A C++ fake data generator library. Contains approximately 400 C++ files.
-
authpass - A Flutter/Dart password manager. Contains approximately 500 Dart files.
-
jupyterlab - A large TypeScript project. Contains approximately 1,000 TypeScript files.
-
bitwarden-server - A large C# project. Contains approximately 1,500 C# files.
-
Platypus - An Objective-C macOS application. Contains approximately 30 Objective-C files.
-
ktlint - An anti-bikeshedding Kotlin linter with built-in formatter. Contains approximately 400 Kotlin files.
| Codebase | Language | Mean runtime | Standard Deviation | Min | Max |
|---|---|---|---|---|---|
| This Codebase | Rust | 12.4 ms | 2.3 ms | 7.9 ms | 20.1 ms |
| Chart.js | JavaScript | 211.3 ms | 12.6 ms | 190.8 ms | 258.9 ms |
| CoreUtils | Rust | 999.0 ms | 36.0 ms | 892.3 ms | 1184.1 ms |
| BuildCLI | Java | 75.1 ms | 2.5 ms | 70.6 ms | 83.0 ms |
| faker-cxx | C++ | 556.7 ms | 27.6 ms | 511.5 ms | 700.8 ms |
| authpass | Dart | 282.3 ms | 3.4 ms | 277.5 ms | 297.9 ms |
| jupyterlab | TypeScript | 1.197 s | 0.049 s | 1.120 s | 1.417 s |
| bitwarden-server | C# | 10.924 s | 0.729 s | 10.000 s | 14.733 s |
| Platypus | Objective-C | 110.5 ms | 2.7 ms | 105.5 ms | 120.4 ms |
| ktlint | Kotlin | 371.1 ms | 5.1 ms | 361.5 ms | 394.6 ms |