Set Up Your Salesforce DX Environment

Learning Objectives

In this project, you’ll:

  • Install Salesforce CLI.
  • Install Visual Studio Code and extensions for Salesforce DX.
  • Create and deploy a Lightning web component.


Lightning Web Components is a new programming model for building Lightning components. It leverages web standards breakthroughs, can coexist and interoperate with the Aura programming model, and delivers unparalleled performance. To create and develop Lightning Web Components and leverage their powerful features and performance benefits, you need to set up Salesforce DX. For this Quick Start you also use Visual Studio Code, which is the recommended Salesforce development environment. Once your developer environment is ready, you learn how to write a simple Lightning web component and add it to a page in Lightning Experience.

The Salesforce Developer Experience (DX) is a set of tools that streamlines the entire development life cycle. It improves team development and collaboration, facilitates automated testing and continuous integration, and makes the release cycle more efficient and agile. 

Salesforce DX includes Dev Hubs and scratch orgs for easy deployment. By the end of the Quick Start you will have signed up for a Dev Hub and created a scratch org.



In this Quick Start, we develop with scratch orgs. You can also develop Lightning web components against non-scratch orgs using the force:source:deploy command. Learn more about source-driven development in the Innovate Faster with Salesforce Environments and Salesforce DX unit of the Salesforce CRM Customization and Extension module.

What Is the Difference Between a Scratch Org and a Dev Hub?

A scratch org is a dedicated, configurable, and short-term Salesforce environment that you can quickly spin up when starting a new project, a new feature branch, or a feature test.

A Developer Hub (Dev Hub) is the main Salesforce org that you and your team use to create and manage your scratch orgs. 

For this project you use a Developer Edition org as your Dev Hub, and create a Lightning web component in a scratch org. Because Lightning Web Components are a pre-release feature, you need to sign up for a pre-release org to complete this quick start. 

Enable Dev Hub in a Developer Edition pre-release org



After you enable Dev Hub in your org, you can’t disable it.

  1. If you don’t have a pre-release org, sign up for a pre-release Developer Edition at
  2. Log in as System Administrator to your pre-release Developer Edition.
  3. Click The Setup gear icon.and select Setup.
  4. From Setup, enter Dev Hub in the Quick Find box and select Dev Hub.
  5. To enable Dev Hub, click Enable.

Install the Pre-Release Version of Salesforce Command Line Interface (CLI)

You can use the Salesforce CLI to control the full application life cycle of your Salesforce apps. Through the CLI you can easily create environments for development and testing, and synchronize source code between your orgs and a version control system.

In order to use the next release before it's generally available, you need to install the CLI, then set its version to pre-release. If you already have the CLI installed, skip to step 3 to set the version to pre-release.

  1. Download the CLI using the appropriate link below.
Operating System
Link to Installer
Windows 32-bit
Windows 64-bit
Debian/Ubuntu 64
Download the archive from one of the URLs in the manifest, extract the archive, then run the ./install script.
Debian/Ubuntu x86
Download the archive from one of the URLs in the manifest, extract the archive, then run the ./install script.
  1. Install the CLI through the installer.
  2. Confirm that you’ve installed the CLI correctly by running this command: sfdx plugins. The salesforcedx line tells you which version you installed.
  3. Upgrade to the pre-release version of the CLI by running this command: sfdx plugins:install salesforcedx@pre-release
  4. After the pre-release is installed, confirm you have the pre-release version by running sfdx plugins. Your number for the salesforcedx plugin should be at least 45.0.9. You should see something like:

Terminal showing the output of running 'sfdx plugins'



Once you've finished this Quick Start, you can check out the Salesforce DX Setup Guide for information on how to install the normal version of the plugin.

In our next step, we set up our local development environment with Visual Studio Code.

We won’t check any of your setup. Click Verify Step to go to the next step in the project.