An open API service indexing awesome lists of open source software.

https://github.com/jexp/github4j

Vibe coded GitHub wrapped with Neo4j
https://github.com/jexp/github4j

Last synced: 2 months ago
JSON representation

Vibe coded GitHub wrapped with Neo4j

Awesome Lists containing this project

README

          

# 🎸 github4j β€” GitHub Wrapped Γ— Neo4j

> *Your year (or quarter, or sprint) in code. Spotify Wrapped, but make it graphs.*

Built at the Neo4j hackathon 🦾. Six CSVs of GitHub activity go in β€” contributor glory, collaboration graphs, and bug-slaying leaderboards come out. Vibe coded with Claude + Neo4j.

---

## πŸ—ΊοΈ What's inside

| Layer | What it does |
|---|---|
| πŸ•ΈοΈ **Graph import** | 6 CSVs β†’ Neo4j AuraDB property graph (persons, repos, PRs, reviews, files, labels) |
| πŸ“Š **NeoDash dashboard** | 10 pre-built panels β€” top contributors, PR velocity, hottest files, label heatmap |
| 🌐 **Web app** | GitHub Pages site with Wrapped-style hero stats + NVL interactive collaboration graph |
| πŸ”¬ **GDS notebook** | Louvain community detection + PageRank β€” do the informal teams match the org chart? |
| πŸ€– **MCP server** | FastAPI endpoint Claude can query: *"who fixed the most bugs?"* |

---

## ⚑ Quickstart

### 1. 🌩️ Get an AuraDB instance

