Transform source code into a queryable knowledge graph for AI-assisted code analysis
Problem: Traditional code search (grep, ripgrep) can't answer relationship questions like "What components call this API?" or "What's the impact of changing this interface?"
Solution: Parse code into a Neo4j graph database where relationships are first-class citizens, enabling 50-100x faster complex queries and AI agents to understand code structure instantly.
# 1. Place code to analyze
# Put the codebase you want to analyze in: code_to_anlayze/
# Example: code_to_anlayze/your-project/
# 2. Install dependencies
pip install -r requirements.txt
# 3. Start Neo4j
docker run -d \
--name neo4j-code \
-p 7474:7474 -p 7688:7687 \
-e NEO4J_AUTH=neo4j/password \
neo4j:latest
# 4. Parse your codebase
python src/indexer/main.py --config your-project.yaml
# 5. Import to Neo4j
python tools/ultra_fast_neo4j_import.py --config your-project.yaml --bolt-parallel
# 6. Query your code
# Open http://localhost:7474 and run:
MATCH (c:ReactComponent)-[:RENDERS]->(e) RETURN c, e LIMIT 50
- Scans your TypeScript/React/PHP codebase
- Extracts symbols, relationships, and dependencies using Tree-sitter
- Stages data in SQLite for efficient processing
- Imports to Neo4j for graph queries
- Enables queries impossible with text search
- ✅ TypeScript/TSX (React, Next.js)
- ✅ JavaScript/JSX
- ✅ PHP (EspoCRM optimized)
- 🚧 Python (coming soon)
- 🚧 Java (coming soon)
Source Code → Tree-sitter Parser → SQLite Staging → Neo4j Import → Cypher Queries
- Indexer: Orchestrates parsing and symbol extraction
- Language Analyzers: Tree-sitter based parsers for each language
- Plugin System: Extensible framework-specific analysis (NextJS, etc.)
- Import Pipeline: High-performance Neo4j data loading
Query Type | grep/ripgrep | Neo4j | Improvement |
---|---|---|---|
Find components rendering Button | Failed | 24ms | ∞ |
Component dependency analysis | Not feasible | 50ms | N/A |
Circular import detection | Custom script | 30ms | 100x |
# Find unused React components
MATCH (c:ReactComponent)
WHERE NOT EXISTS(()-[:IMPORTS]->(c))
RETURN c.name, c.file_path
# Find API routes and their consumers
MATCH (api:APIRoute)<-[:CALLS*1..3]-(comp:ReactComponent)
RETURN api.name, collect(comp.name)
# Detect high-coupling components
MATCH (c:ReactComponent)
WITH c, COUNT {(c)-[:RENDERS|USES|CALLS]->()} as deps
WHERE deps > 15
RETURN c.name, deps ORDER BY deps DESC
- Architecture Overview
- Data Model Reference
- Configuration Guide
- Adding New Languages
- Performance Tuning
See CONTRIBUTING.md for development setup and guidelines.
MIT - See LICENSE for details.
Built with ❤️ for developers and AI agents who need to understand code relationships instantly.