Skip to main content
GET
List User Projects
Retrieves all projects owned by the authenticated user. Returns a formatted list of projects with deployment information, excluding deleted projects.

Authentication

Requires JWT authentication via verifyJWT middleware.

Query Parameters

No query parameters. Returns all non-deleted projects for the authenticated user.

Response

boolean
Indicates if the request was successful.
array
Array of project objects sorted by creation date (newest first).

Filtering

The endpoint automatically filters:
  • Projects owned by the authenticated user (via req.user._id)
  • Projects with status not equal to deleted

Sorting

Projects are sorted by createdAt in descending order (newest first).

Selected Fields

For performance, only the following fields are returned:
  • name
  • projectType
  • repoLink
  • status
  • totalRequest
  • plan
  • hascustomDomain
  • customDomain
  • totalBuilds
  • subdomain
  • createdAt
  • updatedAt
Other fields like env, buildCommand, startCommand, etc. are excluded. Use the project details endpoint for complete information.

Error Responses

boolean
Always false for errors.
string
Error message describing what went wrong.

Common Errors

  • 401 Unauthorized: Missing or invalid JWT token
  • 500 Internal Server Error: "Failed to fetch projects" - Database or server error

Request Examples

cURL

JavaScript (Axios)

JavaScript (Fetch API)

TypeScript

Response Example

Successful Response

Empty Projects List

Error Response

Use Cases

Dashboard Display

Display all user projects on a dashboard:

Filter by Status

Project Statistics

Domain Resolution

The domain field intelligently returns:
  • Custom Domain: If hascustomDomain is true and customDomain is set, returns the custom domain
  • DeployHub Subdomain: Otherwise, returns {subdomain}.deployhub.online
This allows you to display the correct accessible URL without additional logic:

Performance Considerations

  • Uses .lean() for faster queries (returns plain JavaScript objects)
  • Only selects necessary fields to reduce data transfer
  • Indexed on owner and status for fast filtering
  • Sorted by createdAt with index support
  • Create Deployment - Deploy a new project
  • Redeploy Project - Redeploy existing project
  • Get Project Details - Get complete project information including build settings
  • Get Project Builds - View build history for a specific project