Skip to main content
GET
/
api
/
projects
/
:id
/
overview
Get Project Overview
curl --request GET \
  --url https://api.example.com/api/projects/:id/overview
{
  "success": true,
  "project": {
    "_id": "<string>",
    "name": "<string>",
    "projectType": "<string>",
    "repoLink": "<string>",
    "status": "<string>",
    "plan": "<string>",
    "totalRequest": 123,
    "totalBuilds": 123,
    "domain": "<string>",
    "settings": {
      "repoBranchName": "<string>",
      "folder": {
        "enabled": true,
        "name": "<string>"
      }
    },
    "buildCommand": {},
    "publishDir": {},
    "startCommand": {},
    "port": {},
    "createdAt": "<string>",
    "updatedAt": "<string>"
  },
  "lastBuild": {
    "_id": "<string>",
    "commitSha": {},
    "status": "<string>",
    "duration": {},
    "createdAt": "<string>"
  }
}

Authentication

This endpoint requires JWT authentication via the verifyJWT middleware. Include your access token in the Authorization header.

Path Parameters

id
string
required
The unique identifier of the project (MongoDB ObjectId)

Response

success
boolean
required
Indicates whether the request was successful
project
object
required
The project overview data
lastBuild
object | null
required
Information about the most recent build, or null if no builds exist

Example Request

curl -X GET "https://api.deployhub.online/api/projects/65f3a2b1c4d5e6f7g8h9i0j1/overview" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Example Response

{
  "success": true,
  "project": {
    "_id": "65f3a2b1c4d5e6f7g8h9i0j1",
    "name": "my-react-app",
    "projectType": "static",
    "repoLink": "https://github.com/username/my-react-app",
    "status": "live",
    "plan": "pro",
    "totalRequest": 15847,
    "totalBuilds": 23,
    "domain": "my-app.deployhub.online",
    "settings": {
      "repoBranchName": "main",
      "folder": {
        "enabled": false,
        "name": ""
      }
    },
    "buildCommand": "npm run build",
    "publishDir": "dist",
    "startCommand": null,
    "port": null,
    "createdAt": "2024-03-15T10:30:00.000Z",
    "updatedAt": "2024-03-20T14:22:33.000Z"
  },
  "lastBuild": {
    "_id": "65f5d3e4f5g6h7i8j9k0l1m2",
    "commitSha": "a3f7d9e2c1b4f6e8d0c2a5b7",
    "status": "success",
    "duration": "1m 42s",
    "createdAt": "2024-03-20T14:20:15.000Z"
  }
}

Example Response (Node.js Project)

{
  "success": true,
  "project": {
    "_id": "65f3a2b1c4d5e6f7g8h9i0j1",
    "name": "express-api",
    "projectType": "node",
    "repoLink": "https://github.com/username/express-api",
    "status": "live",
    "plan": "free",
    "totalRequest": 2341,
    "totalBuilds": 8,
    "domain": "api-prod.deployhub.online",
    "settings": {
      "repoBranchName": "production",
      "folder": {
        "enabled": true,
        "name": "server"
      }
    },
    "buildCommand": "npm install",
    "publishDir": null,
    "startCommand": "node index.js",
    "port": 3000,
    "createdAt": "2024-02-10T08:15:00.000Z",
    "updatedAt": "2024-03-18T11:45:22.000Z"
  },
  "lastBuild": {
    "_id": "65f5d3e4f5g6h7i8j9k0l1m2",
    "commitSha": "b2e8f1a3d5c7e9f0a2b4c6d8",
    "status": "success",
    "duration": "38s",
    "createdAt": "2024-03-18T11:43:00.000Z"
  }
}

Error Responses

404 Not Found
Returned when:
  • Project with the specified ID doesn’t exist
  • Project doesn’t belong to the authenticated user
  • Project has been deleted
{
  "success": false,
  "message": "Project not found"
}
500 Internal Server Error
Returned when a server error occurs
{
  "success": false,
  "message": "Failed to fetch project overview"
}

Implementation Notes

  • Only returns projects owned by the authenticated user
  • Excludes projects with status deleted
  • Automatically calculates build duration from startedAt and finishedAt timestamps
  • Duration format: seconds shown as {s}s, minutes shown as {m}m {s}s
  • Returns custom domain if hascustomDomain is true, otherwise returns subdomain
  • Build information is fetched separately and joined with project data

Source Reference

backend/src/controllers/slices/Project/getProjectOverview.js:4