Expand description
§codegraph
A fast, reliable, and flexible graph database optimized for storing and querying code relationships.
§Core Principles
- Parser Agnostic: Bring your own parser, we handle the graph
- Performance First: Sub-100ms queries for responsive tooling
- Test-Driven: Comprehensive test coverage ensures reliability
- Zero Magic: Explicit over implicit, always
- Persistence Primary: Durable storage with RocksDB
§Architecture
codegraph is organized in layers:
User Tools (parsers, analysis)
↓
Code Helpers (convenience API)
↓
Query Builder (fluent interface)
↓
Core Graph (nodes, edges, algorithms)
↓
Storage Backend (RocksDB, memory)§Example
use codegraph::{CodeGraph, helpers};
use std::path::Path;
// Explicit graph creation with persistent storage
let mut graph = CodeGraph::open(Path::new("./my_project.graph")).unwrap();
// Explicitly add a file to the graph using helper functions
let file_id = helpers::add_file(&mut graph, "main.rs", "rust").unwrap();
// Users explicitly parse and add entities (no magic scanning)
// Parser integration is up to the userRe-exports§
pub use error::GraphError;pub use error::Result;pub use graph::CodeGraph;pub use graph::Direction;pub use graph::Edge;pub use graph::EdgeId;pub use graph::EdgeType;pub use graph::Node;pub use graph::NodeId;pub use graph::NodeType;pub use graph::PropertyMap;pub use graph::PropertyValue;pub use query::QueryBuilder;pub use storage::MemoryBackend;pub use storage::RocksDBBackend;pub use storage::StorageBackend;
Modules§
- error
- Error types for codegraph operations.
- export
- Export module for visualizing and analyzing graphs in external tools.
- graph
- Core graph types and operations.
- helpers
- Convenience helpers for common code entities and relationships.
- query
- Query builder for fluent graph queries.
- storage
- Storage backend abstractions and implementations.