---
schema_version: "1"
id: e2a71af83849d1e8db2048d94033dcb1500505061c50f35895976a54a9a62e84
title: lightning dev app
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/lightning/cli_reference_lightning_dev_app.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_lightning_dev_app.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: bab730942e3286ee91a4ebc20117b071fa7efb8956a36637c2451add09e1174f
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# lightning dev app

Preview a Lightning Experience app locally and in real-time, without deploying it.

## Description for lightning dev app

Use Local Dev to see local changes to your app in a real-time preview that you don't have to deploy or manually refresh. To let you quickly iterate on your Lightning web components (LWCs) and pages, your app preview automatically refreshes when Local Dev detects source code changes.

When you edit these local files with Local Dev enabled, your org automatically reflects these changes.

<ul><li>Basic HTML and CSS edits to LWCs</li><li>JavaScript changes to LWCs that don't affect the component's public API</li><li>Importing new custom LWCs</li><li>Importing another instance of an existing LWC</li></ul>

To apply any other local changes not listed above, you must deploy them to your org using the `sf project deploy start` command.

When you make changes directly in your org (like saving new component properties), they're automatically deployed to your live app. To update your local version of the app with those changes, you must retrieve them from your org using the `sf project retrieve start` command.

If you run the command without flags, it displays a list of devices for you to choose from. Then it lists the apps that it found in your local DX project for you to choose. Use the --device or --name flags to bypass the questions. The command also asks if you want to enable Local Dev in your org if it isn't already.

To learn more about Local Dev enablement, considerations, and limitations, see the Lightning Web Components Developer Guide (https://developer.salesforce.com/docs/platform/lwc/guide/get-started-test-components.html).

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;api&#8209;version</code> | N/A | **Type:** Value<br><br>Override the api version used for api requests made by this command |
| <code>&#8209;&#8209;device&#8209;id</code> | <code>&#8209;i</code> | **Type:** Value<br><br>ID of the mobile device to display the preview if device type is set to `ios` or `android`. The default value is the ID of the first available mobile device. |
| <code>&#8209;&#8209;device&#8209;type</code> | <code>&#8209;t</code> | **Type:** Value<br>**Valid Values:** `desktop`, `ios`, `android`<br><br>Type of device to display the app preview. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;name</code> | <code>&#8209;n</code> | **Type:** Value<br><br>Name of the Lightning Experience app to preview. |
| <code>&#8209;&#8209;target&#8209;org</code> | <code>&#8209;o</code> | **Type:** Value<br>**Required**<br><br>Username or alias of the target org. Not required if the `target-org` configuration variable is already set. |

## Examples for lightning dev app

Preview the default app for the target org "myOrg" in a desktop environment:

```shell
sf lightning dev app --target-org myOrg
```

Preview the app "myApp" for the target org "myOrg" in a desktop environment:

```shell
sf lightning dev app --name MyApp --target-org myOrg --device-type desktop
```

Preview the default app for target org "myOrg" on an iOS device:

```shell
sf lightning dev app --target-org myOrg --device-type ios --device-id "iPhone 15 Pro Max"
```
<!-- prettier-ignore-end -->
