- Backend server running:
npm run dev - MongoDB connected
- GitHub token (optional for initial testing)
Endpoint: GET /api/health
Description: Check if server and database are running
curl http://localhost:5000/api/healthExpected Response:
{
"status": "OK",
"message": "Onboarder Backend is running",
"timestamp": "2026-02-07T00:19:35.123Z",
"environment": "development",
"database": "Connected"
}Endpoint: POST /api/projects
Description: Create a new project from GitHub URL
Request:
curl -X POST http://localhost:5000/api/projects \
-H "Content-Type: application/json" \
-d "{\"repoUrl\": \"https://github.com/aayush-1o/Onboarder\"}"Expected Response:
{
"success": true,
"message": "Project created successfully",
"data": {
"_id": "65c1234567890abcdef12345",
"repoUrl": "https://github.com/aayush-1o/Onboarder",
"name": "Onboarder",
"owner": "aayush-1o",
"defaultBranch": "main",
"status": "pending",
"createdAt": "2026-02-07T00:19:35.123Z",
"updatedAt": "2026-02-07T00:19:35.123Z"
}
}Endpoint: GET /api/projects
Description: Get all projects with pagination
Request:
curl http://localhost:5000/api/projectsWith Filters:
curl "http://localhost:5000/api/projects?status=pending&limit=10&page=1"Expected Response:
{
"success": true,
"count": 1,
"total": 1,
"page": 1,
"pages": 1,
"data": [...]
}Endpoint: GET /api/projects/:id
Description: Get project details by ID
Request:
curl http://localhost:5000/api/projects/65c1234567890abcdef12345Expected Response:
{
"success": true,
"data": {
"_id": "65c1234567890abcdef12345",
"repoUrl": "https://github.com/aayush-1o/Onboarder",
"name": "Onboarder",
"owner": "aayush-1o",
...
}
}Endpoint: GET /api/projects/:id/logs
Description: Get build logs for a project
Request:
curl http://localhost:5000/api/projects/65c1234567890abcdef12345/logsWith Filters:
curl "http://localhost:5000/api/projects/65c1234567890abcdef12345/logs?limit=50&level=error"Expected Response:
{
"success": true,
"count": 1,
"projectId": "65c1234567890abcdef12345",
"projectName": "Onboarder",
"data": [
{
"_id": "...",
"projectId": "65c1234567890abcdef12345",
"logType": "info",
"message": "Project created: aayush-1o/Onboarder",
"level": "success",
"phase": "initialization",
"createdAt": "..."
}
]
}Endpoint: PATCH /api/projects/:id/status
Description: Update project status
Request:
curl -X PATCH http://localhost:5000/api/projects/65c1234567890abcdef12345/status \
-H "Content-Type: application/json" \
-d "{\"status\": \"analyzing\"}"Expected Response:
{
"success": true,
"message": "Project status updated",
"data": {
...
"status": "analyzing"
}
}Endpoint: DELETE /api/projects/:id
Description: Delete project and associated logs
Request:
curl -X DELETE http://localhost:5000/api/projects/65c1234567890abcdef12345Expected Response:
{
"success": true,
"message": "Project and associated logs deleted successfully"
}Health Check:
Invoke-RestMethod -Uri "http://localhost:5000/api/health" -Method GETCreate Project:
$body = @{
repoUrl = "https://github.com/aayush-1o/Onboarder"
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:5000/api/projects" -Method POST -Body $body -ContentType "application/json"List Projects:
Invoke-RestMethod -Uri "http://localhost:5000/api/projects" -Method GET{
"success": false,
"error": "Invalid GitHub repository URL"
}{
"success": false,
"error": "Repository not found"
}{
"success": false,
"error": "Project already exists",
"data": {...}
}{
"success": false,
"error": "Invalid ID format"
}{
"success": false,
"error": "Project not found"
}-
Start Server:
cd c:\Users\Ayush\Desktop\Onboarder npm run dev
-
Test Health Check:
curl http://localhost:5000/api/health
-
Create Test Project (use a real GitHub repo):
curl -X POST http://localhost:5000/api/projects \ -H "Content-Type: application/json" \ -d "{\"repoUrl\": \"https://github.com/aayush-1o/Onboarder\"}"
-
List Projects:
curl http://localhost:5000/api/projects
-
Get Logs (replace with actual ID):
curl http://localhost:5000/api/projects/<ID>/logs
-
Delete Project (replace with actual ID):
curl -X DELETE http://localhost:5000/api/projects/<ID>
To enable full GitHub functionality:
- Get GitHub Personal Access Token (see main documentation)
- Add to
.env:GITHUB_TOKEN=your_token_here - Restart server
- Test with public and private repositories
You can also verify data in MongoDB Compass:
- Connect to
localhost:27017 - Open
onboarderdatabase - Check
projectsandbuildlogscollections - See data created by API calls
Day 2 API Testing Guide Complete ✅