Documentation Index
Fetch the complete documentation index at: https://docs.deployhub.cloud/llms.txt
Use this file to discover all available pages before exploring further.
Get Project Settings
The unique identifier of the project (MongoDB ObjectId)
Authentication
Requires JWT authentication via the verifyJWT middleware.
Response
Indicates whether the request was successful
Project settings data
Project unique identifier
Type of project: static or node
General project settings
Git branch to deploy from (default: main)
Subfolder configuration
Whether to deploy from a specific folder
Folder path when enabled (required if enabled is true)
Command to build the project (e.g., npm run build, yarn build)
Directory containing build output for static sites (e.g., dist, build, out)
Command to start Node.js applications (e.g., node server.js, npm start)
Port number for Node.js applications
Environment variables as key-value pairs
ISO 8601 timestamp of project creation
Example Request
curl -X GET "https://api.deployhub.online/api/projects/65f3a2b1c4d5e6f7g8h9i0j1/settings" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Example Response
{
"success": true,
"project": {
"_id": "65f3a2b1c4d5e6f7g8h9i0j1",
"name": "my-react-app",
"projectType": "static",
"settings": {
"repoBranchName": "main",
"folder": {
"enabled": false,
"name": ""
}
},
"buildCommand": "npm run build",
"publishDir": "dist",
"env": {
"VITE_API_URL": "https://api.example.com",
"VITE_ENV": "production"
},
"createdAt": "2024-03-15T10:30:00.000Z"
}
}
Update General Settings
Update project name, branch, and folder settings.
Path Parameters
The unique identifier of the project
Request Body
New project name (will be trimmed)
Git branch to deploy from (will be trimmed)
Subfolder configuration
Whether to deploy from a subfolder
Folder path (required when enabled is true, must not be empty)
Validation Rules
name must not be empty after trimming
repoBranchName will be trimmed if provided
- If
folder.enabled is true, folder.name is required and validated by the model
- If
folder.enabled is false, folder.name is set to empty string
Example Request
curl -X PATCH "https://api.deployhub.online/api/projects/65f3a2b1c4d5e6f7g8h9i0j1/settings/general" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "my-updated-app",
"repoBranchName": "production",
"folder": {
"enabled": true,
"name": "client"
}
}'
Example Response
{
"success": true,
"project": {
"_id": "65f3a2b1c4d5e6f7g8h9i0j1",
"name": "my-updated-app",
"settings": {
"repoBranchName": "production",
"folder": {
"enabled": true,
"name": "client"
}
}
}
}
Update Build Settings
Update build and deployment configuration.
Path Parameters
The unique identifier of the project
Request Body
Command to build the project. Can be empty string to clear.
Output directory for static sites. Can be empty string to clear.
Start command for Node.js projects. Can be empty string to clear.
Port number for Node.js projects. Set to null/undefined to clear.
Example Request (Static Site)
curl -X PATCH "https://api.deployhub.online/api/projects/65f3a2b1c4d5e6f7g8h9i0j1/settings/build" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"buildCommand": "npm run build",
"publishDir": "dist"
}'
Example Request (Node.js App)
curl -X PATCH "https://api.deployhub.online/api/projects/65f3a2b1c4d5e6f7g8h9i0j1/settings/build" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"buildCommand": "npm install",
"startCommand": "node server.js",
"port": 3000
}'
Example Response
{
"success": true,
"project": {
"_id": "65f3a2b1c4d5e6f7g8h9i0j1",
"buildCommand": "npm install",
"publishDir": null,
"startCommand": "node server.js",
"port": 3000
}
}
Update Environment Variables
Update project environment variables. This replaces all existing environment variables.
Path Parameters
The unique identifier of the project
Request Body
Key-value pairs of environment variables. All values must be strings.
Validation Rules
env must be a plain object (not an array)
- Environment variable keys cannot be empty or whitespace-only
- All keys are trimmed and validated
- Passing an empty object
{} will clear all environment variables
Example Request
curl -X PATCH "https://api.deployhub.online/api/projects/65f3a2b1c4d5e6f7g8h9i0j1/settings/env" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"env": {
"NODE_ENV": "production",
"API_URL": "https://api.example.com",
"DATABASE_URL": "postgresql://...",
"SECRET_KEY": "your-secret-key"
}
}'
Example Response
Error Response (Invalid Key)
{
"success": false,
"message": "Empty env key not allowed"
}
Error Response (Invalid Type)
{
"success": false,
"message": "env must be a key-value object"
}
Common Error Responses
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": "Server error"
}
Implementation Notes
General Settings Update
- Uses
findOneAndUpdate with runValidators: true and context: 'query'
- Only updates fields that are provided in the request body
- Folder name validation is enforced by the Mongoose schema
- Returns updated
name and settings fields only
Build Settings Update
- Accepts
undefined to skip updating a field
- Port is parsed as integer if provided
- Returns only the updated build-related fields
Environment Variables Update
- Stores environment variables as a MongoDB Map internally
- Completely replaces existing environment variables
- Keys are validated to prevent empty strings
- Does not return the environment variables in the response (for security)
Source Reference
- GET:
backend/src/controllers/slices/Project/settings.js:4
- PATCH general:
backend/src/controllers/slices/Project/settings.js:36
- PATCH build:
backend/src/controllers/slices/Project/settings.js:70
- PATCH env:
backend/src/controllers/slices/Project/settings.js:96