Deploying code

Once you’ve created an app with at least one environment, you’re ready to deploy. Deploying code with the Begin CLI is a cinch!

Deploy

If your app has a single environment, deploying is as simple as running the command begin deploy.

begin deploy
Archiving and uploading project to Begin...
Project uploaded, you can now exit this process
and check its status with: begin deploy --status
npx begin deploy
Archiving and uploading project to Begin...
Project uploaded, you can now exit this process
and check its status with: begin deploy --status

If you don’t quit the command by typing Ctrl+c, you’ll see output similar to:

Beginning deployment of 'staging'
Packaging build for deployment
Publishing build to Begin
Build completed!
Deployed 'staging' to: https://local-fih.begin.app

Check deployment status

If you exit the deploy process before the deployment is complete, you can check the status of a deployment by running this command from the root of your project:

begin deploy --status
npx begin deploy --status

The BeginCLI will report that your latest deployment is in one of the following states:

  • building: Your project is currently being built.
  • deploying: A deploy of your project is currently in progress.
  • failed: An error occurred while trying to deploy our project.
  • success: The deployment succeeded and your project is available at the provided url.

Deploy to an environment

If your app has more than one environment, you’ll need to specify which environment you want to deploy to.

begin deploy --env staging
npx begin deploy --env staging

This will work identically to the deploy process described in the first section of this page.