Free tier at [neo4j.com/cloud/aura](https://neo4j.com/cloud/aura) β€” takes 2 minutes. Save your **Bolt URI** (`neo4j+s://...`) and password.

### 2. 🌱 Seed the database

```bash
# install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh

git clone https://github.com/jexp/github4j
cd github4j

NEO4J_URI=neo4j+s://xxxx.databases.neo4j.io \
NEO4J_USER=neo4j \
NEO4J_PASSWORD=your-password \
uv run seed.py

# AuraDB Free tier? Skip the large TOUCHES import:
uv run seed.py --skip-touches
```

Reads from local `data/` β€” no remote CSV fetching, fast batched Python.

> ⚠️ **AuraDB Free tier note:** Full import creates ~507k relationships. `--skip-touches` drops 206k `TOUCHES` rels to stay under the 400k limit. All hero stats still work!

### 3. 🌐 Open the web app

```bash
cd docs && python3 -m http.server 8080
# β†’ http://localhost:8080
```

Enter your AuraDB **Bolt URI** (`neo4j+s://...`) on first load β€” stored in `localStorage`, never committed.

Or open the live demo:

> **🌐 Live demo: [https://www.jexp.de/github4j/](https://www.jexp.de/github4j/)**

The app uses the **Neo4j JS driver over WebSocket (Bolt)**, so there are no CORS issues β€” Bolt runs over `wss://` (WebSocket), which is not subject to the HTTP CORS policy. No AuraDB allowlist configuration is needed. πŸŽ‰

To host your own fork on GitHub Pages: Settings β†’ Pages β†’ Source: `docs/` folder, branch `main`.

### 4. πŸ“Š Load the NeoDash dashboard

![NeoDash dashboard](dashboards/github4j-wrapped-dashboard.png)

1. Go to [neodash.graphapp.io](https://neodash.graphapp.io) (or AuraDB β†’ Apps β†’ NeoDash)
2. New dashboard β†’ Import β†’ paste `dashboards/github-wrapped.json`
3. Connect to your AuraDB instance

### 5. πŸ“œ Run the LOAD CSV scripts (alternative to seed.py)

If you prefer Cypher directly in AuraDB Browser or cypher-shell:

```
import/01_persons.cypher
import/02_repos.cypher
import/03_files.cypher
import/04_prs.cypher
import/05_reviews.cypher
import/06_files_touched.cypher ← optional, see note above
```

CSVs fetched from `raw.githubusercontent.com/jexp/github4j/main/data/`.

### 6. βœ… Verify the import

Paste `import/verify.cypher` into AuraDB Browser β€” checks node counts, relationship counts, and runs the hero stat queries.

---

## πŸ† Hero stats

**πŸ—‘οΈ The Great Deleter** β€” who deleted the most lines of code? Sometimes the best PR is the one that removes 10,000 lines. A true hero of maintainability.

**πŸ› Bug Slayer** β€” ranked by merged PRs carrying the `bug` label. The unsung heroes keeping production alive.

---

## πŸ•ΈοΈ Graph schema

```
(:Person)-[:AUTHORED]->(:PullRequest)-[:IN_REPO]->(:Repo)
(:Person)-[:REVIEWED]->(:PullRequest)
(:Person)-[:MERGED]->(:PullRequest)
(:PullRequest)-[:HAS_LABEL]->(:Label)
(:PullRequest)-[:TOUCHES {additions, deletions}]->(:File)
(:File)-[:IN_DIR]->(:Directory)
```

---

## πŸ”¬ GDS notebook (community detection)

```bash
uv sync --extra notebook # first time only β€” installs graphdatascience, neo4j-viz, python-dotenv
uv run --extra notebook jupyter notebook notebooks/github_gds.ipynb
```

Credentials are loaded automatically from `integration.env` in the project root (same file used by `seed.py` and `verify.py`):

```
NEO4J_URI=neo4j+s://xxxx.databases.neo4j.io
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your-password
```

Runs **Louvain community detection** on the collaboration graph (who reviews whose PRs) and compares detected communities against `team-*` labels. Are the informal teams the same as the org chart? Probably not. πŸ‘€

Visualised with `neo4j-viz`. Community IDs written back to `Person.community` in AuraDB.

---

## πŸ€– MCP server (Claude integration)

### Run locally

```bash
cd mcp_server
NEO4J_URI=... NEO4J_PASSWORD=... uv run uvicorn main:app --reload
```

### Deploy to Railway (recommended)

1. Install the [Railway CLI](https://docs.railway.app/develop/cli): `npm i -g @railway/cli`
2. Log in: `railway login`
3. From `mcp_server/`:

```bash
cd mcp_server
railway init # creates a new project
railway variables set NEO4J_URI=neo4j+s://xxxx.databases.neo4j.io
railway variables set NEO4J_USERNAME=neo4j
railway variables set NEO4J_PASSWORD=your-password
railway variables set NEO4J_DATABASE=neo4j
railway up # deploys β€” get the public URL from the dashboard
```

Railway auto-detects `pyproject.toml` + `uv.lock` via Nixpacks and builds with uv.
The `mcp_server/railway.toml`, `Procfile`, and `nixpacks.toml` are already configured.

### Deploy to Vercel (alternative)

```bash
cd mcp_server
npm i -g vercel
vercel env add NEO4J_URI
vercel env add NEO4J_USERNAME
vercel env add NEO4J_PASSWORD
vercel env add NEO4J_DATABASE
vercel --prod
```

Configuration is in `mcp_server/vercel.json`.

### Use with Claude

Add `/openapi.json` as a tool in Claude Projects and ask:

- πŸ’¬ *"Who are the top 5 bug fixers?"*
- πŸ’¬ *"Which file is touched by the most PRs?"*
- πŸ’¬ *"What communities did Louvain detect?"*
- πŸ’¬ *"Who should review my PR in the kernel team?"*

Smoke-test the deployment:
```bash
curl https:///
curl https:///openapi.json | jq '.info.title'
curl "https:///tools/get_top_contributors?metric=prs&limit=5"
```

> **Note:** No AuraDB credentials are stored in any committed file. All secrets are configured as environment variables in the hosting platform.

---

## πŸ“ Data files

| File | Rows | Description |
|---|---|---|
| `data/persons.csv` | 348 | πŸ‘€ GitHub users |
| `data/repos.csv` | 14 | πŸ“¦ Repositories |
| `data/prs.csv` | 32,252 | πŸ”€ Pull requests |
| `data/reviews.csv` | 92,721 | πŸ‘€ PR reviews |
| `data/files.csv` | 52,996 | πŸ“„ Files in repos |
| `data/files_touched.csv` | 206,196 | ✏️ Files changed per PR |

---

## πŸ› οΈ Built with

- [Neo4j AuraDB](https://neo4j.com/cloud/aura) 🌩️ β€” managed graph database
- [NeoDash](https://neodash.graphapp.io) πŸ“Š β€” no-code graph dashboards
- [NVL](https://neo4j.com/docs/nvl/current/) πŸ•ΈοΈ β€” Neo4j Visualization Library (JS)
- [neo4j-viz](https://neo4j.com/docs/python-graph-visualization/current/) 🐍 β€” Python graph viz wrapper
- [neo4j-rust-ext](https://pypi.org/project/neo4j-rust-ext/) ⚑ β€” fast Neo4j Python driver (Rust-backed)
- [graphdatascience](https://neo4j.com/docs/graph-data-science/current/python-client/) πŸ”¬ β€” GDS Python client
- [uv](https://astral.sh/uv) πŸš€ β€” Python package manager
- [Claude](https://claude.ai) πŸ€– β€” vibe coded the whole thing