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
Repository in owner/repo format (must be connected to your account)
Response
Repository full name (owner/repo)
Programming language distribution (from GitHub API - byte-accurate) Language name (e.g., “Python”, “TypeScript”)
Percentage of total codebase
Most PR-touched files (from Neo4j graph) Number of PRs that modified this file
Files with most REQUEST_CHANGES verdicts Number of REQUEST_CHANGES reviews
Files never touched by reviewed PRs Total number of dead files
Sample file paths (up to 10)
Code ownership by file (file → dominant contributor) GitHub username of primary contributor
Percentage of PRs by this owner
Developer expertise areas (per dev: top directories) Top 3 directories this developer works in
Top contributors (from GitHub /stats/contributors API - default branch, all time) Total commits on default branch
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
400 Bad Request
403 Forbidden
401 Unauthorized
{
"detail" : "repo must be in 'owner/repo' format"
}
Analytics Insights Cross-repository analytics and metrics
Neo4j Graph Learn about the knowledge graph structure