Apps & Environments

Now that you’ve generated the code of your application you will want to create a new application on Begin. An application on Begin will have one or more environments in which you can deploy your code. For example staging and production.

Creating an app

To create a new app on Begin you will use the Begin CLI. In order to create a new app you will need to be in the root folder of your project. The begin create command will ask you a few questions in order to setup your application. For example:

begin create
This project doesn't appear to be associated with a Begin app
? Would you like to create a Begin app based on this project? (Y/n) true

? What would you like to name your app? begin-example-app

? What would you like to name your first environment? staging

Added appID 'XXXXXXXXX' to project, be sure to commit this change!
App 'begin-example-app' + environment 'staging' created at https://local-fih.begin.app

? Would you like to deploy your app? (Y/n) false
You can deploy at any time by running: begin deploy
b create
This project doesn't appear to be associated with a Begin app
? Would you like to create a Begin app based on this project? (Y/n) true

? What would you like to name your app? begin-example-app

? What would you like to name your first environment? staging

Added appID 'XXXXXXXXX' to project, be sure to commit this change!
App 'begin-example-app' + environment 'staging' created at https://local-fih.begin.app

? Would you like to deploy your app? (Y/n) false
You can deploy at any time by running: begin deploy

After the command finishes you will have a new app on Begin with a staging environment.

The begin create command will add a new @begin pragma to your project’s .arc file with the projects new appID. Make sure you commit this change to source code control.

Listing your apps

Sometimes you might lose track of all the apps you’ve created on Begin so begin list is a helpful command which lists all the apps and environments under your account.

begin list
begin-example-app (app ID: XXXXXXXXX)
└── staging (env ID: STGXXXXXX): https://local-fih.begin.app
b list
begin-example-app (app ID: XXXXXXXXX)
└── staging (env ID: STGXXXXXX): https://local-fih.begin.app

Deleting an app

If you decide you no longer need an application under your account you can delete it by running begin destroy.

begin destroy -a XXXXXXXXX
? Are you sure you want to destroy this Begin app
(name: 'begin-example-app', ID: 'XXXXXXXXX') and its 1 environment? › XXXXXXXXX
Destroyed Begin app ID 'XXXXXXXXX'
b destroy -a XXXXXXXXX
? Are you sure you want to destroy this Begin app
(name: 'begin-example-app', ID: 'XXXXXXXXX') and its 1 environment? › XXXXXXXXX
Destroyed Begin app ID 'XXXXXXXXX'

There is no way to recover your application once you delete it from Begin. If you have mistakenly deleted an app you will need to create a new app and deploy it to Begin.

Creating an environment

Perhaps you have already created an app with a staging environment but you are ready to share it with the rest of the world. Let’s create a production environment for your app using the CLI. If you are in the root folder of you application you can run:

begin create --env production
b create --env production

Otherwise, you will need to specify the Begin application ID.

begin create --app XXXXXXXX --env production
b create --app XXXXXXXX --env production

Regardless, the output of either command is that you will have a new environment called production under your app.

Deleting an environment

You may want to remove an environment from you application. Perhaps you were developing a new feature and you no longer need the environment associated with this feature. Once again we will use the begin destroy command to clean up the unwanted environment.

begin destroy --env PRODXXXX
? Are you sure you want to destroy this Begin app environment
(env name: 'production', env ID: 'PRODXXXX')? · PRODXXXX
Destroyed Begin app environment (env name: 'production', env ID: 'PRODXXXX')
b destroy --env PRODXXXX
? Are you sure you want to destroy this Begin app environment
(env name: 'production', env ID: 'PRODXXXX')? · PRODXXXX
Destroyed Begin app environment (env name: 'production', env ID: 'PRODXXXX')

If you are not in the apps root folder you will need to specify the app ID in the command as well.

begin destroy --app XXXXXXXX --env PRODXXXX
? Are you sure you want to destroy this Begin app environment
(env name: 'production', env ID: 'PRODXXXX')? · PRODXXXX
Destroyed Begin app environment (env name: 'production', env ID: 'PRODXXXX')
b destroy --app XXXXXXXX --env PRODXXXX
? Are you sure you want to destroy this Begin app environment
(env name: 'production', env ID: 'PRODXXXX')? · PRODXXXX
Destroyed Begin app environment (env name: 'production', env ID: 'PRODXXXX')