Skip to main content

Project deployment with the Command Line Interface (CLI)

This is a step-by-step guide for deploying your project on Strapi Cloud for the first time, using the Command Line Interface.

Before you can deploy your Strapi application on Strapi Cloud using the Command Line Interface, you need to have the following prerequisites:

  • During your free Strapi Cloud trial, ensure you have at least 1 project slot available. Your free trial can only include up to 5 projects (see Usage & billing).
  • Have a Google, GitHub or GitLab account.
  • Have an already created Strapi project (see Installing from CLI in the Developer Documentation), stored locally. The project must be less than 100MB.
  • Have available storage in your hard drive where the temporary folder of your operating system is stored.

Logging in to Strapi Cloud

  1. Open your terminal.

  2. Navigate to the folder of your Strapi project, stored locally on your computer.

  3. Enter the following command to log into Strapi Cloud:

yarn" label="Yarn">

yarn strapi login

npm" label="NPM">

npx run strapi login
  1. In the browser window that opens automatically, confirm that the code displayed is the same as the one written in the terminal message.

  2. Still in the browser window, choose whether to login via Google, GitHub or GitLab. The window should confirm the successful login soon after.

Deploying your project

  1. From your terminal, still from the folder of your Strapi project, enter the following command to deploy the project:

yarn" label="Yarn">

yarn strapi deploy

npm" label="NPM">

npx run strapi deploy
  1. Follow the progression bar in the terminal until confirmation that the project was successfully deployed with Strapi Cloud.

Automatically deploying subsequent changes

By default, when creating and deploying a project with the Cloud CLI, you need to manually deploy again all subsequent changes by running the corresponding deploy command everytime you make a change.

Another option is to enable automatic deployment through a git repository. To do so:

  1. Host your code on a git repository, such as GitHub or GitLab.
  2. Connect your Strapi Cloud project to the repository (see the Connected repository setting in Projects Settings > General).
  3. Still in Projects Settings > General tab, tick the box for the "Deploy the project on every commit pushed to this branch" setting. From now on, a new deployment to Strapi Cloud will be triggered any time a commit is pushed to the connected git repository.
note

Automatic deployment is compatible with all other deployment methods, so once a git repository is connected, you can trigger a new deployment to Strapi Cloud from the Cloud dashboard, from the CLI, or by pushing new commits to your connected repository.

⏩ What to do next?

Now that you have deployed your project via the Command Line Interface, we encourage you to explore the following ideas to have an even more complete Strapi Cloud experience: