Knowledge graph visualization tool for codebases. Python FastAPI backend + React/TypeScript frontend + FalkorDB graph database.
- Backend (
api/): FastAPI, async-first. All routes inapi/index.py. Graph ops inapi/graph.py. LLM chat via GraphRAG inapi/llm.py. - Frontend (
app/): React 18 + TypeScript + Vite. Tailwind CSS + Radix UI. 3D force-graph visualization (D3/Force-Graph). - Database: FalkorDB (graph DB on Redis). Metadata in Redis key-value store.
- Analyzers (
api/analyzers/): tree-sitter (Python), multilspy (Java, C#). Base class inanalyzer.py, orchestrator insource_analyzer.py.
- User submits repo URL or folder path -> backend clones/reads and analyzes via language-specific analyzers
- Entities stored in FalkorDB (nodes: File, Class, Function; edges: DEFINES, CALLS, etc.)
- Metadata (URL, commit) stored in Redis
- Frontend fetches graph, renders interactive visualization
- User can chat (GraphRAG), explore neighbors, find paths
api/ # Python backend
cli.py # cgraph CLI tool (typer)
index.py # FastAPI app, routes, auth, SPA serving
graph.py # FalkorDB graph operations (sync + async)
llm.py # GraphRAG + LiteLLM chat
project.py # Repo cloning and analysis pipeline
info.py # Redis metadata operations
prompts.py # LLM prompt templates
auto_complete.py # Prefix search
analyzers/ # Language-specific code analyzers
entities/ # Graph entity models
git_utils/ # Git history graph construction
app/ # React frontend (Vite)
src/components/ # React components (ForceGraph, chat, code-graph, etc.)
src/lib/ # Utilities
skills/code-graph/ # Claude Code skill for code graph indexing/querying
tests/ # Pytest backend tests
endpoints/ # API endpoint integration tests
e2e/ # Playwright E2E tests
seed_test_data.py # Test data seeder
make install # Install all deps (uv sync + npm install)
make install-cli # Install cgraph CLI entry point
make build-dev # Build frontend (dev mode)
make build-prod # Build frontend (production)
make run-dev # Build dev frontend + run API with reload
make run-prod # Build prod frontend + run API
make test # Run pytest suite
make lint # Ruff + TypeScript type-check
make lint-py # Ruff only
make lint-fe # TypeScript type-check only
make e2e # Run Playwright tests
make clean # Remove build artifacts
make docker-falkordb # Start FalkorDB container for testing
make docker-stop # Stop test containers# Backend
uv run uvicorn api.index:app --host 127.0.0.1 --port 5000 --reload
uv run python -m pytest tests/ --verbose
uv run ruff check .
# Frontend
npm --prefix ./app run dev # Vite dev server (port 3000, proxies /api to 5000)
npm --prefix ./app run build # Production build
npm --prefix ./app run lint # Type-check
# E2E
npx playwright test- snake_case for functions/variables, PascalCase for classes
- Async-first: route handlers and most graph operations are async, though api/graph.py includes some synchronous helpers
- Auth:
public_or_authfor read endpoints,token_requiredfor mutating endpoints - Graph labels: PascalCase (File, Class, Function). Relations: SCREAMING_SNAKE_CASE (DEFINES, CALLS)
- Linter: Ruff
- camelCase for functions/variables, PascalCase for components
- Tailwind CSS for styling
- Radix UI for headless components
- Linter: tsc (type-check only)
- Python >=3.12,<3.14. Node 20+.
- Package managers:
uv(Python),npm(frontend) - Environment variables: SCREAMING_SNAKE_CASE. See
.env.templatefor reference.
Key variables (see .env.template for full list):
| Variable | Default | Purpose |
|---|---|---|
FALKORDB_HOST |
localhost |
Graph DB host |
FALKORDB_PORT |
6379 |
Graph DB port |
SECRET_TOKEN |
empty | API auth token |
CODE_GRAPH_PUBLIC |
0 |
Skip auth on read endpoints when 1 |
MODEL_NAME |
gemini/gemini-flash-lite-latest |
LiteLLM model for chat |
ALLOWED_ANALYSIS_DIR |
repo root | Root path for analyze_folder |
- Backend:
make testruns pytest againsttests/. Endpoint tests intests/endpoints/. - E2E:
make e2eruns Playwright (Chromium + Firefox). Test data seeded viae2e/seed_test_data.py. - CI: GitHub Actions —
build.yml(lint + build),playwright.yml(E2E, 2 shards),release-image.yml(Docker image).
GET /api/list_repos— List indexed reposGET /api/graph_entities?repo=<name>— Fetch graph entitiesPOST /api/get_neighbors— Neighboring nodesPOST /api/auto_complete— Prefix searchPOST /api/repo_info— Repo stats/metadataPOST /api/find_paths— Paths between nodesPOST /api/chat— GraphRAG chatPOST /api/list_commits— Git commit history
POST /api/analyze_folder— Analyze local folderPOST /api/analyze_repo— Clone and analyze repoPOST /api/switch_commit— Switch to specific commit
Typer-based CLI wrapping the sync Graph and Project classes. Outputs JSON to stdout, status to stderr. Entry point: api/cli.py.
Install: pipx install falkordb-code-graph or pip install falkordb-code-graph
For development: make install-cli or uv pip install -e .
cgraph ensure-db # Start FalkorDB if not running
cgraph index . --ignore node_modules # Index local folder
cgraph index-repo <url> # Clone + index a repo
cgraph list # List indexed repos
cgraph search <prefix> [--repo <name>] # Full-text prefix search
cgraph neighbors <id>... [--repo <name>] [--rel <type>] [--label <label>] # Connected entities
cgraph paths <src-id> <dest-id> [--repo <name>] # Call-chain paths
cgraph info [--repo <name>] # Repo stats + metadata--repo defaults to the current directory name. Claude Code skill in skills/code-graph/.