Create Project

Launch your VS Code desktop application and follow the given steps to create a Salesforce DX project:

  1. Open the Command Palette (⇧⌘P) and enter SFDX: Create Project.
  2. Press Enter to use a standard project template.
  3. Add a project name and press Enter.
  4. Select the directory where you'd like to create your project and then click OK.

The new project is now available in the Project Explorer.

If you already have a DX project in a GitHub repo, you can clone the repo into your VS Code desktop environment.

To clone a repo using SSH, use a SSH key that is recognized by GitHub. To configure the SSH key, follow the Connecting to GitHub with SSH instructions on the GitHub website. You must complete these steps before you can clone a repo.

To create a project from a GitHub repo, let's use the dreamhouse-lwc sample app.

  1. From the menu, select Terminal > New Terminal.
  2. Clone the dreamhouse-lwc sample app repo into a directory on your desktop by running:
  1. Go to File > Open Folder.
  2. Select the dreamhouse-lwc folder that was generated by the clone command.

The dreamhouse-lwc project is now open and ready to use!

  1. Open the VS Code editor and from the Command Palette, run SFDX: Create Project with Manifest.

Create project

  1. In the code editor's status bar, click Org Picker to open the Command Palette. Select from the list of authorized orgs, or choose to authorize a new org.

If it's the first time you’re creating a project in VS Code and you haven’t authorized an org yet, the display text for the Org Picker shows No Default Org Set.

  1. Run SFDX: Authorize an Org and select a login URL, for example, Sandbox.

Authorize an Org

After you provide an org alias, a browser window opens. Allow access, log in to your org, and then return to the VS Code window. The Org Picker now shows the alias provided while authorizing the org.

Org Picker

After connecting to a sandbox, DE org, or Trailhead Playground, use the package.xml file to retrieve the metadata from your org. When you run the SFDX: Create Project with Manifest command, a package.xml file is created. Add the various metadata types you want to retrieve to this file. To understand how to work with different subsets of metadata in package.xml file, see Sample package.xml Manifest Files in the Metadata API Developer Guide.

For more information about DX projects, see Salesforce DX Project Structure and Source Format in the Salesforce DX Developer Guide.

See Also Create a Salesforce DX Project