Base URL (local): http://localhost:5000/api
Base URL (production): https://<your-render-service>.onrender.com/api
All successful responses use:
{
"success": true,
"message": "string",
"data": {}
}All error responses use:
{
"success": false,
"message": "string",
"error": { "code": "OPTIONAL_CODE" }
}Starts GitHub OAuth. Browser redirect — do not call with Axios.
GitHub redirects here. The API exchanges the code, stores the encrypted token, then redirects to /auth/callback?token=… on the frontend.
Optional Authorization: Bearer <jwt>. Returns { user, oauthConfigured }.
Client-side session clear. JWT is stateless; the UI drops the token.
Runs the full engineering analysis pipeline.
Guests can analyze public repos (server GITHUB_TOKEN).
Signed-in users can also analyze private repos they can access (their OAuth token).
Optional header: Authorization: Bearer <jwt>
POST /api/repository/analyze
Content-Type: application/json
Authorization: Bearer <jwt>{
"url": "https://github.com/facebook/react"
}| Field | Type | Required | Description |
|---|---|---|---|
url |
string | yes | GitHub repository URL (owner/repo) |
{
"success": true,
"message": "Engineering analysis complete for facebook/react",
"data": {
"repository": {},
"scores": {
"documentation": 0,
"community": 0,
"activity": 0,
"dependency": 0,
"metadata": 0
},
"engineeringHealth": {
"overallScore": 0,
"grade": "A"
},
"technicalDebt": [],
"technicalDebtMeta": {},
"aiInsights": {},
"persistence": {
"saved": true,
"reason": "created",
"analysisId": "…",
"analysisDate": "2026-07-26T00:00:00.000Z"
}
}
}| Status | Code (typical) | When |
|---|---|---|
400 |
INVALID_URL |
Missing or malformed GitHub URL |
404 |
— | Repository not found on GitHub |
429 |
ANALYZE_RATE_LIMITED |
Too many analyze requests from this IP |
504 |
REQUEST_TIMEOUT |
Analysis exceeded the server timeout |
500 |
INTERNAL_ERROR |
Unexpected server failure |
Lists previously saved analyses for the signed-in user (requires MongoDB + JWT).
| Param | Type | Default | Description |
|---|---|---|---|
search |
string | "" |
Match repository name / URL substring |
owner |
string | "" |
Filter by GitHub owner |
sort |
string | newest |
newest | oldest | highest | lowest |
limit |
number | server | Cap number of rows returned |
{
"success": true,
"message": "Analysis history loaded",
"data": [
{
"_id": "…",
"owner": "facebook",
"repositoryName": "react",
"repositoryUrl": "https://github.com/facebook/react",
"analysisDate": "2026-07-26T00:00:00.000Z",
"engineeringHealth": { "overallScore": 88, "grade": "A" }
}
]
}| Status | When |
|---|---|
503 |
Database unavailable / history service cannot run |
500 |
Unexpected server failure |
Loads one saved analysis by MongoDB ObjectId.
{
"success": true,
"message": "Analysis loaded",
"data": {
"id": "…",
"repositoryUrl": "https://github.com/facebook/react",
"owner": "facebook",
"repositoryName": "react",
"analysisDate": "2026-07-26T00:00:00.000Z",
"repository": {},
"scores": {},
"engineeringHealth": {},
"technicalDebt": [],
"technicalDebtMeta": {},
"aiInsights": {}
}
}| Status | When |
|---|---|
400 |
Invalid ObjectId |
404 |
Analysis not found |
503 |
Database unavailable |
500 |
Unexpected server failure |
Deletes one saved analysis.
{
"success": true,
"message": "Analysis deleted",
"data": { "id": "…" }
}Same as GET /api/history/:id for invalid / missing IDs and DB failures.
Liveness check for local development and Render health probes.
{
"success": true,
"message": "RepoPulse API Running",
"data": {
"status": "ok",
"database": "connected"
},
"timestamp": "2026-07-26T00:00:00.000Z"
}database is "connected" or "disconnected". The process is still healthy when MongoDB is down — analysis without history remains available.