Fast, flexible graph database for code relationships
A fast, reliable, and flexible graph database optimized for storing and querying code relationships, with production-ready language parsers for 16 languages — Python, Rust, TypeScript, Go, C/C++, Java, Kotlin, C#, PHP, Ruby, Swift, Tcl, Verilog, COBOL, Fortran.
The five-minute loop, explained
CodeGraph is a graph database for code relationships. This page shows what the ecosystem does, why the design constraints matter, and how to get to a first run.
Choose a parser
Pick from 16 language parsers that all implement the same CodeParser trait. Each parser extracts functions, classes, imports, and relationships into the same graph format.
Parse your codebase
Parse single files or entire directories. The parser walks the AST and populates the graph with nodes for every entity and edges for every relationship — calls, containment, inheritance, and more.
Query the graph
Retrieve nodes by ID (<1ms), walk neighbors (<10ms), find transitive dependencies, detect circular dependencies, or traverse call chains up to depth 5.
Export and analyze
Export graphs to DOT (Graphviz), JSON (D3.js), CSV, or RDF N-Triples. Build custom analysis tools on top of the extracted relationships.
What makes CodeGraph different from a normal graph database
A purpose-built graph database for code that combines persistence, performance, and a unified parser ecosystem.
Persistent Storage
Production-ready RocksDB backend with crash-safe write-ahead logging. Atomic batch operations ensure data integrity. Memory backend included for testing.
16 Language Parsers
Comprehensive coverage from Python to COBOL. All parsers implement a unified CodeParser trait with drop-in interchangeability.
Efficient Queries
Single node lookup at ~7ns (1000x better than the 1ms target). Neighbor queries at ~410ns-40us. BFS traversal at depth 5 completes in ~5ms.
1,300+ Tests
Comprehensive test coverage across all 18 crates. Test-driven development ensures reliability. If it is not tested, it is broken.
Zero Unsafe Code
Memory-safe by default. No global state, no automatic file scanning, no convention-over-configuration. Explicit error handling with no panics in library code.
Schema-less Properties
Flexible JSON properties on nodes and edges. Add arbitrary metadata to your code entities without predefined schemas or migrations.
16 production-ready language parsers
A unified parser API across all languages with standardized entity types, consistent error handling, and drop-in interchangeability.
| Crate | Version | Tests | Description |
|---|---|---|---|
| codegraph (core) | 0.2.0 | 124 | Graph database core |
| codegraph-parser-api | 0.2.1 | 23 | Unified parser trait and types |
| codegraph-python | 0.4.3 | 121 | Python parser |
| codegraph-typescript | 0.4.2 | 103 | TypeScript/JavaScript parser |
| codegraph-rust | 0.2.1 | 97 | Rust parser |
| codegraph-go | 0.1.6 | 73 | Go parser |
| codegraph-c | 0.1.4 | 160 | C parser (with kernel/EDA support) |
| codegraph-cpp | 0.2.2 | 40 | C++ parser |
| codegraph-java | 0.1.2 | 62 | Java parser |
| codegraph-kotlin | 0.1.2 | 60 | Kotlin parser |
| codegraph-csharp | 0.1.2 | 64 | C# parser |
| codegraph-php | 0.2.1 | 86 | PHP parser |
| codegraph-ruby | 0.2.1 | 51 | Ruby parser |
| codegraph-swift | 0.1.2 | 41 | Swift parser |
| codegraph-tcl | 0.1.1 | 58 | Tcl/SDC/UPF parser (with EDA support) |
| codegraph-verilog | 0.1.0 | 51 | SystemVerilog/Verilog parser |
| codegraph-cobol | 0.1.0 | 47 | COBOL parser |
| codegraph-fortran | 0.1.0 | 47 | Fortran parser |
Design philosophy
Four principles guide every design decision in the CodeGraph ecosystem.
Unified Parser API
All 16 language parsers implement the same CodeParser trait, providing consistent API across languages, standardized entity types, uniform error handling, and drop-in interchangeability.
Performance First
Single node lookup in ~7ns. Neighbor queries in ~410ns-40us. Graph traversal at depth 5 in ~5ms. 100K node graphs are practical and fast.
Test-Driven Development
1,300+ tests across the workspace covering every crate. From the core graph engine (124 tests) to language parsers like codegraph-c (160 tests) and codegraph-python (121 tests).
Zero Magic
No global state. No automatic file scanning. No convention-over-configuration. Explicit error handling with no panics in library code. Zero unsafe code. Persistence is primary with RocksDB backend and crash-safe write-ahead logging.
Performance targets you can count on
Every operation has a clear performance budget. Actual benchmarks consistently exceed targets.
What Is CodeGraph? How the Unified Parser Architecture Works
A clear explanation of what CodeGraph is, who built it, how the architecture works, and how to use it.
CodeGraph is a graph database purpose-built for code. Unlike general-purpose graph databases, CodeGraph understands code structure — it knows what a function is, what a class is, how imports work, and how files relate to each other. The ecosystem provides a complete solution for building code analysis tools: a persistent graph database, a unified parser API, and 16 production-ready language parsers.
The parser architecture follows a layered design: user tools sit on top of code helpers, which use the query builder, which talks to the core graph engine, which is backed by RocksDB. Each layer has well-defined boundaries, can be tested independently, and has minimal dependencies on upper layers.
The core graph stores nodes (representing code entities like functions, classes, files) and edges (representing relationships like calls, contains, imports). Both nodes and edges carry flexible JSON properties, so you can attach arbitrary metadata without schema migrations. The adjacency indexing provides O(1) neighbor lookups.
CodeGraph supports two backends: RocksDB for production use with crash-safe write-ahead logging, and an in-memory backend for testing. Batch operations on both nodes and edges are atomic.
Read the full README →How to go from reading about CodeGraph to using it
Add CodeGraph to your Cargo.toml and start parsing code in minutes.
Using the Complete Solution (Database + Parser)
Add dependencies
Add codegraph, codegraph-parser-api, and your chosen language parser to Cargo.toml.
Create parser and graph
Instantiate a parser (e.g. PythonParser::new()) and open or create a graph with CodeGraph::open().
Parse and query
Parse a file with parser.parse_file() or a directory with parser.parse_directory(). Query nodes, edges, and neighbors on the resulting graph.
Export and integrate
Export to DOT, JSON, CSV, or RDF formats for visualization or further analysis.
The fastest answers to the questions people ask first
Start here if you want the creator, the language support, the performance numbers, or the design philosophy without reading the whole README first.
Who created CodeGraph?
What languages does CodeGraph support?
CodeParser trait.What storage backends are supported?
How fast is it?
Is it safe to use in production?
What is out of scope?
Every claim on this page is grounded in the repository
All information is sourced from the official README, documentation, and crate metadata so you can verify the details yourself.
GitHub Repository
The source for the README, workspace structure, crate metadata, and quick-start examples.
github.com/anvanster/codegraph →Crates.io
Published crates including codegraph core, parser API, and all 16 language parsers.
crates.io/crates/codegraph →Documentation
Comprehensive docs generated from source code covering the API, traits, and architecture.
docs.rs/codegraph →