Get Dashboard Stats
Headers
Bearer token for authentication
Response
Indicates if the request was successful
Aggregated statistics for all user projects
Array of the 4 most recently updated projects
Implementation Details
Query Logic
- Fetches all projects owned by the authenticated user
- Excludes projects with status
deleted - Projects are sorted by
updatedAtin descending order (most recent first) - Uses lean queries for optimal performance
Statistics Aggregation
- totalProjects: Count of all non-deleted projects
- liveCount: Filtered count where
status === "live" - stoppedCount: Filtered count where
status === "stopped" - staticCount: Filtered count where
projectType === "Static" || projectType === "static" - nodeCount: Filtered count where
projectType === "node" - totalRequests: Sum of
totalRequestfield across all projects using reduce
Recent Projects
- Returns the first 4 projects from the sorted list (most recently updated)
- Domain logic: displays custom domain if
hascustomDomainis true, otherwise uses{subdomain}.deployhub.onlineformat
Selected Fields
The query selects the following fields from the Project model:- name
- projectType
- status
- totalRequest
- totalBuilds
- plan
- subdomain
- hascustomDomain
- customDomain
- createdAt
- updatedAt