| Crates.io | rust-indexer |
| lib.rs | rust-indexer |
| version | 0.1.0 |
| created_at | 2025-08-09 07:55:05.941091+00 |
| updated_at | 2025-08-09 07:55:05.941091+00 |
| description | A command-line tool to analyze a Rust project's source code and populate a Neo4j graph database with its structure and relationships. |
| homepage | |
| repository | https://github.com/Jagoum/rust-indexer |
| max_upload_size | |
| id | 1787658 |
| size | 69,914 |
This is a command-line tool written in Rust to analyze a Rust project's source code and populate a Neo4j graph database with its structure and relationships. It allows you to query your codebase as a graph, enabling powerful analysis of dependencies, function calls, and type relationships.
This tool is designed to be multi-project aware. You can run it on several different codebases, and it will keep them separated within the same database, anchored by a top-level :Project node.
syn crate to parse Rust source files into an Abstract Syntax Tree for accurate analysis.:Project nodes to represent each codebase.:File nodes for every .rs source file.:Function, :Struct, and :Trait nodes.:CALLS, :INSTANTIATES, and :IMPLEMENTS.The indexer creates the following entities in your Neo4j database:
(:Project {name: String}): A top-level node for each indexed project.(:File {path: String}): Represents a single .rs file.(:Function {name: String, project: String}): A function definition.(:Struct {name: String, project: String}): A struct definition.(:Trait {name: String, project: String}): A trait definition.(:Project)-[:CONTAINS_FILE]->(:File)(:File)-[:CONTAINS]->(:Function | :Struct | :Trait)(:Function)-[:CALLS]->(:Function)(:Function)-[:INSTANTIATES]->(:Struct)(:Struct)-[:IMPLEMENTS]->(:Trait)rustc and cargo installed.The tool is configured via command-line arguments. However, for convenience, you can place database credentials in a .env file in the project root, and the tool will use them as a fallback if the corresponding command-line arguments are not provided.
Create a .env file in the root of this project:
# .env
# Neo4j Database Configuration
NEO4J_URI="bolt://localhost:7687"
NEO4J_USER="neo4j"
NEO4J_PASS="your_secret_password"
Run the indexer from the command line using cargo run. You must provide the path to the Rust project you wish to index.
The only required argument is --path. If your .env file is configured, this is all you need:
cargo run -- --path /path/to/your/rust/project
You can override the .env configuration by providing the database details as arguments.
cargo run -- \
--path /path/to/your/rust/project \
--uri bolt://your-neo4j-host:7687 \
--user my_user \
--password my_secret_password
To see a full list of all command-line options, run:
cargo run -- --help