List User Projects
Deployments
List User Projects
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 viaverifyJWT middleware.
Query Parameters
No query parameters. Returns all non-deleted projects for the authenticated user.Response
Indicates if the request was successful.
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 bycreatedAt in descending order (newest first).
Selected Fields
For performance, only the following fields are returned:nameprojectTyperepoLinkstatustotalRequestplanhascustomDomaincustomDomaintotalBuildssubdomaincreatedAtupdatedAt
env, buildCommand, startCommand, etc. are excluded. Use the project details endpoint for complete information.
Error Responses
Always
false for errors.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
Thedomain field intelligently returns:
- Custom Domain: If
hascustomDomainistrueandcustomDomainis set, returns the custom domain - DeployHub Subdomain: Otherwise, returns
{subdomain}.deployhub.online
Performance Considerations
- Uses
.lean()for faster queries (returns plain JavaScript objects) - Only selects necessary fields to reduce data transfer
- Indexed on
ownerandstatusfor fast filtering - Sorted by
createdAtwith index support
Related Endpoints
- 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