Turn any GitHub repo into an interactive knowledge graph. Ask questions in plain English.
Paste a public GitHub URL → get an interactive knowledge graph → ask anything via GraphRAG + Claude AI.
🔗 Live demo: https://code-graph.vercel.app
- AST Parsing — tree-sitter parses Python, JS, TS, Go, Rust into nodes (File, Class, Function, Module)
- Neo4j Knowledge Graph — all relationships stored with edges: CALLS, IMPORTS, DEFINED_IN, BELONGS_TO, DEPENDS_ON
- GraphRAG — vector similarity search finds the most relevant subgraph, then Claude answers in context
- Interactive Cytoscape.js canvas — zoom, filter by node type, search, click to explore
- Node sidebar — source preview, call chains, Cypher query copy
- AI chat panel — streaming answers, follow-up suggestions, subgraph highlighting
# 1. Clone
git clone https://github.com/Boweii22/Code-graph
cd codegraph
# 2. Configure secrets
cp backend/.env.example backend/.env
# Edit backend/.env with your Neo4j, OpenAI, and Anthropic keys
cp frontend/.env.local.example frontend/.env.local
# 3. Start with Docker
docker-compose up --build
# 4. Open
open http://localhost:3000
# 5. Paste a GitHub URL and hit Analyze!# Backend
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000
# Frontend (new terminal)
cd frontend
npm install
npm run dev┌─────────────────────────────────────────────────────────────────┐
│ BROWSER │
│ Next.js 14 (App Router) · Cytoscape.js · Zustand store │
│ Landing page → Graph explorer · ChatPanel · NodeSidebar │
└───────────────────────────────┬─────────────────────────────────┘
│ HTTP (Axios)
┌───────────────────────────────▼─────────────────────────────────┐
│ FastAPI (Python) │
│ POST /api/jobs → BackgroundTask pipeline: │
│ 1. gitpython clone (depth=1) │
│ 2. tree-sitter AST parse (Py/JS/TS/Go/Rust) │
│ 3. graph_builder → nodes + edges │
│ 4. neo4j_service → Cypher MERGE │
│ 5. embedding_service → text-embedding-3-small │
│ GET /api/graph/{jobId} → full graph for Cytoscape │
│ POST /api/query → GraphRAG → Claude Sonnet │
└───────────────────────────────┬─────────────────────────────────┘
│
┌─────────────────┼──────────────────┐
│ │ │
┌───────▼──────┐ ┌───────▼──────┐ ┌───────▼──────┐
│ Neo4j AuraDB │ │ OpenAI API │ │ Anthropic API│
│ (Graph + Vec)│ │ (Embeddings) │ │ (Claude AI) │
└──────────────┘ └──────────────┘ └──────────────┘
NEO4J_URI=neo4j+s://YOUR_AURA_INSTANCE.databases.neo4j.io
NEO4J_USER=neo4j
NEO4J_PASSWORD=your_aura_password
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
NEXT_PUBLIC_API_URL=http://localhost:8000
- Go to neo4j.com/cloud/aura-free
- Create account → "Create Free Instance" (AuraDB Free)
- Copy the connection URI:
neo4j+s://xxxxx.databases.neo4j.io - Save the generated password — shown only once
- Paste into
backend/.env
| Layer | Technology |
|---|---|
| Frontend | Next.js 14, TypeScript, Tailwind CSS, Framer Motion |
| Graph viz | Cytoscape.js + cytoscape-fcose |
| State | Zustand |
| Backend | Python FastAPI + uvicorn |
| Parser | tree-sitter (Python, JS, TS, Go, Rust) |
| Graph DB | Neo4j AuraDB |
| Embeddings | OpenAI text-embedding-3-small |
| AI | Anthropic Claude Sonnet (claude-sonnet-4-20250514) |
| Deployment | Docker + docker-compose |
- Neo4j AuraDB — Cloud graph database with vector search
- Claude AI — Anthropic's Claude Sonnet for code analysis
- OpenAI — text-embedding-3-small for semantic search
PRs welcome! Please open an issue first to discuss changes.
MIT