Beginner 15 min read

Salesforce CLI and VS Code Setup

By the end of this lesson, you'll be able to:

  • Install and verify Salesforce CLI (sf)
  • Set up VS Code with the Salesforce Extension Pack
  • Identify the key extensions used throughout this course

Prerequisites: Module 1: "Project: Build a Hello Salesforce Component"

Why Local Development, Not the Developer Console

Developer Console (the browser-based tool built into Salesforce) works fine for quick Apex edits, but it has no real support for LWC file bundles, no source control integration, and none of the modern editor features — autocomplete, inline linting, multi-file refactoring — that make component development manageable at any real scale. Professional LWC development happens in a local editor with CLI tooling, not in the browser.

Installing Salesforce CLI

npm install --global @salesforce/cli
sf --version

sf is the current, actively developed Salesforce CLI. You'll see older tutorials and existing org documentation reference sfdx commands (sfdx force:...) — that CLI has been superseded by sf. Recognize sfdx syntax when you see it, but use sf going forward.

VS Code and the Salesforce Extension Pack

Install Visual Studio Code, then search the Extensions marketplace for "Salesforce Extension Pack" and install it. This single pack bundles everything you need:

  • Salesforce CLI Integration
  • Salesforce Apex
  • Salesforce Lightning Web Components
  • Apex Replay Debugger
  • (optionally) Lightning Explorer, for browsing an org's component metadata

Key Extension Features You'll Use

  • Command Palette integrationCmd/Ctrl+Shift+P, then type "SFDX:" to see every deploy/retrieve/org command available without leaving the editor.
  • The Problems panel — compile errors and warnings surface inline as you type, not just after a deploy attempt.
  • IntelliSense — autocomplete for LWC template bindings and Salesforce base components (lightning-button, lightning-input, and dozens more) as you type them.

Exercise

Write the exact terminal command to install Salesforce CLI via npm, and the command to verify it installed correctly.

Show hint

One command installs globally; the other just checks the version.

BASH

Exercise

Challenge: explain, as a comment, why Developer Console — which works fine for Apex — isn't a viable tool for building Lightning Web Components.

Show hint

Think about file bundles, source control, and editor tooling.

BASH

Salesforce CLI and VS Code Setup Quiz

1. Which command installs Salesforce CLI via npm?

2. Which tool bundles the recommended VS Code extensions for Salesforce development?

3. Developer Console fully supports editing Lightning Web Component bundles.

4. What does running sf --version confirm?

5. Which is the current, recommended CLI command prefix going forward?

Log in to submit the quiz and save your score.

My Notes

Log in to keep private notes on this lesson.

Questions about this lesson

No questions yet — be the first to ask.

Log in to ask a question about this lesson.

Summary

Real LWC development happens locally, in a proper editor with CLI tooling — not in the browser-based Developer Console. This lesson sets up the toolchain every later lesson assumes.