# Start the application

## `yarn start` or `npm run start`

This command executes a local deployment of your Magento 2 application.\
It does it in the following steps:

1. Prepare your project for Magento 2.
2. Pull PHP, Varnish, MariaDB, ElasticSearch, Nginx and Redis images
3. Build project image
4. Deploy containers: PHP, Varnish, Redis, MariaDB, ElasticSearch, Nginx and SSL Terminator Nginx container.
5. Install Magento 2 using Composer.
6. Setup Magento 2.
7. Open a browser with up and running Magento 2 store.

### **Command options**

#### **`-p, --port`**

A port to run your application on.

{% hint style="info" %}
By default, Create Magento App will select a random available port.
{% endhint %}

```bash
yarn start --port <port> # for Yarn
npm run start -- --port <port> # for NPM
```

#### **`-n, --no-open`**

Disable auto-open of a browser window at the end of the workflow.

```bash
yarn start --no-open # for Yarn
npm run start -- --no-open # for NPM
```

{% hint style="info" %}
You can set `CMA_NO_OPEN=1` environment variable in your shell to persist this flag.
{% endhint %}

#### **`-d, --debug`**

{% hint style="warning" %}
Since **magento-scripts\@2.4.0** this option is not available.
{% endhint %}

Enable [XDebug](https://xdebug.org/) for debugging PHP.

```bash
yarn start --debug # for Yarn
npm run start -- --debug # for NPM
```

#### **`-s, --skip-setup`**

Skips Magento setup.

{% hint style="warning" %}
**Skipping Magento setup might result in conflict during runtime because Magento config will not be updated with a new port config.**\
This option can be used only if you **100% sure** that the ports configuration is the same.
{% endhint %}

In a nutshell, this option enables start command will just restart services and PHP-FPM, so if you need to restart the project it can be done in under 10 seconds\*.

```bash
yarn start --skip-setup # for Yarn
npm run start -- --skip-setup # for NPM
```

#### `--pull-images`

Pull Container Images.

This is used for updating container images.

```bash
yarn start --pull-images # for Yarn
npm run start -- --pull-images # for NPM
```

#### `--reset-global-config`

Reset global configuration for current CMA instance.

This will reset configuration that is set for some prompts that appears during setup.&#x20;

```bash
yarn start --reset-global-config # for Yarn
npm run start -- --reset-global-config # for NPM
```

#### `-v, --verbose`

{% hint style="info" %}
Since **magento-scripts\@1.8.0**
{% endhint %}

This option will enable printing of logs from Magento installation, setup and upgrade tasks.

```bash
yarn start --verbose # for Yarn
npm run start -- --verbose # for NPM
```

## Usage example

```bash
yarn start # for Yarn
npm start # for NPM
```
