Get Started by Using a Sample Repo

The quickest way to get going with Salesforce DX tooling is to clone the dreamhouse-lwc GitHub repo. Use its configuration files and Salesforce application to try some commonly used Salesforce CLI commands. In addition to source code for the application, the repo includes sample data and Apex tests.
This task assumes you have a Dev Hub org. See Select and Enable a Dev Hub Org for more information.
  1. If you haven't already, install Salesforce CLI on your computer.
  2. Open a terminal or command prompt window, and clone the dreamhouse-lwc GitHub sample repo using HTTPS or SSH.
    HTTPS:
    1git clone https://github.com/trailheadapps/dreamhouse-lwc.git

    SSH:

    1git clone git@github.com:trailheadapps/dreamhouse-lwc.git
  3. Change to the dreamhouse-lwc project directory.
    1cd dreamhouse-lwc
  4. Authorize your Dev Hub org by logging into it, set it as your default, and assign it an alias.
    1sf org login web --set-default-dev-hub --alias DevHub
    Enter your Dev Hub org credentials in the browser that opens. After you log in successfully, you can close the browser.
  5. Create a scratch org using the config/project-scratch-def.json file, set the org as your default, and assign it an alias.
    1sf org create scratch --definition-file config/project-scratch-def.json --set-default --alias my-scratch-org
    The command uses the default Dev Hub you set with the sf org login web command in a previous step.
  6. View the orgs that you've either created or logged into.
    1sf org list

    The table displays the Dev Hub you logged into and the scratch org you created. The right-most column indicates the default scratch org and Dev Hub org; in the real-life output you see cute emojis, but in the output below we use (S) and (D), respectively. The Alias column displays the aliases you assigned each org. Here’s some sample output.

    1Type    Alias          Username                               Org ID             Status                Expires    
    2 ──  ─────── ────────────── ────────────────────────────────────── ────────────────── ───────────────────── ────────── 
    3 (D) DevHub  DevHub         jules@sf.com                           00Daj0AUXXXXXXXXXX Connected                        
    4     Sandbox                jules@sf.com.jssandtwo                 00D02000EAMXXXXXXX Connected                        
    5 (S) Scratch my-scratch-org test-loo73bj6givn@example.com          00D7xOjgTEASXXXXXX Active                2024-05-16 
    6
    7Legend:  (D)=DevHub, (S)=Default Org      Use --all to see expired and deleted scratch orgs
  7. Deploy the Dreamforce app, whose source is in the force-app directory, to the scratch org.
    1sf project deploy start --source-dir force-app
  8. Assign the dreamhouse permission set to the default scratch org user (test-ibnpzayw@example.com).
    1sf org assign permset --name dreamhouse
  9. Import sample data from three objects (Contact, Property, and Broker) into the scratch org using the specified plan definition file.
    1sf data import tree --plan data/sample-data-plan.json
  10. Run Apex tests.
    1sf apex run test --result-format human --wait 1
    Apex tests run asynchronously by default. If the tests finish before the --wait value, the results are displayed. Otherwise, use the displayed command to get the results using a job ID.
  11. Open the scratch org and view the deployed metadata under Most Recently Used.
    1sf org open
  12. In App Launcher, find and open the Dreamhouse application.
Congrats! You just deployed an application to a new scratch org.