Skip to main content

Endpoint

GET /api/v1/analytics/graph
Returns comprehensive repository intelligence combining Neo4j graph data with GitHub API metrics, including language distribution, file hotspots, high-risk files, code ownership, and developer expertise.

Authentication

Requires a valid JWT token in cookies (obtained via GitHub OAuth).

Query Parameters

repo
string
required
Repository in owner/repo format (must be connected to your account)

Response

repo
string
Repository full name (owner/repo)
languages
array
Programming language distribution (from GitHub API - byte-accurate)
hotspots
array
Most PR-touched files (from Neo4j graph)
high_risk
array
Files with most REQUEST_CHANGES verdicts
dead_files
object
Files never touched by reviewed PRs
ownership
array
Code ownership by file (file → dominant contributor)
expertise
array
Developer expertise areas (per dev: top directories)
contributors
array
Top contributors (from GitHub /stats/contributors API - default branch, all time)

Example Request

curl "https://your-backend.railway.app/api/v1/analytics/graph?repo=myorg/backend" \
  -H "Cookie: access_token=your_jwt_token"

Example Response

{
  "repo": "myorg/backend",
  "languages": [
    { "name": "Python", "bytes": 244896, "pct": 52.3 },
    { "name": "TypeScript", "bytes": 225830, "pct": 48.2 }
  ],
  "hotspots": [
    { "path": "app/services/pr_review_service.py", "touch_count": 42 },
    { "path": "app/api/v1/repos.py", "touch_count": 28 }
  ],
  "high_risk": [
    { "path": "app/auth/jwt_utils.py", "risk_score": 8 },
    { "path": "app/services/ai_service.py", "risk_score": 6 }
  ],
  "dead_files": {
    "count": 23,
    "sample": ["tests/legacy/old_test.py", "scripts/deprecated.sh"]
  },
  "ownership": [
    { "path": "app/main.py", "owner": "alice", "touch_pct": 75.0 },
    { "path": "app/core/config.py", "owner": "bob", "touch_pct": 60.0 }
  ],
  "expertise": [
    {
      "login": "alice",
      "top_dirs": ["app/services", "app/api", "app/core"],
      "total_touches": 65
    }
  ],
  "contributors": [
    {
      "login": "alice",
      "commits": 342,
      "additions": 15680,
      "deletions": 8420
    }
  ]
}

Use Cases

  • Code Ownership: Identify which developer owns which parts of the codebase
  • Risk Management: Find files that frequently cause review issues
  • Refactoring: Identify hotspots and dead code for cleanup
  • Team Planning: Understand developer expertise areas
  • Language Analysis: Track technology stack composition

Error Responses

{
  "detail": "repo must be in 'owner/repo' format"
}

Analytics Insights

Cross-repository analytics and metrics

Neo4j Graph

Learn about the knowledge graph structure

Build docs developers (and LLMs) love