Skip to content

Commit 23fdaf1

Browse files
falkordb support added
1 parent a355f5e commit 23fdaf1

12 files changed

Lines changed: 1144 additions & 38 deletions

File tree

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,10 @@ devfile.yaml
4747
javascript.py.bak
4848
src/codegraphcontext/cli/nl.py
4949
*.bak
50+
51+
# temporary files
52+
*.temp
53+
*.tmp
54+
*.log
55+
tempor
56+
codegraph_viz.html

README_LITE.md

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
# CodeGraphContext - Lite Version (FalkorDB)
2+
3+
This is the **lite version** of CodeGraphContext that uses **FalkorDB Lite** instead of Neo4j, eliminating the need for external database server setup!
4+
5+
## What's Different?
6+
7+
### Standard Version (Neo4j)
8+
- ❌ Requires Docker or Neo4j server installation
9+
- ❌ Requires configuration (URI, username, password)
10+
- ❌ Needs port management (7474, 7687)
11+
- ✅ Suitable for production deployments
12+
- ✅ Better for large-scale projects
13+
14+
### Lite Version (FalkorDB Lite)
15+
-**Zero setup** - just install and run!
16+
-**Embedded database** - no external server needed
17+
-**Automatic persistence** - data saved to local file
18+
-**Same Cypher queries** - compatible query language
19+
-**Perfect for development** and personal projects
20+
-**Portable** - database is just a file
21+
22+
## Installation
23+
24+
### Quick Start (Recommended)
25+
26+
```bash
27+
# Install the lite version with FalkorDB
28+
pip install codegraphcontext[lite]
29+
```
30+
31+
That's it! No Docker, no server setup, no configuration files needed.
32+
33+
### Manual Installation
34+
35+
```bash
36+
# Clone the repository
37+
git clone https://github.com/Shashankss1205/CodeGraphContext.git
38+
cd CodeGraphContext
39+
40+
# Checkout the lite-version branch
41+
git checkout lite-version
42+
43+
# Install with lite dependencies
44+
pip install -e ".[lite]"
45+
```
46+
47+
## Usage
48+
49+
### 1. Start the Server
50+
51+
```bash
52+
# The lite version uses FalkorDB by default
53+
cgc start
54+
```
55+
56+
The database will be automatically created at `~/.codegraphcontext/falkordb.db`
57+
58+
### 2. Configure Your AI Assistant
59+
60+
Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
61+
62+
```json
63+
{
64+
"mcpServers": {
65+
"codegraphcontext": {
66+
"command": "cgc",
67+
"args": ["start"]
68+
}
69+
}
70+
}
71+
```
72+
73+
### 3. Start Using!
74+
75+
In Claude Desktop, you can now:
76+
- "Index the code in /path/to/my/project"
77+
- "Find all functions that call process_data"
78+
- "Show me the class hierarchy for User"
79+
- "What are the most complex functions?"
80+
81+
## Configuration
82+
83+
### Database Location
84+
85+
By default, the database is stored at `~/.codegraphcontext/falkordb.db`. You can change this:
86+
87+
```bash
88+
export FALKORDB_PATH="/path/to/your/database.db"
89+
cgc start
90+
```
91+
92+
### Graph Name
93+
94+
The default graph name is `codegraph`. To change it:
95+
96+
```bash
97+
export FALKORDB_GRAPH_NAME="mygraph"
98+
cgc start
99+
```
100+
101+
### Switching Between Neo4j and FalkorDB
102+
103+
You can switch database backends using the `DATABASE_TYPE` environment variable:
104+
105+
```bash
106+
# Use FalkorDB Lite (default for lite-version branch)
107+
export DATABASE_TYPE=falkordb
108+
cgc start
109+
110+
# Use Neo4j (requires Neo4j server setup)
111+
export DATABASE_TYPE=neo4j
112+
export NEO4J_URI=bolt://localhost:7687
113+
export NEO4J_USERNAME=neo4j
114+
export NEO4J_PASSWORD=your_password
115+
cgc start
116+
```
117+
118+
## Features
119+
120+
All the same features as the standard version:
121+
122+
**Multi-language support**: Python, JavaScript, TypeScript, Java, Go, C, C++, C#, Rust, Ruby
123+
**Code indexing**: Functions, classes, variables, imports
124+
**Relationship tracking**: Calls, inheritance, imports
125+
**Live watching**: Auto-update graph on file changes
126+
**Package discovery**: Auto-find and index dependencies
127+
**Complexity analysis**: Cyclomatic complexity calculation
128+
**Dead code detection**: Find unused functions
129+
**Cypher queries**: Full graph query support
130+
131+
## Advantages of Lite Version
132+
133+
### 1. **Zero Configuration**
134+
```bash
135+
pip install codegraphcontext[lite]
136+
cgc start
137+
# That's it! 🎉
138+
```
139+
140+
### 2. **Portable**
141+
Your entire code graph is in a single file. Easy to:
142+
- Backup
143+
- Share with team members
144+
- Move between machines
145+
- Version control (if small enough)
146+
147+
### 3. **No Resource Overhead**
148+
- No Docker containers
149+
- No background services
150+
- No port conflicts
151+
- Minimal memory footprint
152+
153+
### 4. **Perfect for Development**
154+
- Quick prototyping
155+
- Personal projects
156+
- Learning and experimentation
157+
- CI/CD pipelines
158+
159+
## Limitations
160+
161+
- **Performance**: For very large codebases (>100K files), Neo4j may be faster
162+
- **Concurrent Access**: FalkorDB Lite is single-process (fine for MCP use case)
163+
- **Advanced Features**: Some Neo4j-specific features may not be available
164+
165+
## Migration
166+
167+
### From Neo4j to FalkorDB Lite
168+
169+
1. Export your Neo4j data (optional - if you want to keep it)
170+
2. Switch to lite version:
171+
```bash
172+
git checkout lite-version
173+
pip install -e ".[lite]"
174+
```
175+
3. Re-index your code:
176+
```bash
177+
cgc start
178+
# Then in Claude: "Index the code in /path/to/project"
179+
```
180+
181+
### From FalkorDB Lite to Neo4j
182+
183+
1. Set up Neo4j server (Docker or standalone)
184+
2. Configure environment variables:
185+
```bash
186+
export DATABASE_TYPE=neo4j
187+
export NEO4J_URI=bolt://localhost:7687
188+
export NEO4J_USERNAME=neo4j
189+
export NEO4J_PASSWORD=your_password
190+
```
191+
3. Re-index your code
192+
193+
## Troubleshooting
194+
195+
### "FalkorDB Lite is not installed"
196+
197+
```bash
198+
pip install falkordblite
199+
```
200+
201+
### Database file permissions
202+
203+
Ensure you have write permissions to the database directory:
204+
```bash
205+
chmod 755 ~/.codegraphcontext
206+
```
207+
208+
### Database corruption
209+
210+
If the database gets corrupted, simply delete it and re-index:
211+
```bash
212+
rm ~/.codegraphcontext/falkordb.db
213+
cgc start
214+
# Re-index your code
215+
```
216+
217+
## Performance Tips
218+
219+
1. **Index incrementally**: Use `watch_directory` for active projects
220+
2. **Exclude unnecessary files**: Add `.gitignore` patterns
221+
3. **Backup regularly**: Copy the `.db` file periodically
222+
4. **Clean old data**: Delete and re-index if graph gets too large
223+
224+
## FAQ
225+
226+
**Q: Can I use both Neo4j and FalkorDB?**
227+
A: Yes! Switch using the `DATABASE_TYPE` environment variable.
228+
229+
**Q: Is the query syntax the same?**
230+
A: Yes, both use Cypher queries.
231+
232+
**Q: Can I visualize the graph?**
233+
A: FalkorDB Lite doesn't have a built-in browser like Neo4j, but you can use Cypher queries to explore the graph.
234+
235+
**Q: How big can my database get?**
236+
A: FalkorDB Lite can handle databases up to several GB. For larger projects, consider Neo4j.
237+
238+
**Q: Is my data safe?**
239+
A: Yes, FalkorDB Lite automatically persists data to disk after each transaction.
240+
241+
## Contributing
242+
243+
We welcome contributions! Please see the main [CONTRIBUTING.md](../CONTRIBUTING.md) for guidelines.
244+
245+
## License
246+
247+
MIT License - see [LICENSE](../LICENSE) for details.
248+
249+
## Support
250+
251+
- **Issues**: [GitHub Issues](https://github.com/Shashankss1205/CodeGraphContext/issues)
252+
- **Discussions**: [GitHub Discussions](https://github.com/Shashankss1205/CodeGraphContext/discussions)
253+
254+
---
255+
256+
**Made with ❤️ for developers who want zero-friction code intelligence**

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ dependencies = [
2929
"pytest",
3030
"nbformat",
3131
"nbconvert>=7.16.6",
32-
"pathspec>=0.12.1"
32+
"pathspec>=0.12.1",
33+
"falkordblite>=0.1.0"
3334
]
3435

3536
[project.urls]

0 commit comments

Comments
 (0)