Developer projects CLI commands (BETA)
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
To learn more about a specific command, enter the command followed by
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.
Start a local development server to view extension changes in the browser without needing to refresh. With the server running, saving changes to your extension's front end files and serverless function files will cause the extension to automatically refresh. This does not include changes made to the
.json config files, which need to be manually uploaded instead.
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:
The name of the project as set in the
The name of the app as set in the
For app functions, the name of the serverless function as set in the
For endpoint functions, the public endpoint path.
Creates a new sandbox in a production account. When running this command, you can select whether you want to create a standard sandbox or a development sandbox.
A production account can only have one standard sandbox and two development sandboxes at a time. Learn more about development sandbox limits.
Thank you for your feedback, it means a lot to us.