On the tenth day of Enhancing: Deploying your app
Tags: enhance, webdev, webcomponents
Published: 2023-01-04 13:49:50

---
title: On the tenth day of Enhancing: Deploying your app
published: true
description: Deploy your Enhance app to the cloud using the Begin CLI.
tags: enhance, webdev, webcomponents
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y3jab9z184fidjhmpnz0.jpg
canonical_url: https://blog.begin.com/posts/2023-01-04-on-the-tenth-day-of-enhancing
series: 12 Days of Enhancing
---

We’ve got a pretty good start on our web application so let’s take a look at what it is like to deploy to a `stating` and `production` environment.

## Log in to Begin

Before you deploy your application, you’ll need to login to Begin via the CLI. In order to login to Begin you will need a [GitHub account](https://github.com/join). From the terminal execute `begin login`. If you are already logged in no further action will be needed but if you are not logged in you will need to visit the URL it prints out. For example:

```bash
begin login
Please authenticate by visiting: https://api.begin.com/auth?user_code=NOT_A_REAL_CODE
```

When you visit the URL provided you will get a screen like this:

![login](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0mcli5e6c5dur0i6bw01.png)

Then once you complete the login with GitHub and authorizing Begin to use GitHub OAuth you will be rewarded with this screen.

![login success](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2e9jl2sjes0z24mi28wr.png)

Now in the command line you should see a message that you are successfully authenticated.

```bash
begin login
Found incomplete login, trying again
Please authenticate by visiting: https://api.begin.com/auth?user_code=NOT_A_REAL_CODE
Awaiting authentication...
Successfully logged in!
```


## 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:

```bash
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? · 12-days
? What would you like to name your first environment? · staging
Added appID 'NOTREALS' to project, be sure to commit this change!
App '12-days' + environment 'staging' created at https://shiny-b27.begin.app
? Would you like to deploy your app? (Y/n) · true
Archiving and uploading project to Begin...
Project uploaded, you can now exit this process and check its status with: begin deploy --status
Beginning deployment of 'staging'
Packaging build for deployment
Publishing build to Begin
Build completed!
Deployed 'staging' to: https://shiny-b27.begin.app
```

You may notice that we decided to create a `staging` environment when we created the application. We recommend that you have at least two environments so you can test your deployment before moving it over to production. Speaking of production.


## Adding a production environment

We will want to have a separate environment for production so we can test code changes in our `staging` environment before moving them to the production environment. To create a new environment and deploy to it run the following commands:

```bash
begin create --env production
begin deploy --env production
```

Now we have two different environments with different URL’s.

## Next Steps

Tomorrow we’ll show you how to use environment variables to control how your app behaves in various environments.