Developer projects CLI commands (BETA)
Sales Hub
- Enterprise
Service Hub
- Enterprise
The HubSpot CLI connects your local development tools to HubSpot, allowing you to develop on HubSpot with version control, your favorite text editor, and various web development technologies.
Below, learn about the CLI commands available while you're developing with HubSpot projects. You can also refer to the standard CLI commands reference for general commands such as hs auth
.
To learn more about a specific command, enter the command followed by --help
.
Create a project in a specified directory. You'll be prompted to give the project a name, as well as confirm the local location. You'll then select whether to start the project from scratch or from a sample template.
A new folder will be created in the specified directory containing an hsproject.json
file and an src
folder where you'll build out your project components.
Once you've created a project, you can run other project commands inside your project directory and HubSpot will automatically recognize your project.
Upload the project to your HubSpot account and create a build. If the project hasn't been created in the account yet, you'll be asked whether you want to create it.
If the project is configured to auto-deploy, this command will automatically deploy after the build is successful. By default, new projects are set to auto-deploy.
You can upload a project to a specific account in your hubspot.config.yml
file by adding --account=accountName
to the command. For example, hs project upload --account=main
. This can be useful when switching between uploading to a sandbox account and then uploading to the main account. For example, your workflow might look like:
- When developing your project in a sandbox, you upload changes with
hs project upload--account=sandbox
. - Then when uploading the project to a main account, you upload the project with
hs project upload--account=main
.
You can use the same configuration when using the watch command.
You can deploy any build by adding --buildId=buildID
. For example, hs project deploy --buildId=123
.
Watches the project directory and uploads to HubSpot upon saving, including deleting files. Each upload will result in a new build with a new build ID. A successful build will deploy automatically if the project’s auto-deploy setting is turned on.
You can further configure watch to send changes to a specific account with ---account=accountName
. For example, hs project watch --account=main
.
Get logs for a specific function within a project.
Running this command will guide you through selecting the project, app, and serverless function to get logs for. However, you can also manually specify this information by including the following flags in the command:
Flag | Description |
---|---|
--project=projectName
| The name of the project as set in the |
--app=appName
| The name of the app as set in the |
--function=functionName
| For app functions, the name of the serverless function as set in the |
--endpoint
| For endpoint functions, the public endpoint path. |
Interact with development sandboxes using the commands below.
Creates a new development sandbox within a production account. A production account can only have two development sandboxes at a time. Learn more about development sandbox limits.
Thank you for your feedback, it means a lot to us.